Skip to content

Commit 1193294

Browse files
committed
CCM-11586: cert references
1 parent d3d31dc commit 1193294

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

infrastructure/terraform/components/api/s3_bucket_truststore.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ resource "aws_s3_bucket_logging" "truststore" {
4848
bucket = aws_s3_bucket.truststore.id
4949

5050
target_bucket = var.truststore_s3_bucket_config.bucket_logs_bucket_name
51-
target_prefix = "truststore/${aws_s3_bucket.truststore[0].bucket}/"
51+
target_prefix = "truststore/${aws_s3_bucket.truststore.bucket}/"
5252
}
5353

54-
# If Environment is to be Manually configured, need to create a placeholder truststore file for mtls
54+
# In manually configured (e.g. dev main, nonprod main, prod main) add lifecycle policy to permit manual management of cert
5555
resource "aws_s3_object" "placeholder_truststore" {
5656
count = var.manually_configure_mtls_truststore ? 1 : 0
5757
bucket = aws_s3_bucket.truststore.bucket
5858
key = "truststore.pem"
59-
content = tls_self_signed_cert.placeholder_cert.cert_pem
59+
content = module.supplier_ssl[0].cacert_pem
6060

6161
depends_on = [
6262
aws_s3_bucket_versioning.truststore
@@ -69,14 +69,13 @@ resource "aws_s3_object" "placeholder_truststore" {
6969
}
7070
}
7171

72-
# If env is not manually configured, use the certs generated from the ssl module
73-
# Having a duplicate resource here as lifcycle rules can't be dynamic or variable
74-
# We don't want to ignore content in nonprod, but we do for prod as we will manually update certs and not via ssl module
72+
# In non-manually configured env (e.g. PR) exclude lifecycle policy so resources are managed
73+
# Requires duplicate block as lifecycle policies cannot be dynamic
7574
resource "aws_s3_object" "placeholder_truststore_nonprod" {
7675
count = var.manually_configure_mtls_truststore ? 0 : 1
7776
bucket = aws_s3_bucket.truststore.bucket
7877
key = "truststore.pem"
79-
content = module.supplier_ssl.cacert_pem
78+
content = module.supplier_ssl[0].cacert_pem
8079

8180
depends_on = [
8281
aws_s3_bucket_versioning.truststore,

0 commit comments

Comments
 (0)