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

cannot import cloudflare_record without introducing changes to the state afterwards. #3982

Closed
3 tasks done
infakt-ps opened this issue Sep 12, 2024 · 7 comments
Closed
3 tasks done
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@infakt-ps
Copy link

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.9.5

Affected resource(s)

cloudflare_record

Terraform configuration files

resource "cloudflare_record" "dns_record" {
  for_each = var.dns_records
  zone_id  = cloudflare_zone.zone.id
  name     = each.value.name
  content  = each.value.content
  priority = try(each.value.priority, null)
  ttl      = try(each.value.ttl, null)
  type     = each.value.type
  proxied  = coalesce(try(each.value.proxied, null), false)
  comment  = try(each.value.comment, null)
}

```hcl
dns_records:
  - name: example
    content: example.acm-validations.aws
    type: CNAME


### Link to debug output

https://gist.github.com/infakt-ps/e6571e5e6f058f9ab25a2bfab0e8d327

### Panic output

_No response_

### Expected output

```hcl
No changes. Your infrastructure matches the configuration.

Actual output

  # cloudflare_record.dns_record["example"] will be updated in-place
  ~ resource "cloudflare_record" "dns_record" {
      + allow_overwrite = false
      + content         = "example.acm-validations.aws"
        id              = "841fff164e70462e787b6ac34131b5a8"
        name            = "example"
        tags            = []
        # (10 unchanged attributes hidden)
    }
    ```

### Steps to reproduce

1. import resource 
2. terraform plan 
3. output of the plan will want to add content field regardless if its present in the config , same behavior is present when using "value" field

### Additional factoids

I've put placeholder in log output as i dont have time to retract sensitive information

### References

_No response_
@infakt-ps infakt-ps added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 12, 2024
Copy link
Contributor

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

Copy link
Contributor

Thank you for reporting this issue! For maintainers to dig into issues it is required that all issues include the entirety of TF_LOG=DEBUG output to be provided. The only parts that should be redacted are your user credentials in the X-Auth-Key, X-Auth-Email and Authorization HTTP headers. Details such as zone or account identifiers are not considered sensitive but can be redacted if you are very cautious. This log file provides additional context from Terraform, the provider and the Cloudflare API that helps in debugging issues. Without it, maintainers are very limited in what they can do and may hamper diagnosis efforts.

This issue has been marked with triage/needs-information and is unlikely to receive maintainer attention until the log file is provided making this a complete bug report.

@github-actions github-actions bot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 12, 2024
@fawal1
Copy link

fawal1 commented Sep 19, 2024

I am experiencing the same issue here. Was this fix pushed? Curious to know which version to expect this to be released. Currently using v4.42 of the provider

@fawal1
Copy link

fawal1 commented Sep 19, 2024

@infakt-ps didnt realize you closed your own issue. did you find a resolution to this?

@infakt-ps
Copy link
Author

infakt-ps commented Sep 23, 2024

@fawal1 I didn't resolve the issue, just applied the changes to fix the Terraform state after double-checking that nothing would break. I closed the issue because I didn't have time to clean up the Terraform logs from sensitive data. Additionally, the fact that I was using Terragrunt could make this issue to be ignored by devs as the debugging process would be harder.

@cvanwijck-hub24
Copy link

This bug persists in versions 4.41, 4.42 and 4.43. Rolling back to 4.40 resolves the issue for now.

The content and allow_overwrite parameters are null in the statefile despite having values when getting data from the API.

@alibaig1996
Copy link

Still unresolved as of version 4.44. I also reverted back to 4.40 to get it to work. thanks @cvanwijck-hub24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants