Skip to content

Commit

Permalink
chore(ec2): add default tags to launch template
Browse files Browse the repository at this point in the history
Signed-off-by: Orla Dunlop <[email protected]>
  • Loading branch information
odunlop committed Sep 11, 2024
1 parent 493ddc4 commit 814c62e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 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 @@ -192,12 +194,20 @@ resource "aws_launch_template" "kong" {

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 814c62e

Please sign in to comment.