执行terraform plan
时我没有错误,但是当我执行terraform apply
时,我收到以下错误。
Terraform计划输出: -
+ aws_route53_record.alm_route_record1
id: <computed>
allow_overwrite: <computed>
fqdn: <computed>
name: "${aws_acm_certificate.acm.domain_validation_options.0.resource_record_name}"
records.#: <computed>
ttl: "300"
type: "${aws_acm_certificate.acm.domain_validation_options.0.resource_record_type}"
zone_id: "Z2J2U5QM63SJ94"
ACM.台风
resource "aws_acm_certificate" "acm" {
domain_name = “example.com”
validation_method = "DNS"
tags = {
Environment = "${lookup(var.environment, terraform.workspace)}"
ManagedBy = "terraform"
}
}
data "aws_route53_zone" "route_zone" {
name = "example.org."
private_zone = false
}
resource "aws_route53_record" "alm_route_record1" {
name = "${aws_acm_certificate.acm.domain_validation_options.0.resource_record_name}"
type = "${aws_acm_certificate.acm.domain_validation_options.0.resource_record_type}"
zone_id = "${data.aws_route53_zone.route_zone.id}"
records = ["${aws_acm_certificate.acm.domain_validation_options.0.resource_record_value}"]
ttl = 300
}
resource "aws_acm_certificate_validation" "dns_validation" {
certificate_arn = "${aws_acm_certificate.acm.arn}"
validation_record_fqdns = ["${aws_route53_record.alm_route_record1.fqdn}"]
}
错误日志: -
aws_route53_record.alm_route_record1:[错误]:生成变更集时出错:InvalidChangeBatch:[尝试创建资源记录集[name ='_ c12c2dee87ee95f2104e7a94875e5519.ca.tuigroup.com。',type ='CNAME']但已存在]状态码:400 ,请求ID:4f145fdb-45a0-11e9-b0f7-4baff3471f37
点击我的页面的WebURL后显示
503服务暂时不可用
我觉得records
正在接受现有的CNAME
似乎2.0之后最新的aws提供商有bug(https://github.com/terraform-providers/terraform-provider-aws/issues/7918)
请保留旧版本,例如版本1.60
并等待修复。
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
version = "~> 1.60"
}