Skip to content

Commit 7f57fae

Browse files
CCM-14600: Enable Access Logging where Missing
1 parent ac1b7d1 commit 7f57fae

6 files changed

Lines changed: 17 additions & 44 deletions

File tree

infrastructure/terraform/components/api/module_domain_truststore.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "domain_truststore" {
2-
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.26/terraform-s3bucket.zip"
2+
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/3.0.4/terraform-s3bucket.zip"
33

44
name = "truststore"
55
aws_account_id = var.aws_account_id
@@ -12,11 +12,9 @@ module "domain_truststore" {
1212
kms_key_arn = module.kms.key_id
1313

1414
bucket_logging_target = {
15-
bucket = module.logging_bucket.bucket
16-
prefix = "truststore/"
15+
bucket = local.acct.s3_buckets["access_logs"]["id"]
1716
}
1817

1918
policy_documents = [
2019
]
21-
2220
}

infrastructure/terraform/components/api/module_logging_bucket.tf

Lines changed: 0 additions & 35 deletions
This file was deleted.

infrastructure/terraform/components/api/modules_eventpub.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "eventpub" {
2-
source = "git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/terraform/modules/eventpub?ref=feature/CCM-14600_Enable_Access_Logging_For_EventCache_Buckets"
2+
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/3.0.4/terraform-eventpub.zip"
33

44
name = "eventpub"
55

@@ -28,9 +28,7 @@ module "eventpub" {
2828
data_plane_bus_arn = var.eventpub_data_plane_bus_arn
2929
control_plane_bus_arn = var.eventpub_control_plane_bus_arn
3030

31-
eventcache_bucket_logging_target = {
32-
bucket = local.acct.s3_buckets["access_logs"]["id"]
33-
}
31+
access_logging_bucket = local.acct.s3_buckets["access_logs"]["id"]
3432

3533
additional_policies_for_event_cache_bucket = [
3634
data.aws_iam_policy_document.eventcache[0].json

infrastructure/terraform/components/api/modules_eventsub.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ module "eventsub" {
2727
enable_event_cache = var.enable_event_cache
2828

2929
shared_infra_account_id = var.shared_infra_account_id
30+
31+
access_logging_bucket = local.acct.s3_buckets["access_logs"]["id"]
3032
}

infrastructure/terraform/modules/eventsub/module_s3bucket_event_cache.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "s3bucket_event_cache" {
2-
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.26/terraform-s3bucket.zip"
2+
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/3.0.4/terraform-s3bucket.zip"
33

44
count = var.enable_event_cache ? 1 : 0
55

@@ -40,6 +40,10 @@ module "s3bucket_event_cache" {
4040
data.aws_iam_policy_document.s3bucket_event_cache[0].json
4141
]
4242

43+
bucket_logging_target = {
44+
bucket = "${var.access_logging_bucket}"
45+
}
46+
4347
public_access = {
4448
block_public_acls = true
4549
block_public_policy = true

infrastructure/terraform/modules/eventsub/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,9 @@ variable "glue_role_arn" {
119119
type = string
120120
description = "ARN of the Glue execution role from the parent"
121121
}
122+
123+
variable "access_logging_bucket" {
124+
type = string
125+
description = "Name of S3 bucket to use for access logging"
126+
default = ""
127+
}

0 commit comments

Comments
 (0)