Hi everyone ![]()
I try to build IaC workflow to create global Network layer for AWS Multi Accounts customer.
I have a big problem with the aws_dx_gateway_association resource.
This is an example :
#Creates Direct Connect Gateway
resource "aws_dx_gateway" "this" {
name = "mydxgateway"
amazon_side_asn = 64514
}
#Creates Direct Connect Gateway association with Transit Gateway
resource "aws_dx_gateway_association" "this" {
dx_gateway_id = aws_dx_gateway.this.id
associated_gateway_id = "tgw-rtb-05bbb377acb7ecf46"
allowed_prefixes = ["192.0.0.0/8"]
}
Now I try to retreive this association id like this :
resource "aws_ec2_transit_gateway_route_table_association" "dx" {
transit_gateway_route_table_id = "tgw-rtb-05bbb377acb7ecf46"
transit_gateway_attachment_id = aws_dx_gateway_association.this.dx_gateway_association_id
}
I have got an error during âapplyâ execution :
Error: error associating EC2 Transit Gateway Route Table (tgw-rtb-05bbb377acb7ecf46) association (f3454ce1-4387-42e9-986a-b762f46f3c90): InvalidTransitGatewayAttachmentID.Malformed: Invalid Transit Gateway Attachment id f3454ce1-4387-42e9-986a-b762f46f3c90.
status code: 400, request id: 05560c5c-86f1-4951-b71f-e27bf4979169
If I take a look at the plan⌠indeed⌠the property seems to be malformed :
âassociated_gateway_idâ: âtgw-0f61e6aa07906bf7câ,
âassociated_gateway_owner_account_idâ: âXXXXXXXXXXâ,
âassociated_gateway_typeâ: âtransitGatewayâ,
âdx_gateway_association_idâ: âf3454ce1-4387-42e9-986a-b762f46f3c90â,
âdx_gateway_idâ: â8a44646d-336c-4621-b032-d9a83252ce0eâ,
âdx_gateway_owner_account_idâ: âXXXXXXXXXXâ,
âidâ: âga-8a44646d-336c-4621-b032-d9a83252ce0etgw-0f61e6aa07906bf7câ,
But if I look on AWS Console, the correct attachment id == âtgw-attach-05770a0a1186d57d3â.
Any idea ?
Thanks a lot.
Romain.
