From b497874982a4adb1bfddf0688f52517f3b7bbe90 Mon Sep 17 00:00:00 2001 From: wadhah mahrouk <33103894+wadhah101@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:05:37 +0100 Subject: [PATCH] fix: use for_each instead of count in aws_s3_bucket_logging (#212) * use for each instead of count in aws_s3_bucket_logging * user moved operator --- main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index cc899c8f..371dad6c 100644 --- a/main.tf +++ b/main.tf @@ -58,8 +58,13 @@ resource "aws_s3_bucket_versioning" "default" { } } +moved { + from = aws_s3_bucket_logging.default[0] + to = aws_s3_bucket_logging.default["enabled"] +} + resource "aws_s3_bucket_logging" "default" { - count = local.enabled && try(length(var.logging), 0) > 0 ? 1 : 0 + for_each = toset(local.enabled && length(var.logging) > 0 ? ["enabled"] : []) bucket = local.bucket_id