Skip to content

Commit c39af18

Browse files
committed
add count logic to is sandbox
1 parent 2efec1e commit c39af18

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

infrastructure/iam.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ resource "aws_iam_role_policy_attachment" "ods_report_presign_url" {
195195
}
196196

197197
resource "aws_iam_role" "api_gateway_cloudwatch" {
198-
name = "${terraform.workspace}_NdrAPIGatewayLogs"
198+
count = local.is_sandbox ? 0 : 1
199+
name = "${terraform.workspace}_NdrAPIGatewayLogs"
199200

200201
assume_role_policy = jsonencode({
201202
Version = "2012-10-17"
@@ -212,10 +213,12 @@ resource "aws_iam_role" "api_gateway_cloudwatch" {
212213
}
213214

214215
resource "aws_iam_role_policy_attachment" "api_gateway_logs" {
216+
count = local.is_sandbox ? 0 : 1
215217
role = aws_iam_role.api_gateway_cloudwatch.name
216218
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"
217219
}
218220

219221
resource "aws_api_gateway_account" "logging" {
222+
count = local.is_sandbox ? 0 : 1
220223
cloudwatch_role_arn = aws_iam_role.api_gateway_cloudwatch.arn
221224
}

0 commit comments

Comments
 (0)