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

Provider ignores records if values are learned at apply time. #4

Open
envy opened this issue May 3, 2021 · 2 comments
Open

Provider ignores records if values are learned at apply time. #4

envy opened this issue May 3, 2021 · 2 comments

Comments

@envy
Copy link

envy commented May 3, 2021

When creating a new DNS rrset which records depend on other new resources, terraform fails with:

Error: Provider produced inconsistent final plan

When expanding the plan for desec_rrset.test to include new
values learned so far during apply, provider
"registry.terraform.io/valodim/desec" produced an invalid new value for
.records: was null, but now
cty.SetVal([]cty.Value{cty.StringVal("1.2.3.4")}).

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Config:

resource "desec_rrset" "test" {
  domain = "domain.tld"
  subname = "test"
  type = "A"
  records = [some.other.new.resource.ip]
  ttl = 3600
}

Terraform shows the following plan:

Terraform will perform the following actions:

  # desec_rrset.test will be created
  + resource "desec_rrset" "test" {
      + created = (known after apply)
      + domain  = "domain.tld"
      + id      = (known after apply)
      + name    = (known after apply)
      + subname = "test"
      + ttl     = 3600
      + type    = "A"
    }

The records array is missing and causing the error, I think it should look something like this: records = [(known after apply)]

When invoking terraform apply after the error again, the other resource already exists and terraform shows this plan:

Terraform will perform the following actions:

  # desec_rrset.test will be created
  + resource "desec_rrset" "test" {
      + created = (known after apply)
      + domain  = "domain.tld"
      + id      = (known after apply)
      + name    = (known after apply)
      + records = [
          + "1.2.3.4",
        ]
      + subname = "test"
      + ttl     = 3600
      + type    = "A"
    }

Applying now works fine.

@PeterSR
Copy link

PeterSR commented Oct 7, 2021

I just experienced the same error when trying to add a CNAME for one record to another using

resource "desec_rrset" "star" {
  domain = desec_domain.<other domain>.name
  subname = "*"
  type = "CNAME"
  records = [desec_rrset.<other record>.name]
  ttl = 3600
}

@chr1stus
Copy link

chr1stus commented Nov 1, 2023

Hi.
If my analysis is correct, this is because the new value is of a new ressource and the (legacy) SDK cannot handle this situation:
hashicorp/terraform-plugin-sdk#165

Deactivating following function helped me, but I cannot oversee possible pitfalls:

DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {

Hope this helps someone with more insights!
-- Chris

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

No branches or pull requests

3 participants