There's three things done in this commit to support optional values.
First is to also set computed on some of the optional vlaues. Setting
a field to optional and computed tells terriform that the value may come
back with a non null value after apply.
Second is to add a plan modifier that will tell terriform what the
default value will be. This is purely a visual change, it just means the
terraform plan will tell you the expected value instead of (known after
apply).
Thirdly is a bit of a special case for strings. When strings are
omitted, they are initialised to the 0 value of empty string. Terraform
does not see this as a null so it throws errors when applying. So we
adjust empty strings to null before feeding the values to terraform.
There's three things done in this commit to support optional values.
First is to also set computed on some of the optional vlaues. Setting a field to optional and computed tells terriform that the value may come back with a non null value after apply.
Second is to add a plan modifier that will tell terriform what the default value will be. This is purely a visual change, it just means the terraform plan will tell you the expected value instead of (known after apply).
Thirdly is a bit of a special case for strings. When strings are omitted, they are initialised to the 0 value of empty string. Terraform does not see this as a null so it throws errors when applying. So we adjust empty strings to null before feeding the values to terraform.