Skip to content

Commit 9b1e49c

Browse files
stevebuxmasl2francisco-videira-nhs
authored
CCM-14114: set TLS version on Rest API to be 1.2, to match domain name (#491)
Co-authored-by: Mark Slowey <113013138+masl2@users.noreply.github.com> Co-authored-by: Francisco Videira <francisco.videira@nhs.net>
1 parent 4fcac1f commit 9b1e49c

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

infrastructure/terraform/components/api/api_gateway_rest_api.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ resource "aws_api_gateway_rest_api" "main" {
33
body = local.openapi_spec
44
description = "Suppliers API"
55
disable_execute_api_endpoint = var.disable_gateway_execute_endpoint
6+
7+
lifecycle {
8+
replace_triggered_by = [terraform_data.rest_api_security_policy]
9+
}
610
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
locals {
2+
rest_api_security_policy = "SecurityPolicy_TLS12_PFS_2025_EDGE"
3+
rest_api_endpoint_access_mode = "STRICT"
4+
}
5+
6+
resource "terraform_data" "rest_api_security_policy" {
7+
input = {
8+
security_policy = local.rest_api_security_policy
9+
endpoint_access_mode = local.rest_api_endpoint_access_mode
10+
}
11+
}

infrastructure/terraform/components/api/locals.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ locals {
77
openapi_spec = templatefile("${path.module}/resources/spec.tmpl.json", {
88
APIG_EXECUTION_ROLE_ARN = aws_iam_role.api_gateway_execution_role.arn
99
AWS_REGION = var.region
10+
SECURITY_POLICY = local.rest_api_security_policy
11+
ENDPOINT_ACCESS_MODE = local.rest_api_endpoint_access_mode
1012
AUTHORIZER_LAMBDA_ARN = module.authorizer_lambda.function_arn
1113
GET_LETTER_LAMBDA_ARN = module.get_letter.function_arn
1214
GET_LETTERS_LAMBDA_ARN = module.get_letters.function_arn

infrastructure/terraform/components/api/resources/spec.tmpl.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,5 +307,7 @@
307307
}
308308
}
309309
}
310-
}
310+
},
311+
"x-amazon-apigateway-endpoint-access-mode": "${ENDPOINT_ACCESS_MODE}",
312+
"x-amazon-apigateway-security-policy": "${SECURITY_POLICY}"
311313
}

0 commit comments

Comments
 (0)