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

Bugfix: Error creating VM with private IP in DTL. #3704

Closed
wants to merge 10 commits into from
5 changes: 4 additions & 1 deletion azurerm/resource_arm_dev_test_linux_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func resourceArmDevTestLinuxVirtualMachineCreateUpdate(d *schema.ResourceData, m
GalleryImageReference: galleryImageReference,
LabSubnetName: utils.String(labSubnetName),
LabVirtualNetworkID: utils.String(labVirtualNetworkId),
NetworkInterface: &nic,
OsType: utils.String("Linux"),
Notes: utils.String(notes),
Password: utils.String(password),
Expand All @@ -207,6 +206,10 @@ func resourceArmDevTestLinuxVirtualMachineCreateUpdate(d *schema.ResourceData, m
Tags: expandTags(tags),
}

if len(natRules) > 0 {
parameters.LabVirtualMachineProperties.NetworkInterface = &nic
}

future, err := client.CreateOrUpdate(ctx, resourceGroup, labName, name, parameters)
if err != nil {
return fmt.Errorf("Error creating/updating DevTest Linux Virtual Machine %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err)
Expand Down
5 changes: 4 additions & 1 deletion azurerm/resource_arm_dev_test_windows_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ func resourceArmDevTestWindowsVirtualMachineCreateUpdate(d *schema.ResourceData,
GalleryImageReference: galleryImageReference,
LabSubnetName: utils.String(labSubnetName),
LabVirtualNetworkID: utils.String(labVirtualNetworkId),
NetworkInterface: &nic,
OsType: utils.String("Windows"),
Notes: utils.String(notes),
Password: utils.String(password),
Expand All @@ -196,6 +195,10 @@ func resourceArmDevTestWindowsVirtualMachineCreateUpdate(d *schema.ResourceData,
Tags: expandTags(tags),
}

if len(natRules) > 0 {
parameters.LabVirtualMachineProperties.NetworkInterface = &nic
}

future, err := client.CreateOrUpdate(ctx, resourceGroup, labName, name, parameters)
if err != nil {
return fmt.Errorf("Error creating/updating DevTest Windows Virtual Machine %q (Lab %q / Resource Group %q): %+v", name, labName, resourceGroup, err)
Expand Down