I have 2 aws accounts with respective terraform code for it: In account_no_01 lets say, I have a tgw module
module "transit-gateway" {}
In account_no_02, I want to get the id of the created tgw in account 1:
resource "aws_ec2_transit_gateway_vpc_attachment" "tgw_nprod" {
subnet_ids = [module.vpc.private_subnets[0]]
transit_gateway_id = "TGW ID HERE FROM ACCOUNT 01 CREATED WITH MODULE"
vpc_id = module.vpc.vpc_id
}
And the dir structure is like this:
/acount01/main.tf and /account02/main.tf