Skip to content

Commit

Permalink
used getOk for cloud_init_cdrom_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickstruyf3 committed Jan 27, 2021
1 parent 2c306e4 commit 768ffd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,6 @@ func resourceNutanixVirtualMachineCreate(d *schema.ResourceData, meta interface{
}

func resourceNutanixVirtualMachineRead(d *schema.ResourceData, meta interface{}) error {
initialDiskList := d.Get("disk_list")
cloudInitCDromUUID := d.Get("cloud_init_cdrom_uuid")
// Get client connection
conn := meta.(*Client).API
setVMTimeout(meta)
Expand Down
6 changes: 4 additions & 2 deletions nutanix/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ func getDeviceIndexForDisk(disk *v3.VMDisk) (*int64, error) {
func flattenDiskListFilterCloudInit(d *schema.ResourceData, disks []*v3.VMDisk) ([]map[string]interface{}, error) {
//todo check if guestcust is passed -> if it is not passed, just continue without searching for cloud-init uuid
// reason: no device_index or disk id will result in crash
cloudInitCdromUUIDInput := d.Get("cloud_init_cdrom_uuid")
cloudInitCdromUUID := cloudInitCdromUUIDInput.(string)
cloudInitCdromUUID := ""
if cloudInitCdromUUIDInput, cliOk := d.GetOk("cloud_init_cdrom_uuid"); cliOk {
cloudInitCdromUUID = cloudInitCdromUUIDInput.(string)
}
filteredDiskList := disks
potentialCloudInitIDs := make([]string, 0)
if cloudInitCdromUUID == "" && usesGuestCustomization(d) {
Expand Down

0 comments on commit 768ffd4

Please sign in to comment.