-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Support for EC2 Transit Gateway VPN Attachment #6884
Comments
I don't think you're missing anything from what I remember from the initial development of the EC2 Transit Gateway functionality. The current EC2 API has explicit API methods for managing Transit Gateway VPC attachments, but not VPN attachments. If I had to guess about the intention, its that VPN attachments are implicitly created/managed by VPN connections and it would introduce an awkward workflow to create/manage them outside of that. W certainly have a gap in the Terraform AWS provider though since there is no way to find/reference the VPN attachment IDs. I think there are few approaches that may be viable here: Creating a
|
Same issue here, hoping for an update soon... |
any updates? |
the current API allows to get the list of attachments and filter them by type. gateway ID and VPN ID... I think terrraform implements the datasource from "DescribeTransitGatewayVpcAttachments" but it could also add "DescribeTransitGatewayAttachments" it will be something like: DescribeTransitGatewayAttachments (resource-id=>VPN_ID, resourceType=>vpn, transitGatewayId=>transitGatewayId) https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeTransitGatewayAttachments.html |
Same issue here. Great solution ideas above. |
Are there any plans to support Transit Gateway VPN Attachments in the near future? |
You can implicitly create the VPN Attachment by creating the aws_vpn_connection resource and passing a And the fact that neither the |
So, as this became kind of critical for my team, I implemented a workaround that works almost perfectly. At this point, Bash came to the rescue. I was able to overcome this blocker by using an ./modules/tgw-vpn-attachment/main.tf:
./my-env/main.tf - note that some values below come from other modules that are not shown here:
The Bash ./modules/tgw-vpn-attachment/get-transit-gateway-vpn-attachment-id.sh script which returns the VPN Attachment IDs:
Brief Explanation: Once the data source has executed the script succesffuly and received back the JSON result, then you can access that result from other resources just as with any other data source. One thing that i wasn't able to do was to tag the VPN Attachment(s) created implicitly. The AWS CLI does not support this for an existing VPN Attachment(s). Only if you create a new one you can tag it. If somebody knows of a way, then please comment here on how to do it. Hope this helps somebody. |
Please note that in the above
To
This is because if the Also another thing i discovered while moving things around, is that if you make the |
if you add This is just to force the data source to wait on the attachment creation. The bash script does not really use the |
is anyone working on this? Any updates? |
be possible to use data source provider (https://www.terraform.io/docs/providers/aws/d/ec2_transit_gateway_vpc_attachment.html) to actually filtrate using vpn-id (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeTransitGatewayAttachments.html) as suggested in previous comments by @juanbecerra. |
I think as @bflad suggested, the aws_ec2_transit_gateway_vpn_attachment data resource needs to be created. Are anyone working on solving this issue? |
This is sorely needed and is a blocker for implementing terraform for TGW for anyone using VPN's. We have a urgent need for this |
@wrsuarez above you can find a workaround we ended implementing since this was urgent for us as well until TGW VPN Attachment with Terraform is supported. The workaround works pretty well so far. |
anyone looking at this issue? the work around is only a temporary solution and this should be addressed in the core code |
@piersf your workaround works but somehow apply may need to be executed twice as the transit_gateway_attachment_id are not immediately available and the script returns an empty result on the first initial run. In order to modify this behavior: |
Hello, |
Agreed I'm stuck with this, the solution above is way too hacky. So I've just had to hard-code the attachment-IDs created via |
@bluemalkin for me the bash script worked much better than having to create the attachments manually and hard-coding the IDs. I do agree that official support is needed, though. |
@mrsaraiva Terraform can do the attachment automatically with |
+1 for default support |
@bluemalkin i'm doing the attachments the same way, but i need the script to be able to get the VPN attachment id, which i use to add routes to the tgw route table. |
+1 for doing this. Although the workaround looks very clever, it's a terrible hack. |
Reference: #6884 Only performs lookup when the VPN Connection has an associated Transit Gateway ID. I tried unsuccessfully to use a EC2 Transit Gateway shared via Resource Access Manager (RAM) in EC2 VPN Connection creation and it always returned the below error even after waiting for greater than 10 minutes and in the web console manually as well: ``` InvalidTransitGatewayID.NotFound: The transitGateway ID 'tgw-XXXXXXXXX' does not exist ``` This broken acceptance testing is omitted from this change request as it may not be functionality actually supported by EC2. If there is a working configuration with shared Transit Gateways, we may need to lean on additional feedback after this implementation to smooth over those issues. Output from acceptance testing: ``` --- PASS: TestAccAWSVpnConnection_basic (617.58s) --- PASS: TestAccAWSVpnConnection_disappears (426.58s) --- PASS: TestAccAWSVpnConnection_importBasic (238.20s) --- PASS: TestAccAWSVpnConnection_TransitGatewayID (439.63s) --- PASS: TestAccAWSVpnConnection_tunnelOptions (269.52s) --- PASS: TestAccAWSVpnConnection_withoutStaticRoutes (195.55s) ```
Pull request submitted for adding a We'll likely also implement a new |
+1 |
Reference: #6884 This is a bare minimum implementation to help operators retrieve a VPN Attachment ID using the Transit Gateway ID and VPN Connection ID. It can be further enhanced in the future. Output from acceptance testing: ``` --- PASS: TestAccAWSEc2TransitGatewayVpnAttachmentDataSource_TransitGatewayIdAndVpnConnectionId (462.11s) ```
The addition of the To compliment other environments where a data source would be more convenient, a pull request for a new |
The new data source has been merged as well and will release with version 2.4.0 of the Terraform AWS Provider later this week. 👍 For additional feature requests or bug reports please open new GitHub issues. Thanks! |
TGW has been the reason I'm giving terraform a shot, CloudFormation has similar issues plus a couple more like being unable to attach the TGW to the VPC route table. Anyway, the quick fix on this issue is great news and I'm officially sold on Terraform. Thank you for this. |
The new data source and new attribute have been released in version 2.4.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For any additional feature requests or bug reports, please open a new GitHub issue. 👍 |
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! |
Community Note
Description
Based on the existence of the
ec2_transit_gateway_vpc_attachment
data source and resource type, I was expecting to find a corresponding data source and resource type calledec2_transit_gateway_vpn_attachment
. They do not appear to exist.This caused three issues:
aws_vpn_connection
resource with thetransit_gateway_id
attribute pointing to my transit gateway.tgw-attach-xxxxxxxx
resource, such as theName
tag and other tags required by my organization.tgw-attach-xxxxxxxx
ID to theaws_ec2_transit_gateway_route_table_association
andaws_ec2_transit_gateway_route_table_propagation
resources by reference. Instead, I copy-pasted these IDs into the code after standing up the VPN attachment.If I've missed something, please feel free to point me in the right direction. Thanks!
The text was updated successfully, but these errors were encountered: