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

时间:2019-03-13 16:25:40

标签: terraform amazon-route53 acm

执行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.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。',类型='CNAME'],但它已经存在”           状态码:400,请求ID:4f145fdb-45a0-11e9-b0f7-4baff3471f37

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

  

503服务暂时不可用

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

1 个答案:

答案 0 :(得分:0)

2.0之后出现错误(https://github.com/terraform-providers/terraform-provider-aws/issues/7918)似乎是最新的AWS提供商

请使用较旧的版本(例如1.60),并等待修复。

provider "aws" {
  access_key = "${var.access_key}"
  secret_key = "${var.secret_key}"
  region     = "${var.region}"

  version = "~> 1.60"
}