Skip to content

Commit

Permalink
Merge pull request #3 from opzkit/additional_subnet_tags
Browse files Browse the repository at this point in the history
Additional subnet tags
  • Loading branch information
argoyle authored Oct 11, 2021
2 parents 9c95638 + c64d901 commit 7688e71
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ resource "aws_subnet" "private" {
availability_zone = "${var.region}${each.key}"
cidr_block = each.value
vpc_id = aws_vpc.vpc.id
tags = {
tags = merge({
"Name" = "${var.region}${each.key}.${var.name}"
"SubnetType" = "Private"
"kubernetes.io/role/internal-elb" = "1"
}
}, var.additional_private_subnet_tags)
}

resource "aws_subnet" "public" {
for_each = local.public_cidrs
availability_zone = "${var.region}${each.key}"
cidr_block = each.value
vpc_id = aws_vpc.vpc.id
tags = {
tags = merge({
"Name" = "public-${var.region}${each.key}.${var.name}"
"SubnetType" = "Utility"
"kubernetes.io/role/elb" = "1"
}
}, var.additional_public_subnet_tags)
}

resource "aws_internet_gateway" "igw" {
Expand Down
12 changes: 12 additions & 0 deletions vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ variable "public_subnet_zones" {
}
}

variable "additional_public_subnet_tags" {
type = map(any)
default = {}
description = "Additional tags for public subnets."
}

variable "public_subnet_cidrs" {
type = list(string)
default = []
Expand All @@ -48,6 +54,12 @@ variable "private_subnet_zones" {
}
}

variable "additional_private_subnet_tags" {
type = map(any)
default = {}
description = "Additional tags for private subnets."
}

variable "private_subnet_cidrs" {
type = list(string)
default = []
Expand Down

0 comments on commit 7688e71

Please sign in to comment.