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

digitalocean_record ttl seems not to be idempotent #1012

Closed
niklasweimann opened this issue Jul 18, 2023 · 5 comments
Closed

digitalocean_record ttl seems not to be idempotent #1012

niklasweimann opened this issue Jul 18, 2023 · 5 comments
Labels

Comments

@niklasweimann
Copy link

Bug Report

Describe the bug

When there are two TXT for a single Domain with different TTLs the TTL for the individual records is not preserved instead it seems to pick the TTL of the record which is handled first. So with each run the TTL is toggled.

Affected Resource(s)

  • digitalocean_record

Expected Behavior

When the TTL of one record is set to 60 and the TTL of another record to 1800, i want the records to keep the TTL after applying.

Actual Behavior

One record looses its TTL and both records get the same TTL assigned.

Steps to Reproduce

  1. Create two record ressources like so:
resource "digitalocean_record" "test_txt_1" {
  domain   = digitalocean_domain.example_com.name
  type     = "TXT"
  name     = "@"
  value    = "1"
  ttl      = 60
}

resource "digitalocean_record" "test_txt_2" {
  domain   = digitalocean_domain.example_com.name
  type     = "TXT"
  name     = "@"
  value    = "2"
  ttl      = 1800
}
  1. Apply the Terraform

  2. Go to the Web UI and find the following records:

    1. Screenshot 2023-07-18 at 14 07 36
  3. Rerun the Plan and Apply the plan looks like this:

    1. Screenshot 2023-07-18 at 14 08 13
  4. Go to the Web UI and find the following records:

    1. Screenshot 2023-07-18 at 14 08 40

Terraform version
1.5.3

@danaelhe
Copy link
Member

Hi @niklasweimann ,

Thank you for your detailed write up. This is actually expected behavior of our API as it follows the "Clarifications to the DNS Specification" RFC recommendations. Per the RFC, when you have multiple records for the same fqdn, they are expected to have the same TTL. For reference, see rfc2181, section 5.2: https://www.rfc-editor.org/rfc/rfc2181#section-5.

@danaelhe
Copy link
Member

I'm going to close this. Please create another issue if you have any other concerns/questions, thank you so much!

@DanRStevens
Copy link

It seems like mismatched TTLs in Resource Record Sets should produce some kind of warning. It's very confusing behaviour otherwise. If the code is able to set all records to the same TTL, surely it should be easy to add a warning in that case, and perhaps even list the affected records.

@danaelhe
Copy link
Member

danaelhe commented May 16, 2024

multiple records for the same fqdn, they are expected to have the same TTL

I like it! Thanks for offering this feedback, I've created PR #1157 implementing your suggestion 🚀

@DanRStevens
Copy link

Wow, that was fast. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants