-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Use CustomizeDiff to infer the provider default values #11339
Comments
Thanks Riley - that would be super helpful! |
Maybe related: #5761? |
Note: the actual change (or changing just generated resources) is likely size/s or size/m, but applying to all resources makes this size/xl |
closed with GoogleCloudPlatform/magic-modules#8569 This will release with v5.0.0. Check #15582 for more details on the major release. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Affected Resource(s)
Community Note
The provider default project (
project
field) is substituted in for resources whoseproject
field is empty at apply time across the provider using thegetProject
method, which checks state and then the provider config for the project. Theconfig
object holding provider configuration was only available at apply time, historically, but that's not true withCustomizeDiff
around nowadays. We could, presumably, implement a standardisedCustomizeDiff
for all project-level resources, and determine the final value of theproject
field (andzone
+region
) at plan time. Given a config like the following:Our provider would go from the following
terraform plan
on creation:To the following:
Additionally, we could return a plan-time error when the value is not set.
Note that the current behaviour where the project value is "sticky" was originally due to not having enough information at plan time. We could preserve the existing behaviour by only rewriting the new state to the provider project when both old and new state are empty, and eliminate the behaviour by rewriting whenever new is empty. That's clearly a breaking change, however, I feel that adding the plan-time display+error likely counts as one as well.
In short, I think we could use CustomizeDiff to improve our handling of default projects (but it would be a breaking change to do either of these):
Also, as a note: we'd need to check for unknown values in CustomizeDiff! CD does not protect against them by default, in contrast to other schema functions, and unknown values appear to be empty without special handling.
The text was updated successfully, but these errors were encountered: