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

Compare cloudflare_record name without the zone name #151

Merged

Conversation

jacobbednarz
Copy link
Member

When importing cloudflare_record resources the name attribute is
trimmed to exclude the domain value. This creates an issue if you
import the resources but use the full the domain as the name attribute
because the Terraform state file will never match what is stored and
will result in continuious changes wanting to be applied.

After a brief discussion on the issue, it was decided that instead of
limiting to what can be passed into the name attribute, we should use
a DiffSuppressFunc that will allow the partial labels and full FQDNs
to work by trimming the zone name as a part of the comparison. This will
be the least amount of friction and maintain full backwards
compatibility.

Fixes #148.

When importing `cloudflare_record` resources the `name` attribute is
trimmed[1] to exclude the `domain` value. This creates an issue if you
import the resources but use the full the domain as the `name` attribute
because the Terraform state file will never match what is stored and
will result in continuious changes wanting to be applied.

After a brief discussion on the issue[2], it was decided that instead of
limiting to what can be passed into the `name` attribute, we should use
a `DiffSuppressFunc` that will allow the partial labels and full FQDNs
to work by trimming the zone name as a part of the comparison. This will
be the least amount of friction and maintain full backwards
compatibility.

Fixes #148.

[1]: https://github.com/terraform-providers/terraform-provider-cloudflare/blob/ef8e9abfdb12bfd200520771792089c2a7129af0/cloudflare/resource_cloudflare_record.go#L513
[2]: https://github.com/terraform-providers/terraform-provider-cloudflare/issues/148#issuecomment-438507279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants