From a449918538a6acd45f3161909d09ffa364aac86d Mon Sep 17 00:00:00 2001 From: Dave Barnum Date: Fri, 27 Oct 2023 12:28:23 -0400 Subject: [PATCH] ECS Module: Add tags --- aws/ecs/cluster/main.tf | 2 ++ aws/ecs/cluster/vars.tf | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/aws/ecs/cluster/main.tf b/aws/ecs/cluster/main.tf index d56b0bb..4fc9209 100644 --- a/aws/ecs/cluster/main.tf +++ b/aws/ecs/cluster/main.tf @@ -3,6 +3,8 @@ */ resource "aws_ecs_cluster" "ecs_cluster" { name = var.cluster_name == "" ? "${var.app_name}-${var.app_env}" : var.cluster_name + + tags = var.tags } /* diff --git a/aws/ecs/cluster/vars.tf b/aws/ecs/cluster/vars.tf index 6c4bb6f..f010234 100644 --- a/aws/ecs/cluster/vars.tf +++ b/aws/ecs/cluster/vars.tf @@ -15,12 +15,18 @@ variable "app_env" { * Optional variables */ +variable "amiFilter" { + type = string + default = "amzn2-ami-ecs-hvm-*-x86_64-ebs" +} + variable "cluster_name" { description = "name of the ECS cluster - if blank, the cluster name will be \"app_name-app_env\" - if not blank, app_name and app_env are not required" default = "" } -variable "amiFilter" { - type = string - default = "amzn2-ami-ecs-hvm-*-x86_64-ebs" +variable "tags" { + type = map(any) + description = "Map of tags to add to the ECS service. Duplicate tags will be overridden." + default = {} }