Skip to content

Commit

Permalink
Skipping state refresh for ngt credentials while reading nutanix_vm.
Browse files Browse the repository at this point in the history
Behaviour: NGT Credentials were listed in plan as additions even after the operation was performed.

Reason: vms/uuid and vms/ API doesn't return NGT credentials as a part of nutanix guest customization. Due to which we were populating empty credentials in the state which caused the diff.
  • Loading branch information
siddharth-nutanix committed Nov 25, 2021
1 parent e21f85a commit 318ce93
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
1 change: 0 additions & 1 deletion nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2603,7 +2603,6 @@ func resourceNutanixVirtualMachineInstanceResourceV0() *schema.Resource {
"ngt_credentials": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
},
"ngt_enabled_capability_list": {
Type: schema.TypeList,
Expand Down
6 changes: 0 additions & 6 deletions nutanix/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,10 @@ func flattenGPUList(gpu []*v3.VMGpuOutputStatus) []map[string]interface{} {

func flattenNutanixGuestTools(d *schema.ResourceData, guest *v3.GuestToolsStatus) error {
nutanixGuestTools := make(map[string]interface{})
ngtCredentials := make(map[string]string)
ngtEnabledCapabilityList := make([]string, 0)

if guest != nil && guest.NutanixGuestTools != nil {
tools := guest.NutanixGuestTools
ngtCredentials = tools.Credentials
ngtEnabledCapabilityList = utils.StringValueSlice(tools.EnabledCapabilityList)

nutanixGuestTools["available_version"] = utils.StringValue(tools.AvailableVersion)
Expand All @@ -318,10 +316,6 @@ func flattenNutanixGuestTools(d *schema.ResourceData, guest *v3.GuestToolsStatus
return err
}

if err := d.Set("ngt_credentials", ngtCredentials); err != nil {
return err
}

if err := d.Set("nutanix_guest_tools", nutanixGuestTools); err != nil {
return err
}
Expand Down

0 comments on commit 318ce93

Please sign in to comment.