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

Fix Access app domain and self_hosted_domains import #4708

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

veggiedefender
Copy link

@veggiedefender veggiedefender commented Dec 3, 2024

Fixes #4659

For some fields, resourceCloudflareAccessApplicationRead only sets the value if one is already present on the resource. This was introduced in #3340 to fix a bug because domains and self_hosted_domains are kind of computed/optional/conflict-with-each-other in an funny way. But doing this breaks imports because it's the special case where the values are not already present but we still want to set them.

This PR moves all of its logic into a function called resourceCloudflareAccessApplicationReadHelper which has a special mode for importing. The original function is now just a call to the helper, passing in false for "not importing." And when importing, we call the helper directly and pass in true.

I'm not the biggest fan of having a special mode like this, but it's the only solution I can think of (unless the behavior we want can be expressed in terms of normal computed/optional/conflicts properties etc.?)

We'll need to add the || importing to the corresponding part in #4661 as a follow-up to this. And possibly the other fields that check if _, ok := d.GetOk("foo"); ok {

Copy link
Contributor

github-actions bot commented Dec 3, 2024

changelog detected ✅

@veggiedefender
Copy link
Author

Closing this one for now to avoid confusion. I want to work on this a little bit more once #4661 is merged

@jacobbednarz
Copy link
Member

this should be good to reopen and work on now. just remember to update your branch to pull in the latest changes.

@veggiedefender veggiedefender marked this pull request as draft December 4, 2024 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants