diff --git a/vpc-transit-gateway-association/self/README.md b/vpc-transit-gateway-association/self/README.md index 9b8d431..cca287b 100644 --- a/vpc-transit-gateway-association/self/README.md +++ b/vpc-transit-gateway-association/self/README.md @@ -73,7 +73,7 @@ module "vpc_tgw_self" { | Name | Type | |------|------| -| [aws_ec2_tag.vpc_sttachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_tag) | resource | +| [aws_ec2_tag.vpc_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_tag) | resource | | [aws_ec2_transit_gateway_route_table_association.route_table_self](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_route_table_association) | resource | | [aws_ec2_transit_gateway_route_table_propagation.vpc_self_common](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_route_table_propagation) | resource | | [aws_ec2_transit_gateway_route_table_propagation.vpc_self_own_rt](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_route_table_propagation) | resource | diff --git a/vpc-transit-gateway-association/self/associate.tf b/vpc-transit-gateway-association/self/associate.tf index 917e717..80386eb 100644 --- a/vpc-transit-gateway-association/self/associate.tf +++ b/vpc-transit-gateway-association/self/associate.tf @@ -21,14 +21,14 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "vpc_attachment" { ) } -# tag in network account -resource "aws_ec2_tag" "vpc_sttachment" { +# tag in network account with passed-in tags, plus Name=current_account:vpc_name +resource "aws_ec2_tag" "vpc_attachment" { provider = aws.self + for_each = merge(var.tags, { Name = format("%v:%v", data.aws_iam_account_alias.current.account_alias, var.vpc_full_name) }) resource_id = aws_ec2_transit_gateway_vpc_attachment.vpc_attachment.id - key = "Name" - # value = format("%v:%v:%v", data.aws_iam_account_alias.network_account.account_alias,var.vpc_full_name, data.aws_region.network_account.name) - value = format("%v:%v", data.aws_iam_account_alias.current.account_alias, var.vpc_full_name) + key = each.key + value = each.value } output "vpc_attachment_id" {