From 048e41e218c91c2c35e92b4ca2d1b4be8664699d Mon Sep 17 00:00:00 2001 From: chenga Date: Thu, 18 Jul 2024 08:40:28 +0300 Subject: [PATCH] remove redudant if statements --- modules/role/role.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/role/role.tf b/modules/role/role.tf index e6ac0ed..702d5d7 100644 --- a/modules/role/role.tf +++ b/modules/role/role.tf @@ -1,5 +1,5 @@ locals { - should_create_s3_policy = var.blacklist_object_arn != null && var.blacklist_object_arn != "" ? true : false + should_create_s3_policy = var.blacklist_object_arn != null && var.blacklist_object_arn != "" ? 1 : 0 } @@ -28,7 +28,7 @@ resource "aws_iam_role" "lambda_execution_role" { } data "aws_iam_policy_document" "s3_policy_document" { - count = local.should_create_s3_policy ? 1 : 0 + count = local.should_create_s3_policy statement { sid = "" effect = "Allow" @@ -38,7 +38,7 @@ data "aws_iam_policy_document" "s3_policy_document" { } resource "aws_iam_policy" "s3_iam_policy" { - count = local.should_create_s3_policy ? 1 : 0 + count = local.should_create_s3_policy policy = data.aws_iam_policy_document.s3_policy_document[count.index].json tags = merge( @@ -48,7 +48,7 @@ resource "aws_iam_policy" "s3_iam_policy" { } resource "aws_iam_role_policy_attachment" "s3_policy_attachment" { - count = local.should_create_s3_policy ? 1 : 0 + count = local.should_create_s3_policy role = aws_iam_role.lambda_execution_role.name policy_arn = aws_iam_policy.s3_iam_policy[count.index].arn }