Closed adarobin closed 1 month ago
Hi, Seems like we've added the support for this attribute only from v4.2.0 and above in both create and update.
I'm not sure why it does work with update but not on create - I expect this to be consistent (either work or not work for both transactions). @wsquan171 might be able to elaborate further.
BTW @adarobin which version of NSX is in use?
Hi @ksamoray, this is my non-prod environment which is currently on 4.1.2.3
Just looking at the documentation, it was not apparent that this was for 4.2.x and newer only. It does seem to work aside from this issue.
Most likely this is due to setting the tf state visibility attr from the value read back from NSX after resource creation regardless of NSX version: https://github.com/vmware/terraform-provider-nsxt/blob/master/nsxt/resource_nsxt_policy_ip_block.go#L95 Since the value is left out in the create call, tf plan will find a diff on this field for update.
Thanks @wsquan171 - so this attribute won't be applied also during update in that case.
@ksamoray Yes. It won't be sent to NSX on either create or update. I think aside from ip block we have other resources sliently leave out params if NSX version is not met. For all the cases it will show up as diff after apply. Should we add version checks on read and avoid setting nil values to tf state, and only maybe log a warning that some fields are ignored?
Describe the bug
If you create a
nsxt_policy_ip_block
resource with thevisibility
attribute set, the value does not seem to be set on the initial creation. If you do a plan after creating the resource, you will see an update to set thevisibility
attribute.Reproduction steps
nsxt_policy_ip_block
resource with thevisibility
attribute set.visibility
attribute is needed.Expected behavior
The value of
visibility
is set when the resource is initially created and a second plan and apply is not needed.Additional context
No response