Optional Resource fields are not optional?

Hi @abitrolly,

In practice there isn’t really a sense of a value not being set at all. As I mentioned before, omitting an optional argument just means that the provider chooses a default value for you, not that the argument is totally unset. The provider might choose null as the default value and might then decide that null means to omit the value when making the resulting API request, but that’s a provider implementation detail and not something represented in the Terraform language itself.

Consequently, there isn’t any way for ignore_changes to behave differently depending on whether or not you set the value, because from the perspective of the Terraform language the value is always set, just sometimes set by the provider rather than by the configuration. In both cases, ignore_changes causes Terraform to ignore what’s written in the configuration (and writing nothing is still a specific statement that you want to use the default) after the object is first created, always retaining what’s saved in the state.