Skip to content

Commit de71001

Browse files
committed
add s3 buckets to locals
1 parent 46b775c commit de71001

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

terraform/mesh.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ module "mesh" {
1313
handshake_schedule = "rate(24 hours)"
1414

1515
account_id = local.immunisation_account_id
16+
# TODO these need enviroment specific names to avoid conflicts
17+
mesh_bucket_name = "local-immunisation-mesh"
18+
mesh_logs_bucket_name = "local-immunisation-mesh-s3logs"
1619
}

terraform/mesh_processor.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ locals {
88
mesh_processor_lambda_dir = abspath("${path.root}/../mesh_processor")
99
mesh_processor_lambda_files = fileset(local.mesh_processor_lambda_dir, "**")
1010
mesh_processor_lambda_dir_sha = sha1(join("", [for f in local.mesh_processor_lambda_files : filesha1("${local.mesh_processor_lambda_dir}/${f}")]))
11+
mesh_s3_bucket_name = local.is_mesh_enabled ? module.mesh[0].mesh_bucket_name : null
12+
mesh_s3_logs_bucket_name = local.is_mesh_enabled ? module.mesh[0].mesh_logs_bucket_name : null
1113
}
1214

1315
resource "aws_ecr_repository" "mesh_file_converter_lambda_repository" {
@@ -140,6 +142,9 @@ resource "aws_iam_policy" "mesh_processor_lambda_exec_policy" {
140142
"s3:DeleteObject"
141143
]
142144
Resource = [
145+
"arn:aws:s3:::${local.mesh_s3_bucket_name}",
146+
"arn:aws:s3:::${local.mesh_s3_bucket_name}/*",
147+
"arn:aws:s3:::${local.mesh_s3_logs_bucket_name}/*",
143148
"arn:aws:s3:::local-immunisation-mesh",
144149
"arn:aws:s3:::local-immunisation-mesh/*",
145150
"arn:aws:s3:::local-immunisation-mesh-s3logs/*"

0 commit comments

Comments
 (0)