Skip to content

Commit 4f3b00c

Browse files
committed
NRL-1188 env toggle added
1 parent 3135c3b commit 4f3b00c

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

terraform/infrastructure/data.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ data "external" "current-info" {
4343
}
4444

4545
data "aws_s3_bucket" "source-data-bucket" {
46+
count = local.is_dev_env ? 1 : 0
4647
bucket = "${local.shared_prefix}-source-data-bucket"
4748
}
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
module "firehose__processor" {
2-
source = "./modules/firehose"
3-
assume_account = local.aws_account_id
4-
prefix = local.prefix
5-
region = local.region
6-
environment = local.environment
7-
cloudwatch_kms_arn = module.kms__cloudwatch.kms_arn
8-
splunk_environment = local.splunk_environment
9-
splunk_index = local.splunk_index
10-
destination = "splunk"
11-
reporting_bucket_arn = data.aws_s3_bucket.source-data-bucket.arn
2+
source = "./modules/firehose"
3+
assume_account = local.aws_account_id
4+
prefix = local.prefix
5+
region = local.region
6+
environment = local.environment
7+
cloudwatch_kms_arn = module.kms__cloudwatch.kms_arn
8+
splunk_environment = local.splunk_environment
9+
splunk_index = local.splunk_index
10+
destination = "splunk"
11+
reporting_bucket_arn = local.reporting_bucket_arn
12+
reporting_infra_toggle = local.is_dev_env
1213
}

terraform/infrastructure/locals.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ locals {
2222
dynamodb_timeout_seconds = "3"
2323

2424
is_sandbox_env = length(regexall("-sandbox-", local.stack_name)) > 0
25+
is_dev_env = length(regexall("dev", local.stack_name)) > 0
2526

2627
environment = local.is_sandbox_env ? "${var.account_name}-sandbox" : var.account_name
2728
shared_prefix = "${local.project}--${local.environment}"
2829
public_domain = local.is_sandbox_env ? var.public_sandbox_domain : var.public_domain
2930

31+
# Logic / vars for reporting
32+
reporting_bucket_arn = local.is_dev_env ? data.aws_s3_bucket.source-data-bucket.arn : null
33+
3034
# Logic / vars for splunk environment
3135
splunk_environment = local.is_sandbox_env ? "${var.account_name}sandbox" : var.account_name
3236
splunk_index = "aws_recordlocator_${local.splunk_environment}"

terraform/infrastructure/modules/firehose/cloudwatch.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ resource "aws_cloudwatch_log_stream" "firehose" {
99
}
1010

1111
resource "aws_cloudwatch_log_group" "firehose_reporting" {
12+
count = var.reporting_infra_toggle ? 1 : 0
1213
name = "/aws/kinesisfirehose/${var.prefix}-firehose-reporting"
1314
retention_in_days = local.cloudwatch.retention.days
1415
}
1516

1617
resource "aws_cloudwatch_log_stream" "firehose_reporting" {
18+
count = var.reporting_infra_toggle ? 1 : 0
1719
name = "${var.prefix}-firehose-reporting"
1820
log_group_name = aws_cloudwatch_log_group.firehose_reporting.name
1921
}

terraform/infrastructure/modules/firehose/kinesis.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ resource "aws_kinesis_firehose_delivery_stream" "firehose" {
5858
}
5959

6060
resource "aws_kinesis_firehose_delivery_stream" "reporting_stream" {
61+
count = var.reporting_infra_toggle ? 1 : 0
6162
name = "${var.prefix}--cloudwatch-reporting-delivery-stream"
6263
destination = "extended_s3"
6364

terraform/infrastructure/modules/firehose/vars.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,10 @@ variable "error_prefix" {
3636
}
3737

3838
variable "reporting_bucket_arn" {
39-
type = string
39+
type = string
40+
default = null
41+
}
42+
43+
variable "reporting_infra_toggle" {
44+
type = bool
4045
}

0 commit comments

Comments
 (0)