-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
aws_vpn_connection: inconsistent remote state data (occasionally) #11293
Comments
What a hassle. :-( sigh. All good things come in threes... |
It is NOT sufficient to just remove |
hi @n3ph , i think you are facing another issue than me. My issue is just the wrong order of the tunnels itself. it is hard to debug for the operators at the client-side if they are wrong ordered. f.e. the results of the following command should be in the same order as the provided connection-parameter vom resource-output or statefile. aws ec2 describe-vpn-connections --vpn-connection-id <some_connection_idf> --query 'VpnConnections[*].VgwTelemetry[*]' the same for aws console. your issue seems to be much more complex. for me it looks like you are right with the wrong tunnel*_vgw_inside_address, but your solution:
Perhaps your issue should be reported to aws support? |
I am experiencing this issue as well. While I like the idea in #11298 upon testing it does not seem to have any effect at all for me. My tunnels are still down, with the inside addresses definitely flipped. tunnel1_cgw_inside_address is in the tunnel2_inside_cidr, and vice versa. This is blocking me from deploying a VPN connection. Any workarounds (aside from removing VPN from Terraform management) would be extremely helpful. Edit: I think I found a workaround: delete the VPN connection entirely, and re-create it again. Sometimes it comes back correctly. If it isn't correct, keep trying until it is created correctly. (It took me several tries.) |
…_*` 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) ```
…_*` 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
…_*` 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
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! |
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. |
Community Note
Terraform Version
Terraform v0.12.17
Affected Resource(s)
Terraform Configuration Files
does not matter
Background
resourceAwsVpnConnectionCreate
assembles the connection options [1] and calls AWS API to create the VPN connection with these accordingly. It seems AWS is creating the VPN connections asynchronously as sometimes the order of the VPN connections in the XML config blob does not apply to the order ofoptions[]
. Sincetunnel1_inside_cidr
andtunnel2_inside_cidr
are saved directly to the remote state and all other attributes are added later inresourceAwsVpnConnectionRead
[2], the data for the resource might be inconsistent.The code already tries to cover this unsuccessfully via sorting the XML config blob [3].
sort.Sort(vpnConfig)
is acting onOutsideAddress
oftype XmlIpsecTunnel struct
[4].We need to check wether:
vpnConfig.Tunnels[0].VgwInsideAddress
orvpnConfig.Tunnels[0].CgwInsideAddress
is a vaild address oftunnel1_inside_cidr
vpnConfig.Tunnels[1].VgwInsideAddress
orvpnConfig.Tunnels[1].CgwInsideAddress
is a vaild address oftunnel2_inside_cidr
[1] https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_vpn_connection.go#L277-L291
[2] https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_vpn_connection.go#L452-L463
[3] https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_vpn_connection.go#L596
[4] https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_vpn_connection.go#L27-L28
Expected Behavior
Actual Behavior
References
The text was updated successfully, but these errors were encountered: