Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: apply tags to default network resources #133

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions modules/vpc-baseline/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ 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" {
count = var.enabled ? 1 : 0

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.
Expand All @@ -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]
Expand All @@ -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" }
)
}

# --------------------------------------------------------------------------------------------------
Expand Down