Amazon web services 用于ACM证书验证的动态路由53记录
我有一个Route 53区域(example.org)和一些记录集(example.org,sub1.example.org)。我还有一个ACM证书,其中包含记录集描述的域的DNS验证。 所有这些都是在地形中描述的。 目前,为了使验证生效,我必须列出证书中的所有域名(Amazon web services 用于ACM证书验证的动态路由53记录,amazon-web-services,terraform,terraform-provider-aws,Amazon Web Services,Terraform,Terraform Provider Aws,我有一个Route 53区域(example.org)和一些记录集(example.org,sub1.example.org)。我还有一个ACM证书,其中包含记录集描述的域的DNS验证。 所有这些都是在地形中描述的。 目前,为了使验证生效,我必须列出证书中的所有域名(domain\u name,subject\u alternative\u name),证书验证(validation\u record\u fqdns),以及路由53记录(aws\u route53\u record参考资料)。
domain\u name
,subject\u alternative\u name
),证书验证(validation\u record\u fqdns
),以及路由53记录(aws\u route53\u record
参考资料)。
如果我想添加一个新的子域,我只需要在一个地方添加,有没有更好、更动态的方法?
我阅读了Terraform最新版本中的for
和for_每个
功能,但到目前为止,在这种情况下使用这些功能对我来说并不简单
resource "aws_acm_certificate" "example" {
domain_name = "example.org"
subject_alternative_names = ["sub1.example.org"]
validation_method = "DNS"
}
resource "aws_acm_certificate_validation" "example" {
certificate_arn = "${aws_acm_certificate.example.arn}"
validation_record_fqdns = ["${aws_route53_record.example-validation.fqdn}", "${aws_route53_record.example-validation-sub1.fqdn}"]
}
resource "aws_route53_record" "example-validation" {
zone_id = "${data.aws_route53_zone.example.id}"
name = "${aws_acm_certificate.example.domain_validation_options.0.resource_record_name}"
type = "${aws_acm_certificate.example.domain_validation_options.0.resource_record_type}"
ttl = 60
records = ["${aws_acm_certificate.example.domain_validation_options.0.resource_record_value}"]
}
resource "aws_route53_record" "example-validation-sub1" {
zone_id = "${data.aws_route53_zone.example.id}"
name = "${aws_acm_certificate.example.domain_validation_options.1.resource_record_name}"
type = "${aws_acm_certificate.example.domain_validation_options.1.resource_record_type}"
ttl = 60
records = ["${aws_acm_certificate.example.domain_validation_options.1.resource_record_value}"]
}