Skip to content

Commit cf6ee25

Browse files
authored
Merge branch 'master' into VED-357-infra-updates-only
2 parents f809124 + 793544d commit cf6ee25

File tree

10 files changed

+17
-36
lines changed

10 files changed

+17
-36
lines changed

terraform/ack_lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_ecr_repository" "ack_lambda_repository" {
1717
# Module for building and pushing Docker image to ECR
1818
module "ack_processor_docker_image" {
1919
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
20-
version = "7.21.1"
20+
version = "8.0.1"
2121

2222
create_ecr_repo = false
2323
ecr_repo = aws_ecr_repository.ack_lambda_repository.name

terraform/delta.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_ecr_repository" "delta_lambda_repository" {
1717

1818
module "delta_docker_image" {
1919
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
20-
version = "7.21.1"
20+
version = "8.0.1"
2121

2222
create_ecr_repo = false
2323
ecr_repo = "${local.prefix}-delta-lambda-repo"

terraform/ecs_batch_processor_config.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "aws_ecr_repository" "processing_repository" {
2727
# Build and Push Docker Image to ECR (Reusing the existing module)
2828
module "processing_docker_image" {
2929
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
30-
version = "7.21.1"
30+
version = "8.0.1"
3131

3232
docker_file_path = "Dockerfile"
3333
create_ecr_repo = false

terraform/file_name_processor.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_ecr_repository" "file_name_processor_lambda_repository" {
1717
# Module for building and pushing Docker image to ECR
1818
module "file_processor_docker_image" {
1919
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
20-
version = "7.21.1"
20+
version = "8.0.1"
2121

2222
create_ecr_repo = false
2323
ecr_repo = aws_ecr_repository.file_name_processor_lambda_repository.name

terraform/forwarder_lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resource "aws_ecr_repository" "forwarder_lambda_repository" {
2020

2121
module "forwarding_docker_image" {
2222
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
23-
version = "7.21.1"
23+
version = "8.0.1"
2424

2525
create_ecr_repo = false
2626
ecr_repo = aws_ecr_repository.forwarder_lambda_repository.name

terraform/lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resource "aws_ecr_repository" "operation_lambda_repository" {
2121
#resource "docker_image" "lambda_function_docker" {
2222
module "docker_image" {
2323
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
24-
version = "7.21.1"
24+
version = "8.0.1"
2525

2626
create_ecr_repo = false
2727
ecr_repo = "${local.prefix}-operation-lambda-repo"

terraform/mesh_processor.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_ecr_repository" "mesh_file_converter_lambda_repository" {
1717
# Module for building and pushing Docker image to ECR
1818
module "mesh_processor_docker_image" {
1919
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
20-
version = "7.21.1"
20+
version = "8.0.1"
2121

2222
create_ecr_repo = false
2323
ecr_repo = aws_ecr_repository.mesh_file_converter_lambda_repository.name

terraform/redis_sync_lambda.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resource "aws_ecr_repository" "redis_sync_lambda_repository" {
1616
# Module for building and pushing Docker image to ECR
1717
module "redis_sync_docker_image" {
1818
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
19-
version = "7.21.1"
19+
version = "8.0.1"
2020

2121
create_ecr_repo = false
2222
ecr_repo = aws_ecr_repository.redis_sync_lambda_repository.name
@@ -253,10 +253,8 @@ resource "aws_cloudwatch_log_group" "redis_sync_log_group" {
253253

254254
# S3 Bucket notification to trigger Lambda function for config bucket
255255
resource "aws_s3_bucket_notification" "config_lambda_notification" {
256-
# For now, only create a trigger in internal-dev and prod as those are the envs with a config bucket
257-
count = local.create_config_bucket ? 1 : 0
258256

259-
bucket = aws_s3_bucket.batch_config_bucket[0].bucket
257+
bucket = aws_s3_bucket.batch_config_bucket.bucket
260258

261259
lambda_function {
262260
lambda_function_arn = aws_lambda_function.redis_sync_lambda.arn
@@ -266,7 +264,6 @@ resource "aws_s3_bucket_notification" "config_lambda_notification" {
266264

267265
# Permission for the new S3 bucket to invoke the Lambda function
268266
resource "aws_lambda_permission" "new_s3_invoke_permission" {
269-
count = local.create_config_bucket ? 1 : 0
270267

271268
statement_id = "AllowExecutionFromNewS3"
272269
action = "lambda:InvokeFunction"

terraform/s3_config.tf

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,11 @@ resource "aws_s3_bucket_lifecycle_configuration" "data_destinations" {
192192
}
193193

194194
resource "aws_s3_bucket" "batch_config_bucket" {
195-
# For now, only create in internal-dev and prod as we only have one shared Redis instance per account.
196-
count = local.create_config_bucket ? 1 : 0
197-
198-
bucket = "imms-${local.environment}-supplier-config"
195+
bucket = "imms-${local.environment}-fhir-config"
199196
}
200197

201198
resource "aws_s3_bucket_public_access_block" "batch_config_bucket_public_access_block" {
202-
count = local.create_config_bucket ? 1 : 0
203-
204-
bucket = aws_s3_bucket.batch_config_bucket[0].id
199+
bucket = aws_s3_bucket.batch_config_bucket.id
205200

206201
block_public_acls = true
207202
block_public_policy = true
@@ -210,9 +205,7 @@ resource "aws_s3_bucket_public_access_block" "batch_config_bucket_public_access_
210205
}
211206

212207
resource "aws_s3_bucket_policy" "batch_config_bucket_policy" {
213-
count = local.create_config_bucket ? 1 : 0
214-
215-
bucket = aws_s3_bucket.batch_config_bucket[0].id
208+
bucket = aws_s3_bucket.batch_config_bucket.id
216209

217210
policy = jsonencode({
218211
Version = "2012-10-17"
@@ -226,8 +219,8 @@ resource "aws_s3_bucket_policy" "batch_config_bucket_policy" {
226219
}
227220
Action = "s3:*"
228221
Resource = [
229-
aws_s3_bucket.batch_config_bucket[0].arn,
230-
"${aws_s3_bucket.batch_config_bucket[0].arn}/*",
222+
aws_s3_bucket.batch_config_bucket.arn,
223+
"${aws_s3_bucket.batch_config_bucket.arn}/*",
231224
]
232225
Condition = {
233226
Bool = {

terraform/variables.tf

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ locals {
2121
short_prefix = "${var.project_short_name}-${local.env}"
2222
batch_prefix = "immunisation-batch-${local.env}"
2323
config_env = local.environment == "prod" ? "prod" : "dev"
24-
config_bucket_env = local.environment == "prod" ? "prod" : "internal-dev"
2524

2625
root_domain = "${local.config_env}.vds.platform.nhs.uk"
2726
project_domain_name = data.aws_route53_zone.project_zone.name
2827
service_domain_name = "${local.env}.${local.project_domain_name}"
2928

30-
# For now, only create the config bucket in internal-dev and prod as we only have one Redis instance per account.
31-
create_config_bucket = local.environment == local.config_bucket_env
32-
config_bucket_arn = local.create_config_bucket ? aws_s3_bucket.batch_config_bucket[0].arn : data.aws_s3_bucket.existing_config_bucket[0].arn
33-
config_bucket_name = local.create_config_bucket ? aws_s3_bucket.batch_config_bucket[0].bucket : data.aws_s3_bucket.existing_config_bucket[0].bucket
29+
config_bucket_arn = aws_s3_bucket.batch_config_bucket.arn
30+
config_bucket_name = aws_s3_bucket.batch_config_bucket.bucket
31+
3432

3533
# Public subnet - The subnet has a direct route to an internet gateway. Resources in a public subnet can access the public internet.
3634
# public_subnet_ids = [for k, v in data.aws_route.internet_traffic_route_by_subnet : k if length(v.gateway_id) > 0]
@@ -88,13 +86,6 @@ data "aws_security_group" "existing_securitygroup" {
8886
}
8987
}
9088

91-
data "aws_s3_bucket" "existing_config_bucket" {
92-
# For now, look up the internal-dev bucket during int, ref and PR branch deploys.
93-
count = local.create_config_bucket ? 0 : 1
94-
95-
bucket = "imms-${local.config_bucket_env}-supplier-config"
96-
}
97-
9889
data "aws_kms_key" "existing_lambda_encryption_key" {
9990
key_id = "alias/imms-batch-lambda-env-encryption"
10091
}

0 commit comments

Comments
 (0)