Skip to content

Commit 5ad213d

Browse files
committed
Feat: Add new attributes to AWS ACM Certificate resource
1 parent 092b70e commit 5ad213d

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed

examples/generate-certificate-dns/example.tf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ locals {
1212
module "acm" {
1313
source = "./../../"
1414

15-
name = "certificate"
16-
environment = "test"
17-
domain_name = "clouddrove.com"
18-
subject_alternative_names = ["www.${local.domain}", "*.${local.domain}"]
15+
name = "certificate"
16+
environment = "test"
17+
domain_name = "clouddrove.com"
18+
subject_alternative_names = ["www.${local.domain}", "*.${local.domain}"]
19+
key_algorithm = "RSA_2048"
20+
transparency_logging_enabled = false
1921
}
22+
23+

examples/generate-certificate-dns/outputs.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ output "validation_route53_record_fqdns" {
2323
description = "List of FQDNs built using the zone domain and name."
2424
}
2525

26-
26+
output "certificate_transparency_logging_preference" {
27+
value = module.acm.certificate_transparency_logging_preference
28+
description = "Certificate transparency logging preference."
29+
}

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ resource "aws_acm_certificate" "cert" {
4545
domain_name = var.domain_name
4646
validation_method = var.validation_method
4747
subject_alternative_names = var.subject_alternative_names
48+
key_algorithm = var.key_algorithm
4849
tags = module.labels.tags
4950

5051
dynamic "validation_option" {
@@ -56,6 +57,14 @@ resource "aws_acm_certificate" "cert" {
5657
}
5758
}
5859

60+
dynamic "options" {
61+
for_each = var.transparency_logging_enabled != null ? [1] : []
62+
content {
63+
certificate_transparency_logging_preference = var.transparency_logging_enabled ? "ENABLED" : "DISABLED"
64+
}
65+
}
66+
67+
5968
lifecycle {
6069
create_before_destroy = true
6170
}

outputs.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ output "acm_certificate_status" {
2626
description = "Status of the certificate."
2727
}
2828

29-
3029
output "validation_route53_record_fqdns" {
3130
value = [for record in aws_route53_record.default : record.fqdn]
3231
description = "List of FQDNs built using the zone domain and name."
32+
}
33+
34+
output "certificate_transparency_logging_preference" {
35+
value = try(aws_acm_certificate.cert[0].options[0].certificate_transparency_logging_preference, null)
36+
description = "Certificate transparency logging preference."
3337
}

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,15 @@ variable "private_zone" {
128128
description = "Used with name field to get a private Hosted Zone."
129129
}
130130

131+
variable "key_algorithm" {
132+
type = string
133+
default = null
134+
description = "used to generate the public/private key pair for the certificate. Valid values: RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1, EC_secp521r1."
135+
}
136+
137+
variable "transparency_logging_enabled" {
138+
type = bool
139+
default = false
140+
description = "Whether to enable certificate transparency logging. Defaults to true. Set to false to disable."
141+
}
131142

0 commit comments

Comments
 (0)