Skip to content

Commit ee462b9

Browse files
committed
NDR-213 Refactor conditional into locals
1 parent 0c6606d commit ee462b9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

infrastructure/api_mtls.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ resource "aws_api_gateway_domain_name" "custom_api_domain_mtls" {
1818
}
1919

2020
mutual_tls_authentication {
21-
truststore_uri = local.is_sandbox ? "s3://ndr-dev-${var.truststore_bucket_name}/${var.ca_pem_filename}" : "s3://${module.ndr-truststore[0].bucket_id}/${var.ca_pem_filename}"
21+
truststore_uri = local.truststore_uri
2222
truststore_version = data.aws_s3_object.truststore_ext_cert.version_id
2323
}
2424
}

infrastructure/buckets.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ module "ndr-truststore" {
129129
}
130130

131131
data "aws_s3_object" "truststore_ext_cert" {
132-
bucket = local.is_sandbox ? "ndr-dev-${var.truststore_bucket_name}" : module.ndr-truststore[0].bucket_id
132+
bucket = local.truststore_bucket_id
133133
key = var.ca_pem_filename
134134
}
135135

infrastructure/variable.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ locals {
238238
current_account_id = data.aws_caller_identity.current.account_id
239239

240240
apim_api_url = "https://${var.apim_environment}api.service.nhs.uk/national-document-repository"
241+
242+
truststore_bucket_id = local.is_sandbox ? "ndr-dev-${var.truststore_bucket_name}" : module.ndr-truststore[0].bucket_id
243+
truststore_uri = "s3://${local.truststore_bucket_id}/${var.ca_pem_filename}"
241244
}
242245

243246
variable "nrl_api_endpoint_suffix" {

0 commit comments

Comments
 (0)