Skip to content

Commit

Permalink
r/aws_elbv2_trust_store_revocation: fix to properly return create errors
Browse files Browse the repository at this point in the history
Previously the error was appended to the existing diagnostics but not returned, allowing the create operation to proceed and eventually attempt dereferencing a nil pointer to the create API response.

```console
% make testacc PKG=elbv2 TESTS=TestAccELBV2TrustStoreRevocation_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/elbv2/... -v -count 1 -parallel 20 -run='TestAccELBV2TrustStoreRevocation_'  -timeout 360m

--- PASS: TestAccELBV2TrustStoreRevocation_basic (53.44s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elbv2      59.341s
```
  • Loading branch information
jar-b committed Aug 7, 2024
1 parent 2dc6a2c commit fa57a28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/38756.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_elbv2_trust_store_revocation: Fix to properly return errors during resource creation
```
2 changes: 1 addition & 1 deletion internal/service/elbv2/trust_store_revocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func resourceTrustStoreRevocationCreate(ctx context.Context, d *schema.ResourceD
output, err := conn.AddTrustStoreRevocations(ctx, input)

if err != nil {
sdkdiag.AppendErrorf(diags, "creating ELBv2 Trust Store (%s) Revocation (s3://%s/%s): %s", trustStoreARN, s3Bucket, s3Key, err)
return sdkdiag.AppendErrorf(diags, "creating ELBv2 Trust Store (%s) Revocation (s3://%s/%s): %s", trustStoreARN, s3Bucket, s3Key, err)
}

revocationID := aws.ToInt64(output.TrustStoreRevocations[0].RevocationId)
Expand Down

0 comments on commit fa57a28

Please sign in to comment.