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

Import testing for vpn gateway #9895

Merged
merged 2 commits into from
Sep 4, 2019
Merged

Import testing for vpn gateway #9895

merged 2 commits into from
Sep 4, 2019

Conversation

ryndaniels
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Relates #8944

Release note for CHANGELOG:

NONE

Output from acceptance testing:

NOTE: failures are due to lack of test capacity in alternate testing partition

--- FAIL: TestAccAWSVpnGateway_disappears (7.14s)
--- FAIL: TestAccAWSVpnGateway_basic (18.03s)
--- FAIL: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (18.17s)
--- PASS: TestAccAWSVpnGateway_delete (32.08s)
--- FAIL: TestAccAWSVpnGateway_reattach (34.90s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (35.85s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (41.27s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (42.67s)
--- PASS: TestAccAWSVpnGateway_tags (43.29s)

@ryndaniels ryndaniels requested a review from a team August 27, 2019 16:36
@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Aug 27, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always ensure the entire resource testing is passing. 😄 When running this testing I found two failures:

--- FAIL: TestAccAWSVpnGateway_reattach (47.38s)
    testing.go:568: Step 0 error: Check failed: Check 4/6 error: Not found: aws_vpn_gateway.test2

The test configuration needs to have the "bar" resource names updated.

--- FAIL: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (47.72s)
    testing.go:568: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.

        (map[string]string) {
        }


        (map[string]string) (len=1) {
         (string) (len=17) "availability_zone": (string) (len=10) "us-west-2a"
        }

This one is a little more curious. Generally when we see this, it means the resource Read function is missing or not calling the d.Set() for the attribute. The current logic tries to conditionalize this call:

	if vpnGateway.AvailabilityZone != nil && *vpnGateway.AvailabilityZone != "" {
		d.Set("availability_zone", vpnGateway.AvailabilityZone)
	}

In general, this type of conditional shouldn't be necessary, however removing this wouldn't fix the issue here, and in fact does seems required due to the current EC2 API behavior. When setting AvailabilityZone with CreateVpnGateway, its not being returned with DescribeVpnGateways. The EC2 API Reference does mention that it may come back empty, which seems to be the case during the full acceptance test run with the resource.

In this case while less than ideal (we almost always want Terraform to be able to import/perform drift detection), we can use ImportStateVerifyIgnore: []string{"availability_zone"} in that test to ignore the strange API behavior for now.

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (27.20s)
--- PASS: TestAccAWSVpnGateway_disappears (27.68s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (30.29s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (30.75s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (35.93s)
--- PASS: TestAccAWSVpnGateway_tags (38.76s)
--- PASS: TestAccAWSVpnGateway_delete (41.43s)
--- PASS: TestAccAWSVpnGateway_basic (45.22s)
--- PASS: TestAccAWSVpnGateway_reattach (80.59s)

@ryndaniels ryndaniels merged commit 5167e35 into master Sep 4, 2019
@ryndaniels ryndaniels added this to the v2.27.0 milestone Sep 4, 2019
@ryndaniels ryndaniels deleted the rfd-at002-vpn branch September 4, 2019 15:58
@ghost
Copy link

ghost commented Sep 5, 2019

This has been released in version 2.27.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 for triage. Thanks!

@ghost
Copy link

ghost commented Nov 1, 2019

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 Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. size/L 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.

2 participants