Skip to content
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

resource/aws_network_interface_sg_attachment: Properly handle InvalidNetworkInterfaceID.NotFound errors #6048

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Oct 2, 2018

Fixes #1796

Changes:

  • Refactor aws_network_interface_sg_attachments acceptance testing to align with other resources
  • Add testAccCheckAWSENIDisappears
  • Add TestAccAWSNetworkInterfaceSGAttachment_disappears acceptance test for verifying error handling
  • Ensure aws_network_interface_sg_attachment resource removes resource during Read and exits successfully during Delete if it receives InvalidNetworkInterfaceID.NotFound error

Previously (before code updates):

--- PASS: TestAccAWSENI_disappears (35.81s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Multiple (33.03s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_basic (34.00s)
--- FAIL: TestAccAWSNetworkInterfaceSGAttachment_disappears (41.18s)
    testing.go:527: Step 1 error: Error on follow-up refresh: 1 error occurred:
        	* aws_network_interface_sg_attachment.test: 1 error occurred:
        	* aws_network_interface_sg_attachment.test: aws_network_interface_sg_attachment.test: InvalidNetworkInterfaceID.NotFound: The networkInterface ID 'eni-06f5470ea633d8b1c' does not exist
        	status code: 400, request id: 8f424390-cf91-4ef7-9d03-ed6e8711244c
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_DataSource (113.03s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Instance (119.99s)

Output from acceptance testing:

--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Multiple (33.00s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_basic (35.31s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_disappears (50.21s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_DataSource (115.76s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Instance (131.26s)

@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Oct 2, 2018
@bflad bflad requested a review from a team October 2, 2018 16:35
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Oct 2, 2018
…NetworkInterfaceID.NotFound errors

Changes:
* Refactor `aws_network_interface_sg_attachments` acceptance testing to align with other resources
* Add `testAccCheckAWSENIDisappears`
* Add `TestAccAWSNetworkInterfaceSGAttachment_disappears` acceptance test for verifying error handling
* Ensure `aws_network_interface_sg_attachment` resource removes resource during Read and exits successfully during Delete if it receives `InvalidNetworkInterfaceID.NotFound` error

Previously (before code updates):

```
--- PASS: TestAccAWSENI_disappears (35.81s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Multiple (33.03s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_basic (34.00s)
--- FAIL: TestAccAWSNetworkInterfaceSGAttachment_disappears (41.18s)
    testing.go:527: Step 1 error: Error on follow-up refresh: 1 error occurred:
        	* aws_network_interface_sg_attachment.test: 1 error occurred:
        	* aws_network_interface_sg_attachment.test: aws_network_interface_sg_attachment.test: InvalidNetworkInterfaceID.NotFound: The networkInterface ID 'eni-06f5470ea633d8b1c' does not exist
        	status code: 400, request id: 8f424390-cf91-4ef7-9d03-ed6e8711244c
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_DataSource (113.03s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Instance (119.99s)
```

Now:

```
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Multiple (33.00s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_basic (35.31s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_disappears (50.21s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_DataSource (115.76s)
--- PASS: TestAccAWSNetworkInterfaceSGAttachment_Instance (131.26s)
```
@bflad bflad added this to the v1.39.0 milestone Oct 3, 2018
@bflad bflad merged commit a9c4547 into master Oct 3, 2018
@bflad bflad deleted the b-aws_network_interface_sg_attachment-disappears branch October 3, 2018 17:04
bflad added a commit that referenced this pull request Oct 3, 2018
@ghost
Copy link

ghost commented Oct 3, 2018

This has been released in version 1.39.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "aws" {
	version = "~> 1.39.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loss of ec2 instance causes terraform to fail due to eni- in security group configs.
2 participants