ably / terraform-provider-ably

Ably's Terraform Provider, enabling you to manage your Ably account programmatically.
https://registry.terraform.io/providers/ably/ably
Apache License 2.0
11 stars 2 forks source link

Support optional values #86

Closed Morganamilo closed 2 years ago

Morganamilo commented 2 years ago

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.

graham-russell commented 2 years ago

Looking good. The only thing I suggest we add is new push params coverage in the acceptance testing.

Morganamilo commented 2 years ago

Good point, I'll do that.

Morganamilo commented 2 years ago

Yea let's do that.