Skip to content

Commit

Permalink
Merge pull request #31 from babbel/resource-specific-tags
Browse files Browse the repository at this point in the history
Add support for resource-specific tags
  • Loading branch information
jansiwy authored Sep 24, 2024
2 parents b4653ac + bfb3db7 commit 36f9f06
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "aws_security_group" "this" {

tags = merge({
Name = "LB: ${var.name}"
}, var.default_tags)
}, var.default_tags, var.security_group_tags)

lifecycle {
create_before_destroy = true
Expand Down Expand Up @@ -42,7 +42,7 @@ resource "aws_lb" "this" {
subnets = var.subnets[*].id
security_groups = [aws_security_group.this.id]

tags = var.default_tags
tags = merge(var.default_tags, var.lb_tags)
}

resource "aws_lb_listener" "this" {
Expand Down
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ The port the ALB will listen to.
EOS
}

variable "lb_tags" {
type = map(string)
default = {}

description = <<EOS
Map of tags assigned to the ALB created by this module. Tags in this map will override tags in `var.default_tags`.
EOS
}

variable "name" {
type = string

Expand All @@ -33,6 +42,15 @@ Name of the ALB.
EOS
}

variable "security_group_tags" {
type = map(string)
default = {}

description = <<EOS
Map of tags assigned to the security group used by the ALB created by this module. Tags in this map will override tags in `var.default_tags`.
EOS
}

variable "subnets" {
type = list(
object({
Expand Down

0 comments on commit 36f9f06

Please sign in to comment.