Skip to content

Commit 13088d1

Browse files
committed
make bucket dynamic per environment
1 parent c9403a5 commit 13088d1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

infrastructure/instance/file_name_processor.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ locals {
33
filename_lambda_dir = abspath("${path.root}/../../lambdas/filenameprocessor")
44
filename_lambda_files = fileset(local.filename_lambda_dir, "**")
55
filename_lambda_dir_sha = sha1(join("", [for f in local.filename_lambda_files : filesha1("${local.filename_lambda_dir}/${f}")]))
6+
dps_bucket_for_extended_attribute = (
7+
var.environment == "prod" ? "nhsd-dspp-core-prod-extended-attributes-gdp" : "nhsd-dspp-core-ref-extended-attributes-gdp"
8+
)
9+
10+
dps_bucket_arn_for_extended_attribute = [
11+
"arn:aws:s3:::${local.dps_bucket_for_extended_attribute}/*"
12+
]
613
}
714

15+
16+
817
resource "aws_ecr_repository" "file_name_processor_lambda_repository" {
918
image_scanning_configuration {
1019
scan_on_push = true
@@ -168,10 +177,7 @@ resource "aws_iam_policy" "filenameprocessor_lambda_exec_policy" {
168177
"Action" : [
169178
"s3:PutObject"
170179
],
171-
"Resource" : [
172-
"arn:aws:s3:::nhsd-dspp-core-ref-extended-attributes-gdp",
173-
"arn:aws:s3:::nhsd-dspp-core-ref-extended-attributes-gdp/*"
174-
]
180+
"Resource" : local.dps_bucket_arn_for_extended_attribute
175181
}
176182
]
177183
})

0 commit comments

Comments
 (0)