Skip to content

Commit 3f6e835

Browse files
infra: add kms policy dependency for firehouse cloudwatch logs (#426)
1 parent 7aa17b8 commit 3f6e835

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

infrastructure/modules/api_gateway/cloudwatch.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ resource "aws_cloudwatch_log_group" "api_gateway" {
44
tags = var.tags
55
kms_key_id = aws_kms_key.api_gateway.arn
66

7+
depends_on = [
8+
aws_kms_key.api_gateway,
9+
aws_kms_key_policy.api_gateway
10+
]
11+
712
lifecycle {
813
prevent_destroy = false
914
}

infrastructure/modules/kinesis_firehose/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ output "firehose_stream_name" {
55
output "kinesis_firehose_cmk_arn" {
66
value = aws_kms_key.firehose_cmk.arn
77
}
8+
9+
output "kinesis_firehose_cmk" {
10+
value = aws_kms_key.firehose_cmk
11+
}
12+
13+
output "kinesis_firehose_key_policy" {
14+
value = aws_kms_key_policy.firehose_key_policy
15+
}

infrastructure/stacks/api-layer/cloudwatch.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ resource "aws_cloudwatch_log_group" "firehose_audit" {
2121
}
2222

2323
depends_on = [
24-
module.eligibility_audit_firehose_delivery_stream.kinesis_firehose_cmk_arn
24+
module.eligibility_audit_firehose_delivery_stream.kinesis_firehose_cmk,
25+
module.eligibility_audit_firehose_delivery_stream.kinesis_firehose_key_policy,
2526
]
2627
}
2728

infrastructure/stacks/api-layer/truststore_s3_bucket.tf

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ resource "aws_s3_bucket_policy" "truststore" {
1515
data "aws_iam_policy_document" "truststore_api_gateway" {
1616
# Deny non-SSL
1717
statement {
18-
sid = "AllowSslRequestsOnly"
18+
sid = "AllowSslRequestsOnly"
1919
actions = ["s3:*"]
20-
effect = "Deny"
20+
effect = "Deny"
2121
resources = [
2222
module.s3_truststore_bucket.storage_bucket_arn,
2323
"${module.s3_truststore_bucket.storage_bucket_arn}/*"
2424
]
2525
principals {
26-
type = "*"
26+
type = "*"
2727
identifiers = ["*"]
2828
}
2929
condition {
3030
test = "Bool"
3131
variable = "aws:SecureTransport"
32-
values = ["false"]
32+
values = ["false"]
3333
}
3434
}
3535
statement {
3636
sid = "Enable S3 access permissions for API Gateway"
3737
effect = "Allow"
3838

3939
principals {
40-
type = "Service"
40+
type = "Service"
4141
identifiers = ["apigateway.amazonaws.com"]
4242
}
4343

@@ -56,6 +56,12 @@ resource "aws_s3_object" "pem_file" {
5656

5757
acl = "private"
5858

59+
override_provider {
60+
default_tags {
61+
tags = {}
62+
}
63+
}
64+
5965
# Explicitly set empty tags to override default_tags due to S3 object 10-tag limit
6066
tags = {}
6167

0 commit comments

Comments
 (0)