From 747a8ed2735447fb7f5c18b0fa4b1fd64e14e132 Mon Sep 17 00:00:00 2001 From: Marcio Goda Date: Fri, 10 May 2024 15:36:10 +0100 Subject: [PATCH] add var tags --- main.tf | 12 ++---------- variables.tf | 6 ++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/main.tf b/main.tf index 6910d68..dd44899 100644 --- a/main.tf +++ b/main.tf @@ -1,12 +1,4 @@ -locals { - -tags = merge({ - "component" = var.release["component"] - "env" = var.release["env"] - "team" = var.release["team"] - "version" = var.release["version"] - }) -} + resource "aws_ecs_service" "service" { count = var.target_group_arn != "" ? 1 : 0 @@ -19,7 +11,7 @@ resource "aws_ecs_service" "service" { deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent deployment_maximum_percent = var.deployment_maximum_percent health_check_grace_period_seconds = var.health_check_grace_period_seconds - tags = local.tags + tags = var.tags load_balancer { target_group_arn = var.target_group_arn diff --git a/variables.tf b/variables.tf index 86101e4..1b526f6 100644 --- a/variables.tf +++ b/variables.tf @@ -126,4 +126,10 @@ variable "capacity_providers" { description = "The capacity providers to add to the service. If the service is using the default capacity provider strategy, the service can also have one or more capacity providers specified using the capacityProviders parameter." type = list default = [] +} + +variable "tags" { + description = "A mapping of tags to assign to the resource." + type = map + default = {} } \ No newline at end of file