Hi @dfangl. Thanks for your reply.
I have simplified the project. Here is how it looks now:
The acm module:
variable "fqdn" {}
variable "zone_id" {}
variable "service_name" {}
variable "commons" {
type = map(string)
}
locals {
common_tags = {
X-Infra = 1
}
}
resource "aws_acm_certificate" "this" {
domain_name = var.fqdn
validation_method = "DNS"
tags = local.common_tags
lifecycle {
create_before_destroy = true
}
}
resource "aws_route53_record" "this" {
for_each = {
for dvo in aws_acm_certificate.this.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
}
}
zone_id = var.zone_id
name = each.value.name
type = each.value.type
records = [each.value.record]
ttl = 60
allow_overwrite = true
lifecycle {
create_before_destroy = true
}
}
resource "aws_acm_certificate_validation" "this" {
certificate_arn = aws_acm_certificate.this.arn
validation_record_fqdns = [for record in aws_route53_record.this : record.fqdn]
lifecycle {
create_before_destroy = true
}
}
output "arn" {
value = aws_acm_certificate_validation.this.certificate_arn
}
output "domain_name" {
value = aws_acm_certificate.this.domain_name
}
The module usage:
module "domain_cert" {
source = "../../../modules/acm"
fqdn = "*.localstack.example.com"
zone_id = "*****6****" # I removed this.
service_name = "es1"
commons = {
env_tier = "test"
}
Here are the logs you requested:
2023-08-28 20:26:07 2023-08-28T18:26:07.140 INFO --- [ asgi_gw_8] localstack.request.aws : AWS route53.GetHostedZone => 200
2023-08-28 20:26:07 2023-08-28T18:26:07.162 INFO --- [ asgi_gw_0] localstack.request.aws : AWS route53.ListResourceRecordSets => 200
2023-08-28 20:26:07 2023-08-28T18:26:07.178 INFO --- [ asgi_gw_7] localstack.request.aws : AWS route53.ListTagsForResource => 200
2023-08-28 20:26:07 2023-08-28T18:26:07.614 INFO --- [ asgi_gw_4] localstack.request.aws : AWS route53.GetHostedZone => 200
2023-08-28 20:26:07 2023-08-28T18:26:07.711 INFO --- [ asgi_gw_5] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 200
2023-08-28 20:26:07 2023-08-28T18:26:07.997 INFO --- [ asgi_gw_8] localstack.request.aws : AWS acm.RequestCertificate => 200
2023-08-28 20:26:08 2023-08-28T18:26:08.018 INFO --- [ asgi_gw_9] localstack.request.aws : AWS acm.DescribeCertificate => 200
2023-08-28 20:26:08 2023-08-28T18:26:08.034 INFO --- [ asgi_gw_6] localstack.request.aws : AWS acm.DescribeCertificate => 200
2023-08-28 20:26:08 2023-08-28T18:26:08.056 INFO --- [ asgi_gw_1] localstack.request.aws : AWS acm.ListTagsForCertificate => 200
2023-08-28 20:26:08 2023-08-28T18:26:08.141 INFO --- [ asgi_gw_3] localstack.request.aws : AWS route53.GetHostedZone => 200
2023-08-28 20:26:08 2023-08-28T18:26:08.155 WARN --- [ asgi_gw_2] l.s.route53.provider : UPSERT
2023-08-28 20:26:08 2023-08-28T18:26:08.156 ERROR --- [ asgi_gw_2] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:08 2023-08-28T18:26:08.158 INFO --- [ asgi_gw_2] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:08 2023-08-28T18:26:08.216 WARN --- [ asgi_gw_6] l.s.route53.provider : UPSERT
2023-08-28 20:26:08 2023-08-28T18:26:08.216 ERROR --- [ asgi_gw_6] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:08 2023-08-28T18:26:08.216 INFO --- [ asgi_gw_6] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:08 2023-08-28T18:26:08.354 WARN --- [ asgi_gw_6] l.s.route53.provider : UPSERT
2023-08-28 20:26:08 2023-08-28T18:26:08.354 ERROR --- [ asgi_gw_6] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:08 2023-08-28T18:26:08.355 INFO --- [ asgi_gw_6] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:08 2023-08-28T18:26:08.548 WARN --- [ asgi_gw_2] l.s.route53.provider : UPSERT
2023-08-28 20:26:08 2023-08-28T18:26:08.548 ERROR --- [ asgi_gw_2] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:08 2023-08-28T18:26:08.549 INFO --- [ asgi_gw_2] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:08 2023-08-28T18:26:08.943 WARN --- [ asgi_gw_7] l.s.route53.provider : UPSERT
2023-08-28 20:26:08 2023-08-28T18:26:08.943 ERROR --- [ asgi_gw_7] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:08 2023-08-28T18:26:08.944 INFO --- [ asgi_gw_7] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:09 2023-08-28T18:26:09.916 WARN --- [ asgi_gw_8] l.s.route53.provider : UPSERT
2023-08-28 20:26:09 2023-08-28T18:26:09.916 ERROR --- [ asgi_gw_8] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:09 2023-08-28T18:26:09.917 INFO --- [ asgi_gw_8] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:10 2023-08-28T18:26:10.911 WARN --- [ asgi_gw_10] l.s.route53.provider : UPSERT
2023-08-28 20:26:10 2023-08-28T18:26:10.912 ERROR --- [ asgi_gw_10] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:10 2023-08-28T18:26:10.913 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:13 2023-08-28T18:26:13.374 WARN --- [ asgi_gw_2] l.s.route53.provider : UPSERT
2023-08-28 20:26:13 2023-08-28T18:26:13.374 ERROR --- [ asgi_gw_2] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:13 2023-08-28T18:26:13.374 INFO --- [ asgi_gw_2] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:18 2023-08-28T18:26:18.316 INFO --- [ asgi_gw_0] localstack.request.aws : AWS route53.GetHostedZone => 200
2023-08-28 20:26:18 2023-08-28T18:26:18.332 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 200
2023-08-28 20:26:19 2023-08-28T18:26:19.321 WARN --- [ asgi_gw_2] l.s.route53.provider : UPSERT
2023-08-28 20:26:19 2023-08-28T18:26:19.322 ERROR --- [ asgi_gw_2] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:19 2023-08-28T18:26:19.322 INFO --- [ asgi_gw_2] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:31 2023-08-28T18:26:31.018 WARN --- [ asgi_gw_8] l.s.route53.provider : UPSERT
2023-08-28 20:26:31 2023-08-28T18:26:31.018 ERROR --- [ asgi_gw_8] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:31 2023-08-28T18:26:31.020 INFO --- [ asgi_gw_8] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:26:34 2023-08-28T18:26:34.751 INFO --- [ asgi_gw_5] localstack.request.aws : AWS route53.GetChange => 200
2023-08-28 20:26:34 2023-08-28T18:26:34.787 INFO --- [ asgi_gw_0] localstack.request.aws : AWS route53.GetHostedZone => 200
2023-08-28 20:26:34 2023-08-28T18:26:34.817 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ListResourceRecordSets => 200
2023-08-28 20:26:45 2023-08-28T18:26:45.364 INFO --- [ asgi_gw_3] localstack.request.aws : AWS route53.GetChange => 200
2023-08-28 20:26:45 2023-08-28T18:26:45.393 INFO --- [ asgi_gw_8] localstack.request.aws : AWS route53.GetHostedZone => 200
2023-08-28 20:26:45 2023-08-28T18:26:45.414 INFO --- [ asgi_gw_5] localstack.request.aws : AWS route53.ListResourceRecordSets => 200
2023-08-28 20:26:55 2023-08-28T18:26:55.890 WARN --- [ asgi_gw_10] l.s.route53.provider : UPSERT
2023-08-28 20:26:55 2023-08-28T18:26:55.891 ERROR --- [ asgi_gw_10] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:26:55 2023-08-28T18:26:55.892 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:38 2023-08-28T18:27:38.200 WARN --- [ asgi_gw_0] l.s.route53.provider : UPSERT
2023-08-28 20:27:38 2023-08-28T18:27:38.202 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:38 2023-08-28T18:27:38.203 INFO --- [ asgi_gw_0] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:38 2023-08-28T18:27:38.272 WARN --- [ asgi_gw_10] l.s.route53.provider : UPSERT
2023-08-28 20:27:38 2023-08-28T18:27:38.273 ERROR --- [ asgi_gw_10] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:38 2023-08-28T18:27:38.273 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:38 2023-08-28T18:27:38.392 WARN --- [ asgi_gw_2] l.s.route53.provider : UPSERT
2023-08-28 20:27:38 2023-08-28T18:27:38.392 ERROR --- [ asgi_gw_2] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:38 2023-08-28T18:27:38.393 INFO --- [ asgi_gw_2] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:38 2023-08-28T18:27:38.572 WARN --- [ asgi_gw_3] l.s.route53.provider : UPSERT
2023-08-28 20:27:38 2023-08-28T18:27:38.573 ERROR --- [ asgi_gw_3] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:38 2023-08-28T18:27:38.573 INFO --- [ asgi_gw_3] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:39 2023-08-28T18:27:39.073 WARN --- [ asgi_gw_8] l.s.route53.provider : UPSERT
2023-08-28 20:27:39 2023-08-28T18:27:39.073 ERROR --- [ asgi_gw_8] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:39 2023-08-28T18:27:39.075 INFO --- [ asgi_gw_8] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:39 2023-08-28T18:27:39.844 WARN --- [ asgi_gw_0] l.s.route53.provider : UPSERT
2023-08-28 20:27:39 2023-08-28T18:27:39.844 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:39 2023-08-28T18:27:39.845 INFO --- [ asgi_gw_0] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:41 2023-08-28T18:27:41.497 WARN --- [ asgi_gw_10] l.s.route53.provider : UPSERT
2023-08-28 20:27:41 2023-08-28T18:27:41.497 ERROR --- [ asgi_gw_10] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:41 2023-08-28T18:27:41.497 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:42 2023-08-28T18:27:42.391 WARN --- [ asgi_gw_2] l.s.route53.provider : UPSERT
2023-08-28 20:27:42 2023-08-28T18:27:42.391 ERROR --- [ asgi_gw_2] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:42 2023-08-28T18:27:42.392 INFO --- [ asgi_gw_2] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:43 2023-08-28T18:27:43.573 WARN --- [ asgi_gw_3] l.s.route53.provider : UPSERT
2023-08-28 20:27:43 2023-08-28T18:27:43.573 ERROR --- [ asgi_gw_3] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:43 2023-08-28T18:27:43.573 INFO --- [ asgi_gw_3] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:27:50 2023-08-28T18:27:50.441 WARN --- [ asgi_gw_5] l.s.route53.provider : UPSERT
2023-08-28 20:27:50 2023-08-28T18:27:50.442 ERROR --- [ asgi_gw_5] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:27:50 2023-08-28T18:27:50.443 INFO --- [ asgi_gw_5] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:28:04 2023-08-28T18:28:04.355 WARN --- [ asgi_gw_10] l.s.route53.provider : UPSERT
2023-08-28 20:28:04 2023-08-28T18:28:04.355 ERROR --- [ asgi_gw_10] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:28:04 2023-08-28T18:28:04.356 INFO --- [ asgi_gw_10] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:28:34 2023-08-28T18:28:34.052 WARN --- [ asgi_gw_5] l.s.route53.provider : UPSERT
2023-08-28 20:28:34 2023-08-28T18:28:34.053 ERROR --- [ asgi_gw_5] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:28:34 2023-08-28T18:28:34.056 INFO --- [ asgi_gw_5] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:29:05 2023-08-28T18:29:05.908 WARN --- [ asgi_gw_3] l.s.route53.provider : UPSERT
2023-08-28 20:29:05 2023-08-28T18:29:05.910 ERROR --- [ asgi_gw_3] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:29:05 2023-08-28T18:29:05.912 INFO --- [ asgi_gw_3] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
2023-08-28 20:29:11 2023-08-28T18:29:11.757 WARN --- [ asgi_gw_8] l.s.route53.provider : UPSERT
2023-08-28 20:29:11 2023-08-28T18:29:11.757 ERROR --- [ asgi_gw_8] l.aws.handlers.logging : exception during call chain: ('Could not find entry %s for name %s in zones', TargetRecord(target='_c9edd76ee4a0e2a74388032f3861cc50.ykybfrwcxw.acm-validations.aws.', record_type=<RecordType.CNAME: 3>, record_id=None), '_d930b28be6c5927595552b219965053e.localstack.example.com.')
2023-08-28 20:29:11 2023-08-28T18:29:11.758 INFO --- [ asgi_gw_8] localstack.request.aws : AWS route53.ChangeResourceRecordSets => 500 (InternalError)
Please let me know if you need anything else from me. I’d be happy to provide it.
Thanks