Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update TTL on weighted route53 aws_route53_record resources #16389

Closed
dunka opened this issue Oct 18, 2017 · 2 comments
Closed

Unable to update TTL on weighted route53 aws_route53_record resources #16389

dunka opened this issue Oct 18, 2017 · 2 comments

Comments

@dunka
Copy link

dunka commented Oct 18, 2017

Hello!

When trying to update the ttl on a weighted record, we get " RRSet with DNS name repo.wtest.com. and type CNAME, SetIdentifier live cannot be created as weighted sets must contain the same TTL."

I believe the work around will be to remove one of the records, update the TTL, then recreate both.

This can be produced by taking the example from https://www.terraform.io/docs/providers/aws/r/route53_record.html applying it, then changing the ttl and applying again.

terraform -v
Terraform v0.10.7

repo:

Original:

provider "aws" {
    region  = "us-west-2"
}

resource "aws_route53_record" "dns" {
  zone_id  = "${var.r53_zone_id}"
  name     = "repo.wtest.com"
  type     = "CNAME"
  ttl      = "300"

  weighted_routing_policy {
    weight = 99
  }

  set_identifier = "live"
  records        = ["wtest1.wtest.com"]
}

resource "aws_route53_record" "dns-canary" {
  zone_id  = "${var.r53_zone_id}"
  name     = "repo.wtest.com"
  type     = "CNAME"
  ttl      = "300"

  weighted_routing_policy {
    weight = 1
  }

  set_identifier = "canary"
  records        = ["wtest2.wtest.com"]
}

$ terraform init

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "aws" (1.1.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.aws: version = "~> 1.1"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

$ terraform plan

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + aws_route53_record.dns
      id:                               <computed>
      fqdn:                             <computed>
      name:                             "repo.wtest.com"
      records.#:                        "1"
      records.3989897057:               "wtest1.wtest.com"
      set_identifier:                   "live"
      ttl:                              "300"
      type:                             "CNAME"
      weighted_routing_policy.#:        "1"
      weighted_routing_policy.0.weight: "99"
      zone_id:                          "ZMNK49HC1KU29"

  + aws_route53_record.dns-canary
      id:                               <computed>
      fqdn:                             <computed>
      name:                             "repo.wtest.com"
      records.#:                        "1"
      records.1949473120:               "wtest2.wtest.com"
      set_identifier:                   "canary"
      ttl:                              "300"
      type:                             "CNAME"
      weighted_routing_policy.#:        "1"
      weighted_routing_policy.0.weight: "1"
      zone_id:                          "ZMNK49HC1KU29"


Plan: 2 to add, 0 to change, 0 to destroy.

$ terraform apply

aws_route53_record.dns: Creating...
  fqdn:                             "" => "<computed>"
  name:                             "" => "repo.wtest.com"
  records.#:                        "" => "1"
  records.3989897057:               "" => "wtest1.wtest.com"
  set_identifier:                   "" => "live"
  ttl:                              "" => "300"
  type:                             "" => "CNAME"
  weighted_routing_policy.#:        "" => "1"
  weighted_routing_policy.0.weight: "" => "99"
  zone_id:                          "" => "ZMNK49HC1KU29"
aws_route53_record.dns-canary: Creating...
  fqdn:                             "" => "<computed>"
  name:                             "" => "repo.wtest.com"
  records.#:                        "" => "1"
  records.1949473120:               "" => "wtest2.wtest.com"
  set_identifier:                   "" => "canary"
  ttl:                              "" => "300"
  type:                             "" => "CNAME"
  weighted_routing_policy.#:        "" => "1"
  weighted_routing_policy.0.weight: "" => "1"
  zone_id:                          "" => "ZMNK49HC1KU29"
aws_route53_record.dns-canary: Still creating... (10s elapsed)
aws_route53_record.dns: Still creating... (10s elapsed)
aws_route53_record.dns-canary: Still creating... (20s elapsed)
aws_route53_record.dns: Still creating... (20s elapsed)
aws_route53_record.dns-canary: Still creating... (30s elapsed)
aws_route53_record.dns: Still creating... (30s elapsed)
aws_route53_record.dns: Still creating... (40s elapsed)
aws_route53_record.dns-canary: Still creating... (40s elapsed)
aws_route53_record.dns-canary: Creation complete after 47s (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_canary)
aws_route53_record.dns: Creation complete after 48s (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_live)

Change the ttl to 60, new terraform:

provider "aws" {
    region  = "us-west-2"
}

resource "aws_route53_record" "dns" {
  zone_id  = "${var.r53_zone_id}"
  name     = "repo.wtest.com"
  type     = "CNAME"
  ttl      = "60"

  weighted_routing_policy {
    weight = 99
  }

  set_identifier = "live"
  records        = ["wtest1.wtest.com"]
}

resource "aws_route53_record" "dns-canary" {
  zone_id  = "${var.r53_zone_id}"
  name     = "repo.wtest.com"
  type     = "CNAME"
  ttl      = "60"

  weighted_routing_policy {
    weight = 1
  }

  set_identifier = "canary"
  records        = ["wtest2.wtest.com"]
}

$ terraform plan

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_route53_record.dns: Refreshing state... (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_live)
aws_route53_record.dns-canary: Refreshing state... (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_canary)

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ aws_route53_record.dns
      ttl: "300" => "60"

  ~ aws_route53_record.dns-canary
      ttl: "300" => "60"


Plan: 0 to add, 2 to change, 0 to destroy.

$ terraform apply

aws_route53_record.dns-canary: Refreshing state... (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_canary)
aws_route53_record.dns: Refreshing state... (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_live)
aws_route53_record.dns-canary: Modifying... (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_canary)
  ttl: "300" => "60"
aws_route53_record.dns: Modifying... (ID: ZMNK49HC1KU29_repo.wtest.com_CNAME_live)
  ttl: "300" => "60"
Error applying plan:

2 error(s) occurred:

* aws_route53_record.dns-canary: 1 error(s) occurred:

* aws_route53_record.dns-canary: [ERR]: Error building changeset: InvalidChangeBatch: RRSet with DNS name repo.wtest.com. and type CNAME, SetIdentifier canary cannot be created as weighted sets must contain the same TTL.
	status code: 400, request id: d1c7083e-b429-11e7-988f-49557008bbb1
* aws_route53_record.dns: 1 error(s) occurred:

* aws_route53_record.dns: [ERR]: Error building changeset: InvalidChangeBatch: RRSet with DNS name repo.wtest.com. and type CNAME, SetIdentifier live cannot be created as weighted sets must contain the same TTL.
	status code: 400, request id: d1d5d48f-b429-11e7-8c55-4f8351d87dd9

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Let me know if you need any further information.

@hashibot
Copy link
Contributor

This issue has been automatically migrated to hashicorp/terraform-provider-aws#1961 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@ghost
Copy link

ghost commented Apr 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants