hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

aws_route is throwing an error on the transit gateway id while existing #33650

Closed yannickvranckx closed 1 year ago

yannickvranckx commented 1 year ago

Description

Using the terraform resource "aws_route" to add a route to a route table, it says the transit gateway attachment does not exist, while clearly being active in the account.

Code used:

resource "aws_route" "tgw_route" {
  route_table_id         = module.vpc.intra_route_table_ids.0
  destination_cidr_block = "0.0.0.0/0"
  transit_gateway_id     = aws_ec2_transit_gateway_vpc_attachment.sandbox.id
  depends_on             = [module.vpc.vpc_id, aws_ec2_transit_gateway_vpc_attachment.sandbox]
}

It will just get stuck in "Still Creating" for about 2-3 minutes and then it will state that the attachment ID does not exist. While i can see it in the account and being active, using the AWS Console it just works.

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

acwwat commented 1 year ago

@yannickvranckx It looks like you are passing the TGW attachment ID instead of the TGW ID into transit_gateway_id. Passing in aws_ec2_transit_gateway_vpc_attachment.sandbox.transit_gateway_id should address the issue.

yannickvranckx commented 1 year ago

@yannickvranckx It looks like you are passing the TGW attachment ID instead of the TGW ID into transit_gateway_id. Passing in aws_ec2_transit_gateway_vpc_attachment.sandbox.transit_gateway_id should address the issue.

This was the issue, can't believe I missed that one

yannickvranckx commented 1 year ago

The issue was the TGW ID being the attachment ID.

github-actions[bot] commented 1 year ago

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.