Terraform | aws_route53_record |构建变更集时出错:InvalidChangeBatch

问题描述 投票:1回答:1

执行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

terraform amazon-route53 acm
1个回答
0
投票

似乎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"
}
© www.soinside.com 2019 - 2024. All rights reserved.