Skip to content

Commit

Permalink
Update azurerm_windows_virtual_machine - Default value of `patch_mo…
Browse files Browse the repository at this point in the history
…de` no longer requires feature enabling (#9432)
  • Loading branch information
ArcturusZhang authored Nov 26, 2020
1 parent 6027859 commit 50714cc
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,6 @@ func resourceWindowsVirtualMachineCreate(d *schema.ResourceData, meta interface{
ProvisionVMAgent: utils.Bool(provisionVMAgent),
EnableAutomaticUpdates: utils.Bool(enableAutomaticUpdates),
WinRM: winRmListeners,
PatchSettings: &compute.PatchSettings{
PatchMode: compute.InGuestPatchMode(d.Get("patch_mode").(string)),
},
},
Secrets: secrets,
},
Expand Down Expand Up @@ -454,6 +451,13 @@ func resourceWindowsVirtualMachineCreate(d *schema.ResourceData, meta interface{
params.OsProfile.WindowsConfiguration.AdditionalUnattendContent = additionalUnattendContent
}

patchMode := d.Get("patch_mode").(string)
if patchMode != string(compute.AutomaticByOS) {
params.OsProfile.WindowsConfiguration.PatchSettings = &compute.PatchSettings{
PatchMode: compute.InGuestPatchMode(patchMode),
}
}

if v, ok := d.GetOk("availability_set_id"); ok {
params.AvailabilitySet = &compute.SubResource{
ID: utils.String(v.(string)),
Expand Down

0 comments on commit 50714cc

Please sign in to comment.