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 #1961

Closed
hashibot opened this issue Oct 19, 2017 · 7 comments
Closed
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@hashibot
Copy link

This issue was originally opened by @dunka as hashicorp/terraform#16389. It was migrated here as a result of the provider split. The original body of the issue is below.


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.

@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Oct 23, 2017
@bflad bflad added the service/route53 Issues and PRs that pertain to the route53 service. label Jan 19, 2018
@kagkarlsson
Copy link

+1

@yeukhon
Copy link

yeukhon commented Aug 2, 2018

hashicorp/terraform#5312

@xaf
Copy link

xaf commented Mar 10, 2020

Still an issue.

@vladget
Copy link

vladget commented Sep 24, 2020

Still affected. Any workaround here?
terraform --version
Terraform v0.12.28

  • provider.aws v2.68.0

@xaf
Copy link

xaf commented Sep 24, 2020

This probably would require an API change to consider that any TTL change on a given record would change all identical records to use that same TTL, instead of raising an error because other records have a different TTL. Basically, what the UI does.

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Sep 14, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

7 participants