Is there an auto-approve for pending acceptance state after TG attachment is added except for using resource aws_ec2_transit_gateway_vpc_attachment_accepter ?
I have a variable, which I obtain from aws api for regions with TGW IDs except the current region
For e.g i am in us-east-2 my variable is,
TGW_PEERS = [{"id": "tgw-xxx", "region": "eu-west-1", "name": "TGW0001_EUW1"}, {"id": "tgw-xxx", "region": "us-west-2", "cidr": "", "name": "TGW0001_USW2"}]
I have a resource aws_ec2_transit_gateway_peering_attachment
resource "aws_ec2_transit_gateway_peering_attachment" "TGW-PEERS" {
count = length(var.TGW_PEERS)
peer_region = var.TGW_PEERS[count.index].region
peer_transit_gateway_id = var.TGW_PEERS[count.index].id
transit_gateway_id = data.aws_ec2_transit_gateway.TGW.id
tags = {
Name = format("PEER_%s", var.TGW_PEERS[count.index].name)
Side = "Initiator"
}
}
But when I apply the above, TGW attachments go in pending acceptance state and enabling "Auto-accept shared attachments" does not help either
A way to fix it is i will have to do this for every region and create aliases, resource statements for all the other regions except itself. Which I dont want to do :)
provider "aws" {
alias = "us-west-2"
region = "us-west-2"
}
resource "aws_ec2_transit_gateway_vpc_attachment_accepter" "TGW-ACCEPTOR" {
provider = aws.us-west-2
transit_gateway_attachment_id = data.aws_ec2_transit_gateway.TGW.id
tags = {
Name = "Yo"
Side = "Accepter"
}
}