Skip to content

Commit

Permalink
chore(ec2): add default tags to launch template (#114)
Browse files Browse the repository at this point in the history
Signed-off-by: Orla Dunlop <[email protected]>
  • Loading branch information
odunlop authored Sep 11, 2024
1 parent 493ddc4 commit 07780c1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions modules/ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ locals {
name = format("%s-%s-%s", var.service, var.environment, local.role)
}

data "aws_default_tags" "current" {}

module "security_groups" {
count = local.create_security_groups
source = "../security_groups"
Expand Down Expand Up @@ -189,15 +191,23 @@ resource "aws_launch_template" "kong" {
encrypted = true
}
}

tag_specifications {
resource_type = "instance"
tags = var.tags_asg
tags = merge(data.aws_default_tags.current.tags, var.tags, {
Name = local.name,
})
}

tag_specifications {
resource_type = "volume"
tags = var.tags_asg
tags = merge(data.aws_default_tags.current.tags, var.tags, {
Name = local.name,
})
}

tags = {
Name = local.name,
}

lifecycle {
Expand Down

0 comments on commit 07780c1

Please sign in to comment.