From 6815c448c8e9f59f2f247b6daff780c04564f4b9 Mon Sep 17 00:00:00 2001 From: nozaq Date: Thu, 24 Sep 2020 19:13:38 +0900 Subject: [PATCH] feat: apply tags to default network resources fixes #123 --- modules/vpc-baseline/main.tf | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/vpc-baseline/main.tf b/modules/vpc-baseline/main.tf index e3f53f99..12d00e25 100644 --- a/modules/vpc-baseline/main.tf +++ b/modules/vpc-baseline/main.tf @@ -18,9 +18,10 @@ resource "aws_cloudwatch_log_group" "default_vpc_flow_logs" { resource "aws_default_vpc" "default" { count = var.enabled ? 1 : 0 - tags = { - Name = "Default VPC" - } + tags = merge( + var.tags, + { Name = "Default VPC" } + ) } resource "aws_default_route_table" "default" { @@ -28,9 +29,10 @@ resource "aws_default_route_table" "default" { default_route_table_id = aws_default_vpc.default[0].default_route_table_id - tags = { - Name = "Default Route Table" - } + tags = merge( + var.tags, + { Name = "Default Route Table" } + ) } // Ignore "subnet_ids" changes to avoid the known issue below. @@ -41,9 +43,10 @@ resource "aws_default_network_acl" "default" { default_network_acl_id = aws_default_vpc.default[0].default_network_acl_id - tags = { - Name = "Default Network ACL" - } + tags = merge( + var.tags, + { Name = "Default Network ACL" } + ) lifecycle { ignore_changes = [subnet_ids] @@ -55,9 +58,10 @@ resource "aws_default_security_group" "default" { vpc_id = aws_default_vpc.default[0].id - tags = { - Name = "Default Security Group" - } + tags = merge( + var.tags, + { Name = "Default Security Group" } + ) } # --------------------------------------------------------------------------------------------------