iac: print acm validation info during apply

and remove related useless output
This commit is contained in:
bdeshi 2024-05-17 08:17:29 +06:00
parent 8ff78e2fa5
commit ce37532e80
Signed by: bdeshi
GPG Key ID: 410D03DA9A3468E0
2 changed files with 25 additions and 9 deletions

View File

@ -2,12 +2,33 @@ resource "aws_acm_certificate" "created" {
domain_name = var.domain_name domain_name = var.domain_name
validation_method = "DNS" validation_method = "DNS"
subject_alternative_names = [] subject_alternative_names = []
validation_option {
domain_name = var.domain_name
validation_domain = var.domain_name
}
} }
resource "aws_acm_certificate_validation" "created" { resource "aws_acm_certificate_validation" "created" {
certificate_arn = aws_acm_certificate.created.arn certificate_arn = aws_acm_certificate.created.arn
depends_on = [terraform_data.print_acm_validation_records]
}
# HACK: im sorry
resource "terraform_data" "print_acm_validation_records" {
provisioner "local-exec" {
command = <<-EOT
echo -en '\n\n\n\n\n\n
add the following records to associated DNS server:\n\n
${local.acm_validation_records_provisioner_string}
\n\n\n\n\n\n'
EOT
}
}
locals {
acm_validation_records_provisioner_string = join("\n", [
for map in aws_acm_certificate.created.domain_validation_options :
join("\n", [
join(" | ", keys(map)),
join(" | ", values(map))
])
])
} }

View File

@ -18,11 +18,6 @@ output "acm_certificate_arn" {
description = "ARN of the created ACM certificate." description = "ARN of the created ACM certificate."
} }
output "acm_validation_options" {
value = aws_acm_certificate.created.domain_validation_options
description = "ACM domain validation records."
}
output "iam_access_key_id" { output "iam_access_key_id" {
value = aws_iam_access_key.publisher.id value = aws_iam_access_key.publisher.id
description = "access key ID of the publisher IAM user." description = "access key ID of the publisher IAM user."