Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: Fix crash in azurerm_virtual_machine #5413

Merged
merged 5 commits into from
Jan 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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