Open mcarvalhor opened 8 months ago
The provider only keeps track of config which has been changed from the default. Would a better terraform behavior be to remove the key from the config map? If it's been removed, we should reset the value to the default, a la juju config --reset
Note: I'm not sure if that's what we actually do right now.
Hi @hmlanigan! 👋
I agree that not including the key on the config map works as expected; but using null
currently throws the following error:
An unexpected error was encountered trying to build a value. This is always an error in the provider. [...] Received null value, however the target type cannot handle null values.
Probably worth further discussion, but I believe null
should essentially behave the same way as not including the key at all - meaning null
values should be completely ignored, as if they weren't there.
This is the default behavior used by a lot of resources on distinct providers. If not agreed, then at least the error message should be improved (eg.: "null is not supported here").
As an example, I've taken an arbitrarily selected provider and resource to do this same comparison: https://pastebin.ubuntu.com/p/zGfXR9tpHX/
As we can see (^), including "availability_zone = null" and not including anything at all produces the same result in the plan - and applying it also works as expected.
In addition, noticeably this issue is not urgent.
Description
I believe the
config
block forjuju_application
should supportnull
configuration values - indicating unset Juju settings.From Juju's perspective, "" and unset have different meanings.
Please note that Terraform Configuration below is simplified: we are using multiple variables, modules and plans, and therefore option "simply not include unset settings into config block" is not suitable for complex Terraform code.
Urgency
Annoying bug in our test suite
Terraform Juju Provider version
v0.10.1
Terraform version
v1.7.2
Terraform Configuration(s)
Reproduce / Test
Debug/Panic Output
Notes & References
There's no workaround currently: I defined "" as the value for the setting on Terraform code, and then unset that manually after it's applied.