Open cgrbyk opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Also occurs using tf 1.5.4 when attempting to import and generate configuration for tgw attachments. Perhaps the TGW resources are not quite right regarding import?
I am also running into this. It may have something to do with the fact that the TGW and it's route table are actually owned by another account. Because of that, Terraform will not find it.
My TGW is listed under TGWs (with the owner accountId listed), but the route table is not listed under TGW Route Tables.
I am also running into this as well for a peered account.
Hi all. If this issue is still relevant to anyone try importing the route by its destination_cidr_block
.
Like: terraform import module.gateway.aws_ec2_transit_gateway_route.private-vpc-route <route table ID>_0.0.0.0/0
For those who are still having this issue, I also could not import the resource, then I ran terraform apply anyway to see what would happen, and it didn't throw any errors, just make sure you create with the correct destination CIDR block and attachment ID.
Terraform plan now shows "No Infrastructure Changes" and the resource is still there with no changes.
Terraform Core Version
1.3.9,1.3.7
AWS Provider Version
4.55.0,4.52.0
Affected Resource(s)
aws_ec2_transit_gateway_route
Expected Behavior
Transit Gateway route should be added to state file after terraform import command.
Actual Behavior
throws error and fails
Relevant Error/Panic Output Snippet
Terraform Configuration Files
gateway module:
main.tf file:
import command :
terraform import 'module.gateway.aws_ec2_transit_gateway_route.private-vpc-route' 'tgw-rtb-xxx_10.0.0.0/16'
Steps to Reproduce
Create a transit gateway and attach it to two vpc then try import transit gateway route to terraform state
Debug Output
No response
Panic Output
No response
Important Factoids
i am using an s3 backend and there is no problem with importing other resources. I also double checked route table id and destination cidr.
References
import command resource: documantation
Would you like to implement a fix?
None