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

aws_vpn_gateway and aws_vpn_gateway_attachment incorrectly refreshing attachment state #8575

Closed
ewbankkit opened this issue May 8, 2019 · 5 comments · Fixed by #8576
Closed
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@ewbankkit
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

The vpnGatewayGetAttachment() function, used when refreshing VGW attachment state, does not correctly account for detaching or attaching states: https://github.com/terraform-providers/terraform-provider-aws/blob/3471582595cb9cd20d20abe2ca7f7463499edf6a/aws/resource_aws_vpn_gateway.go#L333-L340

This only starts to manifest as a problem when the VGW has been attached to a Direct Connect gateway as the VGW attachment state will remain detaching for minutes. This has become evident in recent work with Direct Connect gateway attachments - #8222 (review) and #8455 (comment).
In other cases the attachment state moves from attached to detached effectively immediately, which is why none of the current acceptance tests have caused problems.

@ewbankkit
Copy link
Contributor Author

The solution is to pass the VPC ID to vpnGatewayGetAttachment() and really return the attachment for the specified VPC. Return the sentinel only when no attachment can be found for the specified VPC.

@ewbankkit
Copy link
Contributor Author

Actually I'm going to split into two functions:

  • vpnGatewayGetAttachmentState which will take a VPC ID and return the state of that attachment
  • vpnGatewayGetAttachment which will return details of any attachment in attached state (as now) or nil

@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels May 9, 2019
@bflad bflad added this to the v2.11.0 milestone May 13, 2019
@bflad
Copy link
Contributor

bflad commented May 13, 2019

The fix for this has been merged and will release with version 2.11.0 of the Terraform AWS Provider, likely later this week.

@bflad
Copy link
Contributor

bflad commented May 17, 2019

This has been released in version 2.11.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 30, 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 Mar 30, 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants