Skip to content

Commit

Permalink
Merge pull request #26 from babbel/default-tags
Browse files Browse the repository at this point in the history
Breaking change: Rename `var.tags` to `var.default_tags`
  • Loading branch information
jansiwy authored Sep 23, 2024
2 parents 1218a0f + 8e44b1a commit b24e194
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,5 @@ module "nlb" {
eu-west-1a = cidrsubnet(aws_vpc.this, 8, 0)
eu-west-1b = cidrsubnet(aws_vpc.this, 8, 1)
}
tags = {
app = "example"
env = "production"
}
}
```
2 changes: 1 addition & 1 deletion _test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module "nlb" {
local-b = "10.0.1.0/24"
}

tags = {
default_tags = {
app = "example"
env = "production"
}
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module "subnets" {
availability_zone = each.key
cidr_block = each.value

tags = var.tags
default_tags = var.default_tags
}

# NLB
Expand All @@ -23,7 +23,7 @@ resource "aws_lb" "this" {
internal = true
subnets = values(module.subnets)[*].this.id

tags = var.tags
tags = var.default_tags
}

# API Gateway VPC Link
Expand All @@ -32,5 +32,5 @@ resource "aws_api_gateway_vpc_link" "this" {
name = var.name
target_arns = [aws_lb.this.arn]

tags = var.tags
tags = var.default_tags
}
4 changes: 2 additions & 2 deletions subnet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ resource "aws_subnet" "this" {

tags = merge({
Name = "private - ${var.name} - ${var.availability_zone}"
}, var.tags)
}, var.default_tags)
}

resource "aws_route_table" "this" {
vpc_id = var.vpc.id

tags = merge({
Name = "private - ${var.name} - ${var.availability_zone}"
}, var.tags)
}, var.default_tags)
}

resource "aws_route_table_association" "this" {
Expand Down
13 changes: 7 additions & 6 deletions subnet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ Subnet CIDR.
EOS
}

variable "name" {
type = string
variable "default_tags" {
type = map(string)
default = {}

description = <<EOS
Name of the NLB.
Map of tags assigned to all AWS resources created by this module.
EOS
}

variable "tags" {
type = map(string)
variable "name" {
type = string

description = <<EOS
Map of tags assigned to all AWS resources created by this module.
Name of the NLB.
EOS
}

Expand Down
14 changes: 7 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ Map of subnet CIDRs by availability zone used by the NLB.
EOS
}

variable "name" {
type = string
variable "default_tags" {
type = map(string)
default = {}

description = <<EOS
Name of the NLB.
Map of tags assigned to all AWS resources created by this module.
EOS
}

variable "tags" {
type = map(string)
default = {}
variable "name" {
type = string

description = <<EOS
Map of tags assigned to all AWS resources created by this module.
Name of the NLB.
EOS
}

Expand Down

0 comments on commit b24e194

Please sign in to comment.