Skip to content

Commit

Permalink
Bug Fix: Fix crash in azurerm_virtual_machine (#5413)
Browse files Browse the repository at this point in the history
Fixes #5401
  • Loading branch information
mbfrahry authored and katbyte committed Jan 22, 2020
1 parent fde9018 commit 3aa3844
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions azurerm/internal/services/compute/resource_arm_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ func resourceArmVirtualMachine() *schema.Resource {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validate.NoEmptyStrings,
},
},

Expand Down Expand Up @@ -1799,16 +1800,18 @@ func expandAzureRmVirtualMachineNetworkProfile(d *schema.ResourceData) compute.N
network_profile := compute.NetworkProfile{}

for _, nic := range nicIds {
id := nic.(string)
primary := id == primaryNicId

network_interface := compute.NetworkInterfaceReference{
ID: &id,
NetworkInterfaceReferenceProperties: &compute.NetworkInterfaceReferenceProperties{
Primary: &primary,
},
if nic != nil {
id := nic.(string)
primary := id == primaryNicId

network_interface := compute.NetworkInterfaceReference{
ID: &id,
NetworkInterfaceReferenceProperties: &compute.NetworkInterfaceReferenceProperties{
Primary: &primary,
},
}
network_interfaces = append(network_interfaces, network_interface)
}
network_interfaces = append(network_interfaces, network_interface)
}

network_profile.NetworkInterfaces = &network_interfaces
Expand Down

0 comments on commit 3aa3844

Please sign in to comment.