Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tags on auto scaling group. #21

Merged
merged 1 commit into from
Sep 9, 2020
Merged
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
38 changes: 25 additions & 13 deletions modules/dns_dhcp_common/auto_scaling_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,27 @@ resource "aws_autoscaling_group" "auto_scaling_group" {
vpc_zone_identifier = var.subnets
wait_for_capacity_timeout = "20m"

tags = concat([var.tags], [{
tag {
key = "AmazonECSManaged"
value = "AmazonECSManaged"
propagate_at_launch = true
}, {
}

tag {
key = "Name"
value = var.prefix
propagate_at_launch = true
}])
}

dynamic "tag" {
for_each = var.tags

content {
key = tag.key
value = tag.value
propagate_at_launch = true
}
}

timeouts {
delete = "15m"
Expand All @@ -34,14 +46,14 @@ resource "aws_placement_group" "placement_group" {
}

resource "aws_launch_configuration" "launch_configuration" {
name_prefix = var.prefix
image_id = data.aws_ami.server.id
security_groups = [var.security_group_id]
instance_type = "t2.medium"
iam_instance_profile = aws_iam_instance_profile.ecs_instance_profile.id
enable_monitoring = true
name_prefix = var.prefix
image_id = data.aws_ami.server.id
security_groups = [var.security_group_id]
instance_type = "t2.medium"
iam_instance_profile = aws_iam_instance_profile.ecs_instance_profile.id
enable_monitoring = true
associate_public_ip_address = false
user_data = <<DATA
user_data = <<DATA
Content-Type: multipart/mixed; boundary="==BOUNDARY=="
MIME-Version: 1.0

Expand Down Expand Up @@ -189,9 +201,9 @@ DATA
}

data "aws_ami" "server" {
most_recent = true
name_regex = "^amzn-ami-.*-amazon-ecs-optimized$"
owners = ["amazon"]
most_recent = true
name_regex = "^amzn-ami-.*-amazon-ecs-optimized$"
owners = ["amazon"]

filter {
name = "root-device-type"
Expand Down