Skip to content

Commit 467e825

Browse files
committed
NRL-1188 use compact to ignore nulls
1 parent ab785bd commit 467e825

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

terraform/infrastructure/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ locals {
2929
public_domain = local.is_sandbox_env ? var.public_sandbox_domain : var.public_domain
3030

3131
# Logic / vars for reporting
32-
reporting_bucket_arn = local.is_dev_env ? data.aws_s3_bucket.source-data-bucket[0].arn : data.aws_s3_bucket.source-data-bucket.arn
32+
reporting_bucket_arn = local.is_dev_env ? data.aws_s3_bucket.source-data-bucket[0].arn : null
3333

3434
# Logic / vars for splunk environment
3535
splunk_environment = local.is_sandbox_env ? "${var.account_name}sandbox" : var.account_name

terraform/infrastructure/modules/firehose/iam_firehose.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ data "aws_iam_policy_document" "firehose" {
2727
"s3:PutObject",
2828
]
2929

30-
resources = [
30+
resources = compact([
3131
aws_s3_bucket.firehose.arn,
3232
"${aws_s3_bucket.firehose.arn}/*",
3333
var.reporting_bucket_arn,
3434
"${var.reporting_bucket_arn}/*",
35-
]
35+
])
3636
effect = "Allow"
3737
}
3838

@@ -72,12 +72,12 @@ data "aws_iam_policy_document" "firehose" {
7272
actions = [
7373
"logs:PutLogEvents",
7474
]
75-
resources = [
75+
resources = compact([
7676
aws_cloudwatch_log_group.firehose.arn,
7777
aws_cloudwatch_log_stream.firehose.arn,
7878
local.iam_firehose.cloudwatch_reporting_log_group_arn,
7979
local.iam_firehose.cloudwatch_reporting_log_stream_arn,
80-
]
80+
])
8181
effect = "Allow"
8282
}
8383
}

terraform/infrastructure/modules/firehose/iam_subscriptions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ data "aws_iam_policy_document" "firehose_subscription" {
2020
"firehose:*",
2121
]
2222
effect = "Allow"
23-
resources = [
23+
resources = compact([
2424
aws_kinesis_firehose_delivery_stream.firehose.arn,
2525
local.iam_subscriptions.firehose_reporting_stream_arn,
26-
]
26+
])
2727
}
2828
statement {
2929
actions = [

terraform/infrastructure/modules/firehose/locals.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ locals {
3232
}
3333

3434
iam_firehose = {
35-
cloudwatch_reporting_log_group_arn = var.reporting_infra_toggle ? aws_cloudwatch_log_group.firehose_reporting[0].arn : aws_cloudwatch_log_group.firehose_reporting.arn
36-
cloudwatch_reporting_log_stream_arn = var.reporting_infra_toggle ? aws_cloudwatch_log_stream.firehose_reporting[0].arn : aws_cloudwatch_log_stream.firehose_reporting.arn
35+
cloudwatch_reporting_log_group_arn = var.reporting_infra_toggle ? aws_cloudwatch_log_group.firehose_reporting[0].arn : null
36+
cloudwatch_reporting_log_stream_arn = var.reporting_infra_toggle ? aws_cloudwatch_log_stream.firehose_reporting[0].arn : null
3737
}
3838

3939
iam_subscriptions = {
40-
firehose_reporting_stream_arn = var.reporting_infra_toggle ? aws_kinesis_firehose_delivery_stream.reporting_stream[0].arn : aws_kinesis_firehose_delivery_stream.reporting_stream.arn
40+
firehose_reporting_stream_arn = var.reporting_infra_toggle ? aws_kinesis_firehose_delivery_stream.reporting_stream[0].arn : null
4141
}
4242

4343
}

0 commit comments

Comments
 (0)