From 4669478ede5788962ac8061e64fc2b2b58367f91 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Tue, 27 Aug 2024 20:28:57 +0800 Subject: [PATCH] add a new variable to assign tags to the autoscaling group --- test/test.tf | 3 +++ variables.tf | 6 ++++++ vpc.tf | 1 + 3 files changed, 10 insertions(+) diff --git a/test/test.tf b/test/test.tf index 28f8d44..72bb712 100644 --- a/test/test.tf +++ b/test/test.tf @@ -43,6 +43,9 @@ module "full" { timeout = 10 unhealthy_threshold = 3 } + asg_tags = { + foo = "bar", + } } provider "aws" { diff --git a/variables.tf b/variables.tf index 87f3a7b..8f2200e 100644 --- a/variables.tf +++ b/variables.tf @@ -101,6 +101,12 @@ variable "asg_max_size" { type = number } +variable "asg_tags" { + description = "Tags to assign to the Autoscaling Group and EC2 instances" + default = {} + type = map(string) +} + variable "instance_type" { description = "See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes" default = "t2.micro" diff --git a/vpc.tf b/vpc.tf index f021f82..f271239 100644 --- a/vpc.tf +++ b/vpc.tf @@ -118,4 +118,5 @@ module "ecsasg" { ssh_key_name = var.ssh_key_name use_amazon_linux2 = true instance_type = var.instance_type + tags = var.asg_tags }