Skip to content

Commit 3ec70f1

Browse files
committed
VED-728: Specify S3 object version for truststores to allow cert rotation.
1 parent 7b05841 commit 3ec70f1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

infrastructure/instance/modules/api_gateway/api.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ resource "aws_apigatewayv2_domain_name" "service_api_domain_name" {
3838
security_policy = "TLS_1_2"
3939
}
4040
mutual_tls_authentication {
41-
truststore_uri = "s3://${aws_s3_bucket.truststore_bucket.bucket}/${local.truststore_file_name}"
41+
truststore_uri = "s3://${aws_s3_bucket.truststore_bucket.bucket}/${local.truststore_file_name}"
42+
truststore_version = aws_s3_object_copy.copy_cert_from_storage.version_id
4243
}
4344
tags = {
4445
Name = "${var.prefix}-api-domain-name"

infrastructure/instance/modules/api_gateway/mtls_cert.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ resource "aws_s3_bucket" "truststore_bucket" {
1717
force_destroy = true
1818
}
1919

20+
resource "aws_s3_bucket_versioning" "truststore_bucket" {
21+
bucket = aws_s3_bucket.truststore_bucket.bucket
22+
versioning_configuration {
23+
status = "Enabled"
24+
}
25+
}
26+
2027
resource "aws_s3_object_copy" "copy_cert_from_storage" {
2128
bucket = aws_s3_bucket.truststore_bucket.bucket
2229
key = local.truststore_file_name
2330
source = "${data.aws_s3_object.cert.bucket}/${local.truststore_file_name}"
31+
lifecycle {
32+
replace_triggered_by = [data.aws_s3_object.cert.etag]
33+
}
2434
}

0 commit comments

Comments
 (0)