vmware / terraform-provider-nsxt

Terraform VMware NSX-T provider
https://www.terraform.io/docs/providers/nsxt/
Other
123 stars 80 forks source link

Fix set IP block visibility on READ if NSX version too low #1228

Closed wsquan171 closed 1 month ago

wsquan171 commented 1 month ago

This change fixes setting policy IP block visibility on READ if NSX is below 4.2, where the value will always be nil. This will cause tf to always show diff if the resource spec has non-empty value.

Closes #1227

ksamoray commented 1 month ago

LGTM, would like @annakhm to have a look as well as this behavior is not consistent throughout the provider code. Maybe we could at least warn that this attribute has been ignored?

annakhm commented 1 month ago

What happens in NSX 4.2 if this setting is unspecified? Does NSX send back a default?

wsquan171 commented 1 month ago

@annakhm this param is unknown to NSX < 4.2. On read it will be empty value, and if included on write it will error.

annakhm commented 1 month ago

@annakhm this param is unknown to NSX < 4.2. On read it will be empty value, and if included on write it will error.

My question was for NSX 4.2. This param is optional, so user can skip it. However, for such enumerations NSX would normally send back a default (not always though). I wanted to verify we don't need to set this param as Computed for NSX 4.2, regardless of earlier version

wsquan171 commented 1 month ago

I wanted to verify we don't need to set this param as Computed for NSX 4.2, regardless of earlier version

For NSX 4.2, if the value is unset, NSX will send back as-is (also unset). This doesn't need to be computed.