Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions modules/dns-bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ variable "s3_encryption_kms_key_arn" {

variable "extra_aws_tags" {
default = {}
description = "Additional to apply to the resources. Note that this module sets the tags Name, Type, and Vendor by default. They can be overwritten, but it is not recommended."
description = "Deprecated: use additional_tags instead."
type = map(string)
}

variable "additional_tags" {
default = {}
description = "Additional tags to apply to the resources. Note that this module sets the tags Name, Type, and Vendor by default. They can be overwritten, but it is not recommended."
type = map(string)
}

locals {
tags = merge({
"Vendor" = "StreamNative"
}, var.extra_aws_tags)
}, var.extra_aws_tags, var.additional_tags)
}

variable "enable_loki" {
Expand Down
22 changes: 10 additions & 12 deletions modules/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ data "aws_availability_zones" "available" {
locals {
azs = length(var.availability_zones) > 0 ? var.availability_zones : data.aws_availability_zones.available.names
num_azs = length(var.availability_zones) > 0 ? length(var.availability_zones) : var.num_azs
tags = merge(var.tags, var.additional_tags)
}

resource "aws_vpc" "vpc" {
cidr_block = var.vpc_cidr
enable_dns_support = true
enable_dns_hostnames = true
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-vpc", var.vpc_name) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-vpc", var.vpc_name) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand All @@ -39,7 +40,7 @@ resource "aws_subnet" "public" {
cidr_block = cidrsubnet(var.vpc_cidr, var.public_subnet_newbits, var.public_subnet_start + count.index)
availability_zone = local.azs[count.index]
map_public_ip_on_launch = var.disable_nat_gateway ? true : var.public_subnet_auto_ip
tags = merge({ "Vendor" = "StreamNative", "Type" = "public", Name = format("%s-public-sbn-%s", var.vpc_name, count.index) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", "Type" = "public", Name = format("%s-public-sbn-%s", var.vpc_name, count.index) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand All @@ -52,7 +53,7 @@ resource "aws_subnet" "private" {
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(var.vpc_cidr, var.private_subnet_newbits, var.private_subnet_start + count.index)
availability_zone = local.azs[count.index]
tags = merge({ "Vendor" = "StreamNative", "Type" = "private", Name = format("%s-private-sbn-%s", var.vpc_name, count.index) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", "Type" = "private", Name = format("%s-private-sbn-%s", var.vpc_name, count.index) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand All @@ -61,7 +62,7 @@ resource "aws_subnet" "private" {

resource "aws_internet_gateway" "gw" {
vpc_id = aws_vpc.vpc.id
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-igw", var.vpc_name) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-igw", var.vpc_name) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand All @@ -72,7 +73,7 @@ resource "aws_eip" "eip" {
count = var.disable_nat_gateway ? 0 : local.num_azs

domain = "vpc"
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-eip-%s", var.vpc_name, count.index) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-eip-%s", var.vpc_name, count.index) }, local.tags)

depends_on = [aws_internet_gateway.gw]
lifecycle {
Expand All @@ -85,7 +86,7 @@ resource "aws_nat_gateway" "nat_gw" {

allocation_id = aws_eip.eip[count.index].id
subnet_id = aws_subnet.public[count.index].id
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-ngw-%s", var.vpc_name, count.index) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", Name = format("%s-ngw-%s", var.vpc_name, count.index) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand All @@ -96,7 +97,7 @@ resource "aws_route_table" "public_route_table" {
count = 1

vpc_id = aws_vpc.vpc.id
tags = merge({ "Vendor" = "StreamNative", "Type" = "public", Name = format("%s-public-rtb", var.vpc_name) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", "Type" = "public", Name = format("%s-public-rtb", var.vpc_name) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand All @@ -122,7 +123,7 @@ resource "aws_route_table" "private_route_table" {
count = var.disable_nat_gateway ? 0 : local.num_azs

vpc_id = aws_vpc.vpc.id
tags = merge({ "Vendor" = "StreamNative", "Type" = "private", Name = format("%s-private-rtb-%s", var.vpc_name, count.index) }, var.tags)
tags = merge({ "Vendor" = "StreamNative", "Type" = "private", Name = format("%s-private-rtb-%s", var.vpc_name, count.index) }, local.tags)

lifecycle {
ignore_changes = [tags]
Expand Down Expand Up @@ -166,8 +167,5 @@ resource "aws_vpc_endpoint" "s3_gateway_endpoint" {
}
POLICY

tags = {
Name = "${var.vpc_name}-s3-gateway-endpoint"
Vendor = "StreamNative"
}
tags = merge({ "Vendor" = "StreamNative", Name = "${var.vpc_name}-s3-gateway-endpoint" }, local.tags)
}
8 changes: 7 additions & 1 deletion modules/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ variable "public_subnet_auto_ip" {

variable "tags" {
default = {}
description = "Additional to apply to the resources. Note that this module sets the tags Name, Type, and Vendor by default. They can be overwritten, but it is not recommended."
description = "Deprecated: use additional_tags instead."
type = map(string)
}

variable "additional_tags" {
default = {}
description = "Additional tags to apply to the resources. Note that this module sets the tags Name, Type, and Vendor by default. They can be overwritten, but it is not recommended."
type = map(string)
}

Expand Down
Loading