Skip to content

Commit 3e882b4

Browse files
committed
fix provider deletion
1 parent e6f6012 commit 3e882b4

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ module terraform-provider-plural
33
go 1.21
44

55
require (
6+
github.com/Yamashou/gqlgenc v0.14.0
67
github.com/golangci/golangci-lint v1.55.2
78
github.com/hashicorp/terraform-plugin-docs v0.16.0
89
github.com/hashicorp/terraform-plugin-framework v1.4.2
910
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
1011
github.com/hashicorp/terraform-plugin-log v0.9.0
1112
github.com/mitchellh/go-homedir v1.1.0
12-
github.com/pluralsh/console-client-go v0.0.42
13+
github.com/pluralsh/console-client-go v0.0.43
1314
github.com/pluralsh/plural-cli v0.8.1-0.20231114161007-183eafb99b03
1415
github.com/pluralsh/polly v0.1.4
1516
github.com/samber/lo v1.38.1
@@ -41,7 +42,6 @@ require (
4142
github.com/Microsoft/go-winio v0.6.0 // indirect
4243
github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect
4344
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
44-
github.com/Yamashou/gqlgenc v0.14.0 // indirect
4545
github.com/acomagu/bufpipe v1.0.4 // indirect
4646
github.com/alecthomas/go-check-sumtype v0.1.3 // indirect
4747
github.com/alexkohler/nakedret/v2 v2.0.2 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
856856
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
857857
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
858858
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
859-
github.com/pluralsh/console-client-go v0.0.42 h1:9qeYWVNePx0RrHLUB83gGKRMPvSCMd81/PVPNWQYti8=
860-
github.com/pluralsh/console-client-go v0.0.42/go.mod h1:u/RjzXE3wtl3L6wiWxwhQHSpxFX46+EYvpkss2mALN4=
859+
github.com/pluralsh/console-client-go v0.0.43 h1:VtiFZ3qbE8SnpXfq8BBVlUx+WHM+gXI6pWNsK9OgbwA=
860+
github.com/pluralsh/console-client-go v0.0.43/go.mod h1:u/RjzXE3wtl3L6wiWxwhQHSpxFX46+EYvpkss2mALN4=
861861
github.com/pluralsh/gqlclient v1.11.0 h1:FfXW7FiEJLHOfTAa7NxDb8jb3aMZNIpCAcG+bg8uHYA=
862862
github.com/pluralsh/gqlclient v1.11.0/go.mod h1:qSXKUlio1F2DRPy8el4oFYsmpKbkUYspgPB87T4it5I=
863863
github.com/pluralsh/plural-cli v0.8.1-0.20231114161007-183eafb99b03 h1:toUJzv4+4SYGsw8kvrx2oQxrmKu8XYirrNmNyxx9NHk=

internal/resource/provider.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
1717
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
1818
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
19-
"github.com/hashicorp/terraform-plugin-log/tflog"
2019
"k8s.io/apimachinery/pkg/util/wait"
2120
)
2221

@@ -189,8 +188,6 @@ func (r *providerResource) Create(ctx context.Context, req resource.CreateReques
189188
return
190189
}
191190

192-
tflog.Trace(ctx, "created a provider")
193-
194191
data.From(result.CreateClusterProvider)
195192
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
196193
}
@@ -235,14 +232,14 @@ func (r *providerResource) Delete(ctx context.Context, req resource.DeleteReques
235232
return
236233
}
237234

238-
_, err := r.client.DeleteCluster(ctx, data.Id.ValueString())
235+
_, err := r.client.DeleteClusterProvider(ctx, data.Id.ValueString())
239236
if err != nil {
240237
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete provider, got error: %s", err))
241238
return
242239
}
243240

244241
err = wait.WaitForWithContext(ctx, client.Ticker(5*time.Second), func(ctx context.Context) (bool, error) {
245-
_, err := r.client.GetCluster(ctx, data.Id.ValueStringPointer())
242+
_, err := r.client.GetClusterProvider(ctx, data.Id.ValueString())
246243
if client.IsNotFound(err) {
247244
return true, nil
248245
}
@@ -253,8 +250,6 @@ func (r *providerResource) Delete(ctx context.Context, req resource.DeleteReques
253250
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Error while watiting for provider to be deleted, got error: %s", err))
254251
return
255252
}
256-
257-
tflog.Trace(ctx, "deleted the provider")
258253
}
259254

260255
func (r *providerResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {

0 commit comments

Comments
 (0)