From 40a01f4f17e0bee68d17597a56fdf99c040319f4 Mon Sep 17 00:00:00 2001 From: Yoan SIMIAND-COSSIN <127422619+ysimiandcossin@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:20:16 +0100 Subject: [PATCH] fix(terraform-zscc-asg-aws): propagate default tags to auto scaling group --- modules/terraform-zscc-asg-aws/main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/terraform-zscc-asg-aws/main.tf b/modules/terraform-zscc-asg-aws/main.tf index 2c9a792..ed0ab29 100755 --- a/modules/terraform-zscc-asg-aws/main.tf +++ b/modules/terraform-zscc-asg-aws/main.tf @@ -26,6 +26,11 @@ data "aws_kms_alias" "current_kms_arn" { name = coalesce(var.byo_kms_key_alias, data.aws_ebs_default_kms_key.current_kms_key[0].key_arn) } +################################################################################ +# Retrieve the default tags from provider +################################################################################ +data "aws_default_tags" "current" {} + ################################################################################ # Create launch template for Cloud Connector autoscaling group instance creation. @@ -180,7 +185,7 @@ resource "aws_autoscaling_group" "cc_asg" { } dynamic "tag" { - for_each = var.global_tags + for_each = merge(var.global_tags, data.aws_default_tags.current.tags) content { key = tag.key value = tag.value