-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r/aws_vpc_dhcp_options: fix not found error handling on delete #36933
Conversation
Community NoteVoting for Prioritization
For Submitters
|
The `DeleteDhcpOptions` API can return a slightly different error code than the associated read operation. This change introduces a new error code constant, preventing the delete operation from failing if the DHCP options have been deleted out-of-band. Before: ```console % make testacc PKG=ec2 TESTS="TestAccVPCDHCPOptions_disappears|TestAccVPCDHCPOptionsAssociation_Disappears_dhcp" ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.21.8 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCDHCPOptions_disappears|TestAccVPCDHCPOptionsAssociation_Disappears_dhcp' -timeout 360m === RUN TestAccVPCDHCPOptionsAssociation_Disappears_dhcp === PAUSE TestAccVPCDHCPOptionsAssociation_Disappears_dhcp === RUN TestAccVPCDHCPOptions_disappears === PAUSE TestAccVPCDHCPOptions_disappears === CONT TestAccVPCDHCPOptionsAssociation_Disappears_dhcp === CONT TestAccVPCDHCPOptions_disappears vpc_dhcp_options_test.go:148: Error running post-test destroy, there may be dangling resources: exit status 1 Error: deleting EC2 DHCP Options Set (dopt-0afbf75b2cde4f980): InvalidDhcpOptionsID.NotFound: The dhcpOptions ID 'dopt-0afbf75b2cde4f980' does not exist status code: 400, request id: fdf420ca-2934-44cd-8d0a-47d4eaceb401 --- FAIL: TestAccVPCDHCPOptions_disappears (10.52s) === NAME TestAccVPCDHCPOptionsAssociation_Disappears_dhcp vpc_dhcp_options_association_test.go:76: Error running post-test destroy, there may be dangling resources: exit status 1 Error: deleting EC2 DHCP Options Set (dopt-0a28e081bb7a4528e): InvalidDhcpOptionsID.NotFound: The dhcpOptions ID 'dopt-0a28e081bb7a4528e' does not exist status code: 400, request id: 35937877-857c-4309-b53f-48c8c2ec6dd3 --- FAIL: TestAccVPCDHCPOptionsAssociation_Disappears_dhcp (14.02s) FAIL FAIL github.com/hashicorp/terraform-provider-aws/internal/service/ec2 19.930s ``` After: ```console % make testacc PKG=ec2 TESTS="TestAccVPCDHCPOptions_disappears|TestAccVPCDHCPOptionsAssociation_Disappears_dhcp" ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.21.8 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCDHCPOptions_disappears|TestAccVPCDHCPOptionsAssociation_Disappears_dhcp' -timeout 360m --- PASS: TestAccVPCDHCPOptions_disappears (10.68s) --- PASS: TestAccVPCDHCPOptionsAssociation_Disappears_dhcp (14.40s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 20.149s ``` See the AWS EC2 error code reference for additional details: - https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html#api-error-codes-table-client
2ed3c17
to
5f0d2f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
This functionality has been released in v5.46.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
The
DeleteDhcpOptions
API can return a slightly different error code than the associated read operation. This change introduces a new error code constant, preventing the delete operation from failing if the DHCP options have been deleted out-of-band.Before:
After:
References
Relates #35747.
Output from Acceptance Testing