From 8f9c335aae61088a5ae05c4c30adf765a1ac7f3a Mon Sep 17 00:00:00 2001 From: kuntalkumarbasu Date: Thu, 28 Mar 2024 15:58:19 -0400 Subject: [PATCH] fix:ensuring no resource when enable auto tagging is false --- autotagging.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autotagging.tf b/autotagging.tf index c2e6c3c..91e46c3 100644 --- a/autotagging.tf +++ b/autotagging.tf @@ -50,7 +50,7 @@ resource "aws_sqs_queue" "auto_tagging" { } resource "aws_sns_topic_subscription" "auto_tagging" { - count = var.sns_topic_arn == "" ? 0 : 1 + count = var.enable_auto_tagging == true ? var.sns_topic_arn == "" ? 0 : 1 : 0 topic_arn = var.sns_topic_arn protocol = "sqs" @@ -99,7 +99,7 @@ data "aws_iam_policy_document" "auto_tagging_sqs" { } data "aws_iam_policy_document" "auto_tagging_sns" { - count = var.sns_topic_arn == "" ? 0 : 1 + count = var.enable_auto_tagging == true ? var.sns_topic_arn == "" ? 0 : 1 : 0 statement { effect = "Allow"