From 33a1943aa8c75b3fe6545c7c20c431afbb3f9435 Mon Sep 17 00:00:00 2001 From: angie pinilla Date: Mon, 18 Oct 2021 10:48:12 -0400 Subject: [PATCH 1/3] remove changelog configuration override --- .goreleaser.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 550751eb05..7ef06f2faa 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -28,8 +28,6 @@ builds: ldflags: - -s -w -X internal/provider.Version={{.Version}} mod_timestamp: '{{ .CommitTimestamp }}' -changelog: - skip: true checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' algorithm: sha256 @@ -61,4 +59,4 @@ signs: --out ${signature} artifacts: checksum snapshot: - name_template: "{{ .Tag }}-next" \ No newline at end of file + name_template: "{{ .Tag }}-next" From 9a7ddb3747d692ee496a0d9bda2745b0afb2e29f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 19 Oct 2021 14:54:01 -0400 Subject: [PATCH 2/3] Persist any ID to state if Create fails while waiting for async operation completion. --- internal/generic/resource.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/internal/generic/resource.go b/internal/generic/resource.go index edee186474..e6be75ab20 100644 --- a/internal/generic/resource.go +++ b/internal/generic/resource.go @@ -449,14 +449,32 @@ func (r *resource) Create(ctx context.Context, request tfsdk.CreateResourceReque err = waiter.Wait(ctx, &cloudcontrol.GetResourceRequestStatusInput{RequestToken: output.ProgressEvent.RequestToken}, r.resourceType.createTimeout) + id := aws.ToString(progressEvent.Identifier) + if err != nil { response.Diagnostics = append(response.Diagnostics, ServiceOperationWaiterErrorDiag("Cloud Control API", "CreateResource", err)) + // Save any ID to state so that the resource will be marked as tainted. + if id != "" { + err := r.setEmptyAttributes(ctx, &response.State) + + if err == nil { + err = r.setId(ctx, id, &response.State) + + if err != nil { + response.Diagnostics = append(response.Diagnostics, ResourceIdentifierNotSetDiag(err)) + } + } else { + response.Diagnostics.AddError( + "Creation Of Terraform State Unsuccessful", + fmt.Sprintf("Unable to set Terraform State empty values. This is typically an error with the Terraform provider implementation. Original Error: %s", err.Error()), + ) + } + } + return } - id := aws.ToString(progressEvent.Identifier) - // Produce a wholly-known new State by determining the final values for any attributes left unknown in the planned state. response.State.Raw = request.Plan.Raw From 0f06822fe9ac1fb311b6474df43198b25feea335 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 19 Oct 2021 14:57:30 -0400 Subject: [PATCH 3/3] Add CHANGELOG entry. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea54b82ae..d0925687af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.4.0 (Unreleased) + +BUG FIXES: + +* Persist any resource `id` to state if Create fails while waiting for async operation completion ([#252](https://github.com/hashicorp/terraform-provider-awscc/issues/252)) + ## [0.3.0](https://github.com/hashicorp/terraform-provider-awscc/releases/tag/v0.3.0) (October 14, 2021) BREAKING CHANGES: