【问题标题】:Terraform | aws_route53_record | Error building changeset: InvalidChangeBatch地形 | aws_route53_record |构建变更集时出错:InvalidChangeBatch
【发布时间】:2019-08-04 10:00:43
【问题描述】:

在执行terraform plan 时我没有收到任何错误,但是当我执行terraform apply 时我收到以下错误。

地形规划输出:-

+ 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.tf

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:[ERR]:构建变更集时出错:InvalidChangeBatch:[尝试创建资源记录集 [name='_c12c2dee87ee95f2104e7a94875e5519.ca.tuigroup.com.',type='CNAME'],但它已经存在] 状态码:400,请求ID:4f145fdb-45a0-11e9-b0f7-4baff3471f37

点击我页面的 WebURL 后,它会显示出来

503 服务暂时不可用

我觉得records 正在接受现有的 CNAME

【问题讨论】:

    标签: terraform amazon-route53


    【解决方案1】:

    似乎 2.0 之后的最新 aws 提供程序有错误 (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"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-28
      • 2023-03-13
      • 2018-09-18
      • 2023-01-10
      • 1970-01-01
      • 2020-11-30
      • 2020-12-07
      • 1970-01-01
      相关资源
      最近更新 更多