In the kubernetes_persistent_volume_claim
resource, the spec.storage_class_name
means different things if it’s unset or null
, and when it’s set to ""
.
As I explained here, there is no way in the Terraform SDK that I know of to differentiate this during apply time.
Is there any way to support both null
and ""
values in a single attribute in a single resource?
The type system in TF core (and over the wire) does differentiate between null, empty (and unknown, in the context of plan), but the existing SDK does not. Until we surface the new type system in the SDK (which the work on version 2 is meant to lay the groundwork for), it will be hard to differentiate these easily.
Thanks for your reply. I guess for now we will have to use a workaround to surface this feature in the resource.
In some cases you can use a default sentinel or logical value (ie. “auto”, -1, etc), would probably look awkward in diffs in some cases though depending on how its implemented.
Thanks for the suggestion. Not sure if the maintainer would like to use sentinel values to handle ""
. The default should be null
.