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_vpn_connection: Prevent flipped tunnel1_* and tunnel2_* ordering when tunnel1_inside_cidr, tunnel1_inside_ipv6_cidr, or tunnel1_preshared_key is configured #19077

Merged
merged 3 commits into from
Apr 23, 2021

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Apr 23, 2021

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #396
Closes #3359
Closes #5809
Closes #11293

Previously (race condition of automatically assigned outside IP addresses):

=== CONT  TestAccAWSVpnConnection_tunnelOptions
resource_aws_vpn_connection_test.go:210: Step 15/15 error: Check failed: Check 4/6 error: aws_vpn_connection.test: Attribute 'tunnel1_preshared_key' expected "12345678", got "abcdefgh"
--- FAIL: TestAccAWSVpnConnection_tunnelOptions (738.28s)

Output from acceptance testing:

--- PASS: TestAccAWSVpnConnection_Tunnel1PresharedKey (251.02s)
--- PASS: TestAccAWSVpnConnection_withoutStaticRoutes (263.77s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideCidr (335.14s)
--- PASS: TestAccAWSVpnConnection_tunnelOptions (342.30s)
--- PASS: TestAccAWSVpnConnection_disappears (388.07s)
--- PASS: TestAccAWSVpnConnection_tags (445.29s)
--- PASS: TestAccAWSVpnConnection_basic (797.33s)
--- PASS: TestAccAWSVpnConnection_withIpv6 (1235.35s)
--- PASS: TestAccAWSVpnConnection_TransitGatewayID (1235.72s)
--- PASS: TestAccAWSVpnConnection_withEnableAcceleration (1352.28s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr (1595.79s)

@bflad bflad added the bug Addresses a defect in current functionality. label Apr 23, 2021
@bflad bflad requested a review from a team as a code owner April 23, 2021 13:31
@ghost ghost added size/XL 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 Apr 23, 2021
…_*` ordering when `tunnel1_inside_cidr`, `tunnel1_inside_ipv6_cidr`, or `tunnel1_preshared_key` is configured

Reference: #396
Reference: #3359
Reference: #4728
Reference: #5809
Reference: #11293

Previously (race condition of automatically assigned outside IP addresses):

```
=== CONT  TestAccAWSVpnConnection_tunnelOptions
resource_aws_vpn_connection_test.go:210: Step 15/15 error: Check failed: Check 4/6 error: aws_vpn_connection.test: Attribute 'tunnel1_preshared_key' expected "12345678", got "abcdefgh"
--- FAIL: TestAccAWSVpnConnection_tunnelOptions (738.28s)
```

Output from acceptance testing:

```
--- PASS: TestAccAWSVpnConnection_Tunnel1PresharedKey (251.02s)
--- PASS: TestAccAWSVpnConnection_withoutStaticRoutes (263.77s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideCidr (335.14s)
--- PASS: TestAccAWSVpnConnection_tunnelOptions (342.30s)
--- PASS: TestAccAWSVpnConnection_disappears (388.07s)
--- PASS: TestAccAWSVpnConnection_tags (445.29s)
--- PASS: TestAccAWSVpnConnection_basic (797.33s)
--- PASS: TestAccAWSVpnConnection_withIpv6 (1235.35s)
--- PASS: TestAccAWSVpnConnection_TransitGatewayID (1235.72s)
--- PASS: TestAccAWSVpnConnection_withEnableAcceleration (1352.28s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr (1595.79s)
```
@bflad bflad force-pushed the b-aws_vpn_connection-less-sorting branch from 0217a90 to e0ad75b Compare April 23, 2021 14:11
@ewbankkit ewbankkit self-assigned this Apr 23, 2021
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM.

Commercial
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSVpnConnection_' ACCTEST_PARALLELISM=4 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 4 -run=TestAccAWSVpnConnection_ -timeout 180m
=== RUN   TestAccAWSVpnConnection_basic
=== PAUSE TestAccAWSVpnConnection_basic
=== RUN   TestAccAWSVpnConnection_TransitGatewayID
=== PAUSE TestAccAWSVpnConnection_TransitGatewayID
=== RUN   TestAccAWSVpnConnection_Tunnel1InsideCidr
=== PAUSE TestAccAWSVpnConnection_Tunnel1InsideCidr
=== RUN   TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr
=== PAUSE TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr
=== RUN   TestAccAWSVpnConnection_Tunnel1PresharedKey
=== PAUSE TestAccAWSVpnConnection_Tunnel1PresharedKey
=== RUN   TestAccAWSVpnConnection_tunnelOptions
=== PAUSE TestAccAWSVpnConnection_tunnelOptions
=== RUN   TestAccAWSVpnConnection_withoutStaticRoutes
=== PAUSE TestAccAWSVpnConnection_withoutStaticRoutes
=== RUN   TestAccAWSVpnConnection_withEnableAcceleration
=== PAUSE TestAccAWSVpnConnection_withEnableAcceleration
=== RUN   TestAccAWSVpnConnection_withIpv6
=== PAUSE TestAccAWSVpnConnection_withIpv6
=== RUN   TestAccAWSVpnConnection_tags
=== PAUSE TestAccAWSVpnConnection_tags
=== RUN   TestAccAWSVpnConnection_disappears
=== PAUSE TestAccAWSVpnConnection_disappears
=== CONT  TestAccAWSVpnConnection_basic
=== CONT  TestAccAWSVpnConnection_withoutStaticRoutes
=== CONT  TestAccAWSVpnConnection_tags
=== CONT  TestAccAWSVpnConnection_withIpv6
--- PASS: TestAccAWSVpnConnection_withoutStaticRoutes (313.98s)
=== CONT  TestAccAWSVpnConnection_withEnableAcceleration
--- PASS: TestAccAWSVpnConnection_tags (368.66s)
=== CONT  TestAccAWSVpnConnection_disappears
--- PASS: TestAccAWSVpnConnection_basic (638.30s)
=== CONT  TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr
--- PASS: TestAccAWSVpnConnection_withIpv6 (647.83s)
=== CONT  TestAccAWSVpnConnection_tunnelOptions
--- PASS: TestAccAWSVpnConnection_tunnelOptions (361.17s)
=== CONT  TestAccAWSVpnConnection_Tunnel1PresharedKey
--- PASS: TestAccAWSVpnConnection_disappears (666.44s)
=== CONT  TestAccAWSVpnConnection_TransitGatewayID
--- PASS: TestAccAWSVpnConnection_withEnableAcceleration (917.25s)
=== CONT  TestAccAWSVpnConnection_Tunnel1InsideCidr
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr (607.22s)
--- PASS: TestAccAWSVpnConnection_Tunnel1PresharedKey (326.20s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideCidr (372.33s)
--- PASS: TestAccAWSVpnConnection_TransitGatewayID (570.66s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1608.676s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSVpnConnection_' ACCTEST_PARALLELISM=4
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 4 -run=TestAccAWSVpnConnection_ -timeout 180m
=== RUN   TestAccAWSVpnConnection_basic
=== PAUSE TestAccAWSVpnConnection_basic
=== RUN   TestAccAWSVpnConnection_TransitGatewayID
=== PAUSE TestAccAWSVpnConnection_TransitGatewayID
=== RUN   TestAccAWSVpnConnection_Tunnel1InsideCidr
=== PAUSE TestAccAWSVpnConnection_Tunnel1InsideCidr
=== RUN   TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr
=== PAUSE TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr
=== RUN   TestAccAWSVpnConnection_Tunnel1PresharedKey
=== PAUSE TestAccAWSVpnConnection_Tunnel1PresharedKey
=== RUN   TestAccAWSVpnConnection_tunnelOptions
=== PAUSE TestAccAWSVpnConnection_tunnelOptions
=== RUN   TestAccAWSVpnConnection_withoutStaticRoutes
=== PAUSE TestAccAWSVpnConnection_withoutStaticRoutes
=== RUN   TestAccAWSVpnConnection_withEnableAcceleration
=== PAUSE TestAccAWSVpnConnection_withEnableAcceleration
=== RUN   TestAccAWSVpnConnection_withIpv6
=== PAUSE TestAccAWSVpnConnection_withIpv6
=== RUN   TestAccAWSVpnConnection_tags
=== PAUSE TestAccAWSVpnConnection_tags
=== RUN   TestAccAWSVpnConnection_disappears
=== PAUSE TestAccAWSVpnConnection_disappears
=== CONT  TestAccAWSVpnConnection_basic
=== CONT  TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr
=== CONT  TestAccAWSVpnConnection_withoutStaticRoutes
=== CONT  TestAccAWSVpnConnection_tunnelOptions
    resource_aws_vpn_connection_test.go:295: Step 15/15 error: Error running apply: exit status 1
        2021/04/23 11:20:38 [DEBUG] Using modified User-Agent: Terraform/0.12.30 HashiCorp-terraform-exec/0.13.0
        
        Error: Error creating vpn connection: InvalidParameterValue: Invalid value specified for Phase1IntegrityAlgorithms.
        	status code: 400, request id: 1d006deb-a817-48de-babf-c4fd6aa0330d
        
          on terraform_plugin_test.tf line 18, in resource "aws_vpn_connection" "test":
          18: resource "aws_vpn_connection" "test" {
        
        
--- FAIL: TestAccAWSVpnConnection_tunnelOptions (27.32s)
=== CONT  TestAccAWSVpnConnection_Tunnel1InsideCidr
--- PASS: TestAccAWSVpnConnection_withoutStaticRoutes (202.48s)
=== CONT  TestAccAWSVpnConnection_TransitGatewayID
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideCidr (217.90s)
=== CONT  TestAccAWSVpnConnection_Tunnel1PresharedKey
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr (488.15s)
=== CONT  TestAccAWSVpnConnection_withIpv6
--- PASS: TestAccAWSVpnConnection_basic (510.20s)
=== CONT  TestAccAWSVpnConnection_tags
--- PASS: TestAccAWSVpnConnection_Tunnel1PresharedKey (322.34s)
=== CONT  TestAccAWSVpnConnection_withEnableAcceleration
    provider_test.go:1115: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        2021/04/23 11:29:57 [DEBUG] Using modified User-Agent: Terraform/0.12.30 HashiCorp-terraform-exec/0.13.0
        
        Error: Error creating vpn connection: InvalidParameterValue: Invalid value specified for Accelerated VPN is not supported in this region.
        	status code: 400, request id: b11cb2dd-449a-4569-81ad-722a79f2454a
        
          on terraform_plugin_test.tf line 11, in resource "aws_vpn_connection" "test":
          11: resource "aws_vpn_connection" "test" {
        
        
--- PASS: TestAccAWSVpnConnection_TransitGatewayID (489.79s)
=== CONT  TestAccAWSVpnConnection_disappears
--- PASS: TestAccAWSVpnConnection_tags (263.78s)
--- SKIP: TestAccAWSVpnConnection_withEnableAcceleration (227.78s)
--- PASS: TestAccAWSVpnConnection_disappears (227.50s)
--- PASS: TestAccAWSVpnConnection_withIpv6 (561.66s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	1052.712s
FAIL
make: *** [testacc] Error 1

Unrelated errors.

@bflad bflad merged commit 74ca2b2 into main Apr 23, 2021
@bflad bflad deleted the b-aws_vpn_connection-less-sorting branch April 23, 2021 19:48
@github-actions github-actions bot added this to the v3.38.0 milestone Apr 23, 2021
github-actions bot pushed a commit that referenced this pull request Apr 23, 2021
bflad added a commit that referenced this pull request Apr 23, 2021
bflad added a commit that referenced this pull request Apr 23, 2021
…_*` ordering when `tunnel1_inside_cidr`, `tunnel1_inside_ipv6_cidr`, or `tunnel1_preshared_key` is configured (#19077)

* resource/aws_vpn_connection: Prevent flipped `tunnel1_*` and `tunnel2_*` ordering when `tunnel1_inside_cidr`, `tunnel1_inside_ipv6_cidr`, or `tunnel1_preshared_key` is configured

Reference: #396
Reference: #3359
Reference: #4728
Reference: #5809
Reference: #11293

Previously (race condition of automatically assigned outside IP addresses):

```
=== CONT  TestAccAWSVpnConnection_tunnelOptions
resource_aws_vpn_connection_test.go:210: Step 15/15 error: Check failed: Check 4/6 error: aws_vpn_connection.test: Attribute 'tunnel1_preshared_key' expected "12345678", got "abcdefgh"
--- FAIL: TestAccAWSVpnConnection_tunnelOptions (738.28s)
```

Output from acceptance testing:

```
--- PASS: TestAccAWSVpnConnection_Tunnel1PresharedKey (251.02s)
--- PASS: TestAccAWSVpnConnection_withoutStaticRoutes (263.77s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideCidr (335.14s)
--- PASS: TestAccAWSVpnConnection_tunnelOptions (342.30s)
--- PASS: TestAccAWSVpnConnection_disappears (388.07s)
--- PASS: TestAccAWSVpnConnection_tags (445.29s)
--- PASS: TestAccAWSVpnConnection_basic (797.33s)
--- PASS: TestAccAWSVpnConnection_withIpv6 (1235.35s)
--- PASS: TestAccAWSVpnConnection_TransitGatewayID (1235.72s)
--- PASS: TestAccAWSVpnConnection_withEnableAcceleration (1352.28s)
--- PASS: TestAccAWSVpnConnection_Tunnel1InsideIpv6Cidr (1595.79s)
```

* tests/resource/aws_vpn_connection: Add nosemgrep comment for errant situation

* resource/aws_vpn_connection: Fix comment typo
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 3.38.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!

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2021
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
2 participants