diff --git a/internal/services/compute/linux_virtual_machine_resource.go b/internal/services/compute/linux_virtual_machine_resource.go index 1d4c1d333ebeb..63e9ce486d37d 100644 --- a/internal/services/compute/linux_virtual_machine_resource.go +++ b/internal/services/compute/linux_virtual_machine_resource.go @@ -295,6 +295,8 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { "tags": tags.Schema(), + "terminate_notification": virtualMachineTerminateNotificationSchema(), + "user_data": { Type: pluginsdk.TypeString, Optional: true, @@ -499,6 +501,10 @@ func resourceLinuxVirtualMachineCreate(d *pluginsdk.ResourceData, meta interface params.VirtualMachineProperties.SecurityProfile.UefiSettings.SecureBootEnabled = utils.Bool(secureBootEnabled.(bool)) } + if v, ok := d.GetOk("terminate_notification"); ok { + params.VirtualMachineProperties.ScheduledEventsProfile = expandVirtualMachineScheduledEventsProfile(v.([]interface{})) + } + if vtpmEnabled, ok := d.GetOk("vtpm_enabled"); ok && vtpmEnabled.(bool) { if params.VirtualMachineProperties.SecurityProfile == nil { params.VirtualMachineProperties.SecurityProfile = &compute.SecurityProfile{} @@ -783,6 +789,12 @@ func resourceLinuxVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} } } + if scheduleProfile := props.ScheduledEventsProfile; scheduleProfile != nil { + if err := d.Set("terminate_notification", flattenVirtualMachineScheduledEventsProfile(scheduleProfile)); err != nil { + return fmt.Errorf("setting `terminate_notification`: %+v", err) + } + } + encryptionAtHostEnabled := false vtpmEnabled := false secureBootEnabled := false @@ -1092,6 +1104,13 @@ func resourceLinuxVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interface update.OsProfile.AllowExtensionOperations = utils.Bool(allowExtensionOperations) } + if d.HasChange("terminate_notification") { + shouldUpdate = true + + notificationRaw := d.Get("terminate_notification").([]interface{}) + update.ScheduledEventsProfile = expandVirtualMachineScheduledEventsProfile(notificationRaw) + } + if d.HasChange("tags") { shouldUpdate = true diff --git a/internal/services/compute/linux_virtual_machine_resource_other_test.go b/internal/services/compute/linux_virtual_machine_resource_other_test.go index aebaeb6a40c41..ecbed9f84370d 100644 --- a/internal/services/compute/linux_virtual_machine_resource_other_test.go +++ b/internal/services/compute/linux_virtual_machine_resource_other_test.go @@ -452,6 +452,66 @@ func TestAccLinuxVirtualMachine_otherTags(t *testing.T) { }) } +func TestAccLinuxVirtualMachine_otherTerminateNotification(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test") + r := LinuxVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + // turn terminate notification on + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("terminate_notification.#").HasValue("1"), + check.That(data.ResourceName).Key("terminate_notification.0.enabled").HasValue("true"), + ), + }, + data.ImportStep("admin_password"), + // turn terminate notification off + { + Config: r.otherTerminateNotification(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("terminate_notification.#").HasValue("1"), + check.That(data.ResourceName).Key("terminate_notification.0.enabled").HasValue("false"), + ), + }, + data.ImportStep("admin_password"), + // turn terminate notification on again + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("terminate_notification.#").HasValue("1"), + check.That(data.ResourceName).Key("terminate_notification.0.enabled").HasValue("true"), + ), + }, + data.ImportStep("admin_password"), + }) +} + +func TestAccLinuxVirtualMachine_otherTerminateNotificationTimeout(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test") + r := LinuxVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherTerminateNotificationTimeout(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + }) +} + func TestAccLinuxVirtualMachine_otherUltraSsdDefault(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test") r := LinuxVirtualMachineResource{} @@ -1772,6 +1832,83 @@ resource "azurerm_linux_virtual_machine" "test" { `, r.template(data), data.RandomInteger) } +func (r LinuxVirtualMachineResource) otherTerminateNotification(data acceptance.TestData, enabled bool) string { + return fmt.Sprintf(` +%s + +resource "azurerm_linux_virtual_machine" "test" { + name = "acctestVM-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + size = "Standard_F2" + admin_username = "adminuser" + network_interface_ids = [ + azurerm_network_interface.test.id, + ] + + admin_ssh_key { + username = "adminuser" + public_key = local.first_public_key + } + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + terminate_notification { + enabled = %t + } +} +`, r.template(data), data.RandomInteger, enabled) +} + +func (r LinuxVirtualMachineResource) otherTerminateNotificationTimeout(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_linux_virtual_machine" "test" { + name = "acctestVM-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + size = "Standard_F2" + admin_username = "adminuser" + network_interface_ids = [ + azurerm_network_interface.test.id, + ] + + admin_ssh_key { + username = "adminuser" + public_key = local.first_public_key + } + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + terminate_notification { + enabled = true + timeout = "PT15M" + } +} +`, r.template(data), data.RandomInteger) +} + func (r LinuxVirtualMachineResource) otherUltraSsd(data acceptance.TestData, ultraSsdEnabled bool) string { return fmt.Sprintf(` %s diff --git a/internal/services/compute/linux_virtual_machine_scale_set_other_resource_test.go b/internal/services/compute/linux_virtual_machine_scale_set_other_resource_test.go index 0196f4e99d88a..b2708146f712e 100644 --- a/internal/services/compute/linux_virtual_machine_scale_set_other_resource_test.go +++ b/internal/services/compute/linux_virtual_machine_scale_set_other_resource_test.go @@ -437,6 +437,28 @@ func TestAccLinuxVirtualMachineScaleSet_otherTerminateNotification(t *testing.T) }) } +func TestAccLinuxVirtualMachineScaleSet_otherTerminateNotificationTimeout(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine_scale_set", "test") + r := LinuxVirtualMachineScaleSetResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherTerminateNotificationTimeout(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + }) +} + func TestAccLinuxVirtualMachineScaleSet_otherAutomaticRepairsPolicy(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine_scale_set", "test") r := LinuxVirtualMachineScaleSetResource{} @@ -1893,6 +1915,53 @@ resource "azurerm_linux_virtual_machine_scale_set" "test" { `, r.template(data), data.RandomInteger, enabled) } +func (r LinuxVirtualMachineScaleSetResource) otherTerminateNotificationTimeout(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_linux_virtual_machine_scale_set" "test" { + name = "acctestvmss-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "Standard_F2" + instances = 1 + admin_username = "adminuser" + admin_password = "P@ssword1234!" + + disable_password_authentication = false + + source_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + os_disk { + disk_size_gb = 30 + storage_account_type = "Standard_LRS" + caching = "ReadWrite" + } + + network_interface { + name = "example" + primary = true + + ip_configuration { + name = "internal" + primary = true + subnet_id = azurerm_subnet.test.id + } + } + + terminate_notification { + enabled = true + timeout = "PT15M" + } +} +`, r.template(data), data.RandomInteger) +} + func (r LinuxVirtualMachineScaleSetResource) otherAutomaticRepairsPolicy(data acceptance.TestData, enabled bool) string { return fmt.Sprintf(` %[1]s diff --git a/internal/services/compute/orchestrated_virtual_machine_scale_set.go b/internal/services/compute/orchestrated_virtual_machine_scale_set.go index e5d0df1ee5d72..07a5c21d65c4b 100644 --- a/internal/services/compute/orchestrated_virtual_machine_scale_set.go +++ b/internal/services/compute/orchestrated_virtual_machine_scale_set.go @@ -626,7 +626,7 @@ func OrchestratedVirtualMachineScaleSetTerminateNotificationSchema() *pluginsdk. "timeout": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: azValidate.ISO8601Duration, + ValidateFunc: azValidate.ISO8601DurationBetween("PT5M", "PT15M"), Default: "PT5M", }, }, diff --git a/internal/services/compute/virtual_machine.go b/internal/services/compute/virtual_machine.go index 24d1294df434c..228888866f935 100644 --- a/internal/services/compute/virtual_machine.go +++ b/internal/services/compute/virtual_machine.go @@ -5,6 +5,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -349,3 +350,69 @@ func flattenVirtualMachineOSDisk(ctx context.Context, disksClient *compute.Disks }, }, nil } + +func virtualMachineTerminateNotificationSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + "timeout": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azValidate.ISO8601DurationBetween("PT5M", "PT15M"), + Default: "PT5M", + }, + }, + }, + } +} + +func expandVirtualMachineScheduledEventsProfile(input []interface{}) *compute.ScheduledEventsProfile { + if len(input) == 0 { + return &compute.ScheduledEventsProfile{ + TerminateNotificationProfile: &compute.TerminateNotificationProfile{ + Enable: utils.Bool(false), + }, + } + } + + raw := input[0].(map[string]interface{}) + enabled := raw["enabled"].(bool) + timeout := raw["timeout"].(string) + + return &compute.ScheduledEventsProfile{ + TerminateNotificationProfile: &compute.TerminateNotificationProfile{ + Enable: &enabled, + NotBeforeTimeout: &timeout, + }, + } +} + +func flattenVirtualMachineScheduledEventsProfile(input *compute.ScheduledEventsProfile) []interface{} { + // if enabled is set to false, there will be no ScheduledEventsProfile in response, to avoid plan non empty when + // a user explicitly set enabled to false, we need to assign a default block to this field + + enabled := false + if input != nil && input.TerminateNotificationProfile != nil && input.TerminateNotificationProfile.Enable != nil { + enabled = *input.TerminateNotificationProfile.Enable + } + + timeout := "PT5M" + if input != nil && input.TerminateNotificationProfile != nil && input.TerminateNotificationProfile.NotBeforeTimeout != nil { + timeout = *input.TerminateNotificationProfile.NotBeforeTimeout + } + + return []interface{}{ + map[string]interface{}{ + "enabled": enabled, + "timeout": timeout, + }, + } +} diff --git a/internal/services/compute/virtual_machine_scale_set.go b/internal/services/compute/virtual_machine_scale_set.go index dd9a6c4e5beb9..6513661e3cdd7 100644 --- a/internal/services/compute/virtual_machine_scale_set.go +++ b/internal/services/compute/virtual_machine_scale_set.go @@ -1413,7 +1413,7 @@ func VirtualMachineScaleSetTerminateNotificationSchema() *pluginsdk.Schema { "timeout": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: azValidate.ISO8601Duration, + ValidateFunc: azValidate.ISO8601DurationBetween("PT5M", "PT15M"), Default: "PT5M", }, }, diff --git a/internal/services/compute/windows_virtual_machine_resource.go b/internal/services/compute/windows_virtual_machine_resource.go index b082401cc3306..8e0af526cc235 100644 --- a/internal/services/compute/windows_virtual_machine_resource.go +++ b/internal/services/compute/windows_virtual_machine_resource.go @@ -286,6 +286,8 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { "tags": tags.Schema(), + "terminate_notification": virtualMachineTerminateNotificationSchema(), + "timezone": { Type: pluginsdk.TypeString, Optional: true, @@ -647,6 +649,10 @@ func resourceWindowsVirtualMachineCreate(d *pluginsdk.ResourceData, meta interfa params.PlatformFaultDomain = utils.Int32(int32(platformFaultDomain)) } + if v, ok := d.GetOk("terminate_notification"); ok { + params.VirtualMachineProperties.ScheduledEventsProfile = expandVirtualMachineScheduledEventsProfile(v.([]interface{})) + } + if v, ok := d.GetOk("timezone"); ok { params.VirtualMachineProperties.OsProfile.WindowsConfiguration.TimeZone = utils.String(v.(string)) } @@ -847,6 +853,12 @@ func resourceWindowsVirtualMachineRead(d *pluginsdk.ResourceData, meta interface } } + if scheduleProfile := props.ScheduledEventsProfile; scheduleProfile != nil { + if err := d.Set("terminate_notification", flattenVirtualMachineScheduledEventsProfile(scheduleProfile)); err != nil { + return fmt.Errorf("setting `terminate_notification`: %+v", err) + } + } + encryptionAtHostEnabled := false vtpmEnabled := false secureBootEnabled := false @@ -1170,6 +1182,13 @@ func resourceWindowsVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interfa update.Tags = tags.Expand(tagsRaw) } + if d.HasChange("terminate_notification") { + shouldUpdate = true + + notificationRaw := d.Get("terminate_notification").([]interface{}) + update.ScheduledEventsProfile = expandVirtualMachineScheduledEventsProfile(notificationRaw) + } + if d.HasChange("additional_capabilities") { shouldUpdate = true diff --git a/internal/services/compute/windows_virtual_machine_resource_other_test.go b/internal/services/compute/windows_virtual_machine_resource_other_test.go index f103123a3e319..3d062b12b0a22 100644 --- a/internal/services/compute/windows_virtual_machine_resource_other_test.go +++ b/internal/services/compute/windows_virtual_machine_resource_other_test.go @@ -634,6 +634,66 @@ func TestAccWindowsVirtualMachine_otherTags(t *testing.T) { }) } +func TestAccWindowsVirtualMachine_otherTerminateNotification(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine", "test") + r := WindowsVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + // turn terminate notification on + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("terminate_notification.#").HasValue("1"), + check.That(data.ResourceName).Key("terminate_notification.0.enabled").HasValue("true"), + ), + }, + data.ImportStep("admin_password"), + // turn terminate notification off + { + Config: r.otherTerminateNotification(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("terminate_notification.#").HasValue("1"), + check.That(data.ResourceName).Key("terminate_notification.0.enabled").HasValue("false"), + ), + }, + data.ImportStep("admin_password"), + // turn terminate notification on again + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("terminate_notification.#").HasValue("1"), + check.That(data.ResourceName).Key("terminate_notification.0.enabled").HasValue("true"), + ), + }, + data.ImportStep("admin_password"), + }) +} + +func TestAccWindowsVirtualMachine_otherTerminateNotificationTimeout(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine", "test") + r := WindowsVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherTerminateNotificationTimeout(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + }) +} + func TestAccWindowsVirtualMachine_otherTimeZone(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine", "test") r := WindowsVirtualMachineResource{} @@ -2228,6 +2288,75 @@ resource "azurerm_windows_virtual_machine" "test" { `, r.template(data)) } +func (r WindowsVirtualMachineResource) otherTerminateNotification(data acceptance.TestData, enabled bool) string { + return fmt.Sprintf(` +%s + +resource "azurerm_windows_virtual_machine" "test" { + name = local.vm_name + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + size = "Standard_F2" + admin_username = "adminuser" + admin_password = "P@$$w0rd1234!" + network_interface_ids = [ + azurerm_network_interface.test.id, + ] + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "MicrosoftWindowsServer" + offer = "WindowsServer" + sku = "2016-Datacenter" + version = "latest" + } + + terminate_notification { + enabled = %t + } +} +`, r.template(data), enabled) +} + +func (r WindowsVirtualMachineResource) otherTerminateNotificationTimeout(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_windows_virtual_machine" "test" { + name = local.vm_name + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + size = "Standard_F2" + admin_username = "adminuser" + admin_password = "P@$$w0rd1234!" + network_interface_ids = [ + azurerm_network_interface.test.id, + ] + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "MicrosoftWindowsServer" + offer = "WindowsServer" + sku = "2016-Datacenter" + version = "latest" + } + + terminate_notification { + enabled = true + timeout = "PT15M" + } +} +`, r.template(data)) +} + func (r WindowsVirtualMachineResource) otherTimeZone(data acceptance.TestData) string { return fmt.Sprintf(` %s diff --git a/internal/services/compute/windows_virtual_machine_scale_set_other_resource_test.go b/internal/services/compute/windows_virtual_machine_scale_set_other_resource_test.go index 816e90c3f5ed0..63142ee90415d 100644 --- a/internal/services/compute/windows_virtual_machine_scale_set_other_resource_test.go +++ b/internal/services/compute/windows_virtual_machine_scale_set_other_resource_test.go @@ -554,6 +554,28 @@ func TestAccWindowsVirtualMachineScaleSet_otherTerminateNotification(t *testing. }) } +func TestAccWindowsVirtualMachineScaleSet_otherTerminateNotificationTimeout(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine_scale_set", "test") + r := WindowsVirtualMachineScaleSetResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.otherTerminateNotification(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherTerminateNotificationTimeout(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + }) +} + func TestAccWindowsVirtualMachineScaleSet_otherAutomaticRepairsPolicy(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine_scale_set", "test") r := WindowsVirtualMachineScaleSetResource{} @@ -2327,6 +2349,50 @@ resource "azurerm_windows_virtual_machine_scale_set" "test" { `, r.template(data), enabled) } +func (r WindowsVirtualMachineScaleSetResource) otherTerminateNotificationTimeout(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_windows_virtual_machine_scale_set" "test" { + name = local.vm_name + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "Standard_F2" + instances = 1 + admin_username = "adminuser" + admin_password = "P@ssword1234!" + + source_image_reference { + publisher = "MicrosoftWindowsServer" + offer = "WindowsServer" + sku = "2019-Datacenter" + version = "latest" + } + + os_disk { + storage_account_type = "Standard_LRS" + caching = "ReadWrite" + } + + network_interface { + name = "example" + primary = true + + ip_configuration { + name = "internal" + primary = true + subnet_id = azurerm_subnet.test.id + } + } + + terminate_notification { + enabled = true + timeout = "PT15M" + } +} +`, r.template(data)) +} + func (r WindowsVirtualMachineScaleSetResource) otherAutomaticRepairsPolicy(data acceptance.TestData, enabled bool) string { return fmt.Sprintf(` %[1]s diff --git a/website/docs/r/linux_virtual_machine.html.markdown b/website/docs/r/linux_virtual_machine.html.markdown index 08bfa60e93874..18f30b6ee1bf7 100644 --- a/website/docs/r/linux_virtual_machine.html.markdown +++ b/website/docs/r/linux_virtual_machine.html.markdown @@ -186,6 +186,8 @@ The following arguments are supported: * `tags` - (Optional) A mapping of tags which should be assigned to this Virtual Machine. +* `terminate_notification` - (Optional) A `terminate_notification` block as defined below. + * `user_data` - (Optional) The Base64-Encoded User Data which should be used for this Virtual Machine. * `vtpm_enabled` - (Optional) Specifies whether vTPM should be enabled on the virtual machine. Changing this forces a new resource to be created. @@ -298,6 +300,16 @@ A `secret` block supports the following: * `version` - (Optional) Specifies the version of the image used to create the virtual machines. +--- + +A `terminate_notification` block supports the following: + +* `enabled` - (Required) Should the terminate notification be enabled on this Virtual Machine Scale Set? Defaults to `false`. + +* `timeout` - (Optional) Length of time (in minutes, between 5 and 15) a notification to be sent to the VM on the instance metadata server till the VM gets deleted. The time duration should be specified in ISO 8601 format. + +~> **NOTE:** For more information about the terminate notification, please [refer to this doc](https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification). + ## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/linux_virtual_machine_scale_set.html.markdown b/website/docs/r/linux_virtual_machine_scale_set.html.markdown index dcc9cc8b52c39..88ac5f05db64a 100644 --- a/website/docs/r/linux_virtual_machine_scale_set.html.markdown +++ b/website/docs/r/linux_virtual_machine_scale_set.html.markdown @@ -478,7 +478,7 @@ A `terminate_notification` block supports the following: * `timeout` - (Optional) Length of time (in minutes, between 5 and 15) a notification to be sent to the VM on the instance metadata server till the VM gets deleted. The time duration should be specified in ISO 8601 format. -~> **NOTE:** For more information about the terminate notification, please [refer to this doc](https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification). +~> **NOTE:** For more information about the terminate notification, please [refer to this doc](https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification). --- diff --git a/website/docs/r/orchestrated_virtual_machine_scale_set.html.markdown b/website/docs/r/orchestrated_virtual_machine_scale_set.html.markdown index 46a95a66bb781..05ec84646cafb 100644 --- a/website/docs/r/orchestrated_virtual_machine_scale_set.html.markdown +++ b/website/docs/r/orchestrated_virtual_machine_scale_set.html.markdown @@ -375,6 +375,8 @@ A `termination_notification` block supports the following: * `timeout` - (Optional) Length of time (in minutes, between `5` and `15`) a notification to be sent to the VM on the instance metadata server till the VM gets deleted. The time duration should be specified in `ISO 8601` format. Defaults to `PT5M`. +~> **NOTE:** For more information about the terminate notification, please [refer to this doc](https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification). + --- A `source_image_reference` block supports the following: diff --git a/website/docs/r/windows_virtual_machine.html.markdown b/website/docs/r/windows_virtual_machine.html.markdown index 2f39c9eb0e926..aeb7e25244d28 100644 --- a/website/docs/r/windows_virtual_machine.html.markdown +++ b/website/docs/r/windows_virtual_machine.html.markdown @@ -177,6 +177,8 @@ The following arguments are supported: * `tags` - (Optional) A mapping of tags which should be assigned to this Virtual Machine. +* `terminate_notification` - (Optional) A `terminate_notification` block as defined below. + * `timezone` - (Optional) Specifies the Time Zone which should be used by the Virtual Machine, [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/). * `user_data` - (Optional) The Base64-Encoded User Data which should be used for this Virtual Machine. @@ -295,6 +297,16 @@ A `secret` block supports the following: --- +A `terminate_notification` block supports the following: + +* `enabled` - (Required) Should the terminate notification be enabled on this Virtual Machine Scale Set? Defaults to `false`. + +* `timeout` - (Optional) Length of time (in minutes, between 5 and 15) a notification to be sent to the VM on the instance metadata server till the VM gets deleted. The time duration should be specified in ISO 8601 format. + +~> **NOTE:** For more information about the terminate notification, please [refer to this doc](https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification). + +--- + A `winrm_listener` block supports the following: * `Protocol` - (Required) Specifies Specifies the protocol of listener. Possible values are `Http` or `Https`