diff --git a/internal/services/compute/linux_virtual_machine_resource.go b/internal/services/compute/linux_virtual_machine_resource.go index 93aceda897460..b4eb25a82bf7a 100644 --- a/internal/services/compute/linux_virtual_machine_resource.go +++ b/internal/services/compute/linux_virtual_machine_resource.go @@ -206,6 +206,8 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { ValidateFunc: azValidate.ISO8601DurationBetween("PT15M", "PT2H"), }, + "gallery_applications": VirtualMachineGalleryApplicationsSchema(), + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), "license_type": { @@ -444,6 +446,9 @@ func resourceLinuxVirtualMachineCreate(d *pluginsdk.ResourceData, meta interface Identity: identity, Plan: plan, VirtualMachineProperties: &compute.VirtualMachineProperties{ + ApplicationProfile: &compute.ApplicationProfile{ + GalleryApplications: expandVirtualMachineGalleryApplications(d.Get("gallery_applications").([]interface{})), + }, HardwareProfile: &compute.HardwareProfile{ VMSize: compute.VirtualMachineSizeTypes(size), }, @@ -723,6 +728,10 @@ func resourceLinuxVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("capacity_reservation_group_id", capacityReservationGroupId) + if props.ApplicationProfile != nil && props.ApplicationProfile.GalleryApplications != nil { + d.Set("gallery_applications", flattenVirtualMachineGalleryApplications(props.ApplicationProfile.GalleryApplications)) + } + licenseType := "" if props.LicenseType != nil { licenseType = *props.LicenseType @@ -1039,6 +1048,13 @@ func resourceLinuxVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interface update.ExtensionsTimeBudget = utils.String(d.Get("extensions_time_budget").(string)) } + if d.HasChange("gallery_applications") { + shouldUpdate = true + update.ApplicationProfile = &compute.ApplicationProfile{ + GalleryApplications: expandVirtualMachineGalleryApplications(d.Get("gallery_applications").([]interface{})), + } + } + if d.HasChange("max_bid_price") { 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 602a5421175ba..f92dad3e8c46c 100644 --- a/internal/services/compute/linux_virtual_machine_resource_other_test.go +++ b/internal/services/compute/linux_virtual_machine_resource_other_test.go @@ -261,6 +261,44 @@ func TestAccLinuxVirtualMachine_otherCustomData(t *testing.T) { }) } +func TestAccLinuxVirtualMachine_otherGalleryApplications(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test") + r := LinuxVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.otherGalleryApplications(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("gallery_applications.0.order").HasValue("0"), + ), + }, + data.ImportStep(), + { + Config: r.otherGalleryApplicationsUpdated(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.otherGalleryApplicationsRemoved(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.otherGalleryApplications(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("gallery_applications.0.order").HasValue("0"), + ), + }, + data.ImportStep(), + }) +} + func TestAccLinuxVirtualMachine_otherEdgeZone(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test") r := LinuxVirtualMachineResource{} @@ -1260,6 +1298,225 @@ resource "azurerm_linux_virtual_machine" "test" { `, r.otherBootDiagnosticsTemplate(data), data.RandomInteger) } +func (r LinuxVirtualMachineResource) otherGalleryApplications(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" + } + + gallery_applications { + package_reference_id = azurerm_gallery_application_version.test.id + } +} +`, r.otherGalleryApplicationsTemplate(data), data.RandomInteger) +} + +func (r LinuxVirtualMachineResource) otherGalleryApplicationsUpdated(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_linux_virtual_machine" "test" { + name = "acctestVM-%[2]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" + } + + gallery_applications { + package_reference_id = azurerm_gallery_application_version.test.id + order = 1 + } + + gallery_applications { + package_reference_id = azurerm_gallery_application_version.test2.id + order = 2 + configuration_reference_blob_uri = azurerm_storage_blob.test2.id + tag = "app2" + } +} +`, r.otherGalleryApplicationsTemplate(data)) +} + +func (r LinuxVirtualMachineResource) otherGalleryApplicationsRemoved(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" + } +} +`, r.otherGalleryApplicationsTemplate(data), data.RandomInteger) +} + +func (r LinuxVirtualMachineResource) otherGalleryApplicationsTemplate(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_storage_account" "test" { + name = "accteststr%[2]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test" { + name = "test" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "blob" +} + +resource "azurerm_storage_blob" "test" { + name = "script" + storage_account_name = azurerm_storage_account.test.name + storage_container_name = azurerm_storage_container.test.name + type = "Block" + source_content = "script" +} + +resource "azurerm_storage_blob" "test2" { + name = "script2" + storage_account_name = azurerm_storage_account.test.name + storage_container_name = azurerm_storage_container.test.name + type = "Block" + source_content = "script2" +} + +resource "azurerm_shared_image_gallery" "test" { + name = "acctestsig%[3]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_gallery_application" "test" { + name = "acctest-app-%[3]d" + gallery_id = azurerm_shared_image_gallery.test.id + location = azurerm_shared_image_gallery.test.location + supported_os_type = "Linux" +} + +resource "azurerm_gallery_application_version" "test" { + name = "0.0.1" + gallery_application_id = azurerm_gallery_application.test.id + location = azurerm_gallery_application.test.location + + source { + media_link = azurerm_storage_blob.test.id + default_configuration_link = azurerm_storage_blob.test.id + } + + manage_action { + install = "[install command]" + remove = "[remove command]" + } + + target_region { + name = azurerm_gallery_application.test.location + regional_replica_count = 1 + storage_account_type = "Premium_LRS" + } +} + +resource "azurerm_gallery_application" "test2" { + name = "acctest-app2-%[3]d" + gallery_id = azurerm_shared_image_gallery.test.id + location = azurerm_shared_image_gallery.test.location + supported_os_type = "Linux" +} + + +resource "azurerm_gallery_application_version" "test2" { + name = "0.0.1" + gallery_application_id = azurerm_gallery_application.test2.id + location = azurerm_gallery_application.test2.location + + source { + media_link = azurerm_storage_blob.test.id + default_configuration_link = azurerm_storage_blob.test.id + } + + manage_action { + install = "[install command]" + remove = "[remove command]" + } + + target_region { + name = azurerm_gallery_application.test2.location + regional_replica_count = 1 + storage_account_type = "Premium_LRS" + } +} +`, r.template(data), data.RandomString, data.RandomInteger) +} + func (r LinuxVirtualMachineResource) otherUserData(data acceptance.TestData, userData string) string { return fmt.Sprintf(` %s diff --git a/internal/services/compute/virtual_machine.go b/internal/services/compute/virtual_machine.go index cea52921e8052..ed90c86765777 100644 --- a/internal/services/compute/virtual_machine.go +++ b/internal/services/compute/virtual_machine.go @@ -485,3 +485,106 @@ func flattenVirtualMachineScheduledEventsProfile(input *compute.ScheduledEventsP }, } } + +func VirtualMachineGalleryApplicationsSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 100, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "package_reference_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.GalleryApplicationVersionID, + }, + + // Example: https://mystorageaccount.blob.core.windows.net/configurations/settings.config + "configuration_reference_blob_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, + }, + + "order": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 0, + ValidateFunc: validation.IntBetween(0, 2147483647), + }, + + // NOTE: Per the service team, "this is a pass through value that we just add to the model but don't depend on. It can be any string." + "tag": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + } +} + +func expandVirtualMachineGalleryApplications(input []interface{}) *[]compute.VMGalleryApplication { + out := make([]compute.VMGalleryApplication, 0) + if len(input) == 0 { + return &out + } + + for _, v := range input { + packageReferenceId := v.(map[string]interface{})["package_reference_id"].(string) + configurationReference := v.(map[string]interface{})["configuration_reference_blob_uri"].(string) + order := v.(map[string]interface{})["order"].(int) + tag := v.(map[string]interface{})["tag"].(string) + + app := &compute.VMGalleryApplication{ + PackageReferenceID: utils.String(packageReferenceId), + ConfigurationReference: utils.String(configurationReference), + Order: utils.Int32(int32(order)), + Tags: utils.String(tag), + } + + out = append(out, *app) + } + + return &out +} + +func flattenVirtualMachineGalleryApplications(input *[]compute.VMGalleryApplication) []interface{} { + if len(*input) == 0 { + return nil + } + + out := make([]interface{}, 0) + + for _, v := range *input { + var packageReferenceId, configurationReference, tag string + var order int + + if v.PackageReferenceID != nil { + packageReferenceId = *v.PackageReferenceID + } + + if v.ConfigurationReference != nil { + configurationReference = *v.ConfigurationReference + } + + if v.Order != nil { + order = int(*v.Order) + } + + if v.Tags != nil { + tag = *v.Tags + } + + app := map[string]interface{}{ + "package_reference_id": packageReferenceId, + "configuration_reference_blob_uri": configurationReference, + "order": order, + "tag": tag, + } + + out = append(out, app) + } + + return out +} diff --git a/internal/services/compute/windows_virtual_machine_resource.go b/internal/services/compute/windows_virtual_machine_resource.go index 98c06b72d964b..576bda57b3cfd 100644 --- a/internal/services/compute/windows_virtual_machine_resource.go +++ b/internal/services/compute/windows_virtual_machine_resource.go @@ -208,6 +208,8 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { ValidateFunc: azValidate.ISO8601DurationBetween("PT15M", "PT2H"), }, + "gallery_applications": VirtualMachineGalleryApplicationsSchema(), + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), "license_type": { @@ -478,6 +480,9 @@ func resourceWindowsVirtualMachineCreate(d *pluginsdk.ResourceData, meta interfa Identity: identity, Plan: plan, VirtualMachineProperties: &compute.VirtualMachineProperties{ + ApplicationProfile: &compute.ApplicationProfile{ + GalleryApplications: expandVirtualMachineGalleryApplications(d.Get("gallery_applications").([]interface{})), + }, HardwareProfile: &compute.HardwareProfile{ VMSize: compute.VirtualMachineSizeTypes(size), }, @@ -796,6 +801,10 @@ func resourceWindowsVirtualMachineRead(d *pluginsdk.ResourceData, meta interface } d.Set("extensions_time_budget", extensionsTimeBudget) + if props.ApplicationProfile != nil && props.ApplicationProfile.GalleryApplications != nil { + d.Set("gallery_applications", flattenVirtualMachineGalleryApplications(props.ApplicationProfile.GalleryApplications)) + } + // defaulted since BillingProfile isn't returned if it's unset maxBidPrice := float64(-1.0) if props.BillingProfile != nil && props.BillingProfile.MaxPrice != nil { @@ -1133,6 +1142,13 @@ func resourceWindowsVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interfa update.ExtensionsTimeBudget = utils.String(d.Get("extensions_time_budget").(string)) } + if d.HasChange("gallery_applications") { + shouldUpdate = true + update.ApplicationProfile = &compute.ApplicationProfile{ + GalleryApplications: expandVirtualMachineGalleryApplications(d.Get("gallery_applications").([]interface{})), + } + } + if d.HasChange("max_bid_price") { 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 689f5eceb88bb..f7a9130243aa9 100644 --- a/internal/services/compute/windows_virtual_machine_resource_other_test.go +++ b/internal/services/compute/windows_virtual_machine_resource_other_test.go @@ -367,6 +367,44 @@ func TestAccWindowsVirtualMachine_otherEdgeZone(t *testing.T) { }) } +func TestAccWindowsVirtualMachine_otherGalleryApplications(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine", "test") + r := WindowsVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.otherGalleryApplications(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("gallery_applications.0.order").HasValue("0"), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherGalleryApplicationsUpdated(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherGalleryApplicationsRemoved(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("admin_password"), + { + Config: r.otherGalleryApplications(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("gallery_applications.0.order").HasValue("0"), + ), + }, + data.ImportStep("admin_password"), + }) +} + func TestAccWindowsVirtualMachine_otherUserData(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine", "test") r := WindowsVirtualMachineResource{} @@ -1630,6 +1668,212 @@ resource "azurerm_windows_virtual_machine" "test" { `, r.template(data)) } +func (r WindowsVirtualMachineResource) otherGalleryApplications(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" + } + + gallery_applications { + package_reference_id = azurerm_gallery_application_version.test.id + } +} +`, r.otherGalleryApplicationsTemplate(data)) +} + +func (r WindowsVirtualMachineResource) otherGalleryApplicationsUpdated(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" + } + + gallery_applications { + package_reference_id = azurerm_gallery_application_version.test.id + order = 1 + } + + gallery_applications { + package_reference_id = azurerm_gallery_application_version.test2.id + order = 2 + configuration_reference_blob_uri = azurerm_storage_blob.test2.id + tag = "app2" + } +} +`, r.otherGalleryApplicationsTemplate(data)) +} + +func (r WindowsVirtualMachineResource) otherGalleryApplicationsRemoved(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" + } +} +`, r.otherGalleryApplicationsTemplate(data)) +} + +func (r WindowsVirtualMachineResource) otherGalleryApplicationsTemplate(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_storage_account" "test" { + name = "accteststr%[2]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test" { + name = "test" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "blob" +} + +resource "azurerm_storage_blob" "test" { + name = "script" + storage_account_name = azurerm_storage_account.test.name + storage_container_name = azurerm_storage_container.test.name + type = "Block" + source_content = "script" +} + +resource "azurerm_storage_blob" "test2" { + name = "script2" + storage_account_name = azurerm_storage_account.test.name + storage_container_name = azurerm_storage_container.test.name + type = "Block" + source_content = "script2" +} + +resource "azurerm_shared_image_gallery" "test" { + name = "acctestsig%[3]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_gallery_application" "test" { + name = "acctest-app-%[3]d" + gallery_id = azurerm_shared_image_gallery.test.id + location = azurerm_shared_image_gallery.test.location + supported_os_type = "Windows" +} + +resource "azurerm_gallery_application_version" "test" { + name = "0.0.1" + gallery_application_id = azurerm_gallery_application.test.id + location = azurerm_gallery_application.test.location + + source { + media_link = azurerm_storage_blob.test.id + default_configuration_link = azurerm_storage_blob.test.id + } + + manage_action { + install = "[install command]" + remove = "[remove command]" + } + + target_region { + name = azurerm_gallery_application.test.location + regional_replica_count = 1 + storage_account_type = "Premium_LRS" + } +} + +resource "azurerm_gallery_application" "test2" { + name = "acctest-app2-%[3]d" + gallery_id = azurerm_shared_image_gallery.test.id + location = azurerm_shared_image_gallery.test.location + supported_os_type = "Windows" +} + +resource "azurerm_gallery_application_version" "test2" { + name = "0.0.1" + gallery_application_id = azurerm_gallery_application.test2.id + location = azurerm_gallery_application.test2.location + + source { + media_link = azurerm_storage_blob.test.id + default_configuration_link = azurerm_storage_blob.test.id + } + + manage_action { + install = "[install command]" + remove = "[remove command]" + } + + target_region { + name = azurerm_gallery_application.test2.location + regional_replica_count = 1 + storage_account_type = "Premium_LRS" + } +} +`, r.template(data), data.RandomString, data.RandomInteger) +} + func (r WindowsVirtualMachineResource) otherUserData(data acceptance.TestData, userData string) string { return fmt.Sprintf(` %s diff --git a/website/docs/r/linux_virtual_machine.html.markdown b/website/docs/r/linux_virtual_machine.html.markdown index 174f9145a8ac5..a4bccdf6cd5a0 100644 --- a/website/docs/r/linux_virtual_machine.html.markdown +++ b/website/docs/r/linux_virtual_machine.html.markdown @@ -154,6 +154,8 @@ The following arguments are supported: * `extensions_time_budget` - (Optional) Specifies the duration allocated for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. Defaults to 90 minutes (`PT1H30M`). +* `gallery_applications` - (Optional) A `gallery_applications` block as defined below. + * `identity` - (Optional) An `identity` block as defined below. * `patch_mode` - (Optional) Specifies the mode of in-guest patching to this Linux Virtual Machine. Possible values are `AutomaticByPlatform` and `ImageDefault`. Defaults to `ImageDefault`. For more information on patch modes please see the [product documentation](https://docs.microsoft.com/azure/virtual-machines/automatic-vm-guest-patching#patch-orchestration-modes). @@ -244,6 +246,20 @@ A `diff_disk_settings` block supports the following: --- +A `gallery_applications` block supports the following: + +* `package_reference_id` - (Required) Specifies the Gallery Application Version resource ID. + +-> **NOTE:** The `package_reference_id` should be in the form of `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/galleries/gallery1/applications/application1/versions/version1`. + +* `configuration_reference_blob_uri` - (Optional) Specifies the URI to an Azure Blob that will replace the default configuration for the package if provided. + +* `order` - (Optional) Specifies the order in which the packages have to be installed. Possible values are between `0` and `2,147,483,647`. + +* `tag` - (Optional) Specifies a passthrough value for more generic context. This field can be any valid `string` value. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Linux Virtual Machine. Possible values are `SystemAssigned`, `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both). diff --git a/website/docs/r/windows_virtual_machine.html.markdown b/website/docs/r/windows_virtual_machine.html.markdown index 21312842d9fea..b6352576c32b5 100644 --- a/website/docs/r/windows_virtual_machine.html.markdown +++ b/website/docs/r/windows_virtual_machine.html.markdown @@ -143,6 +143,8 @@ The following arguments are supported: * `extensions_time_budget` - (Optional) Specifies the duration allocated for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. Defaults to 90 minutes (`PT1H30M`). +* `gallery_applications` - (Optional) A `gallery_applications` block as defined below. + * `hotpatching_enabled` - (Optional) Should the VM be patched without requiring a reboot? Possible values are `true` or `false`. Defaults to `false`. For more information about hot patching please see the [product documentation](https://docs.microsoft.com/azure/automanage/automanage-hotpatch). -> **NOTE:** Hotpatching can only be enabled if the `patch_mode` is set to `AutomaticByPlatform`, the `provision_vm_agent` is set to `true`, your `source_image_reference` references a hotpatching enabled image, and the VM's `size` is set to a [Azure generation 2](https://docs.microsoft.com/azure/virtual-machines/generation-2#generation-2-vm-sizes) VM. An example of how to correctly configure a Windows Virtual Machine to use the `hotpatching_enabled` field can be found in the [`./examples/virtual-machines/windows/hotpatching-enabled`](https://github.com/hashicorp/terraform-provider-azurerm/tree/main/examples/virtual-machines/windows/hotpatching-enabled) directory within the GitHub Repository. @@ -243,6 +245,20 @@ A `diff_disk_settings` block supports the following: --- +A `gallery_applications` block supports the following: + +* `package_reference_id` - (Required) Specifies the Gallery Application Version resource ID. + +-> **NOTE:** The `package_reference_id` should be in the form of `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/galleries/gallery1/applications/application1/versions/version1`. + +* `configuration_reference_blob_uri` - (Optional) Specifies the URI to an Azure Blob that will replace the default configuration for the package if provided. + +* `order` - (Optional) Specifies the order in which the packages have to be installed. Possible values are between `0` and `2,147,483,647`. + +* `tag` - (Optional) Specifies a passthrough value for more generic context. This field can be any valid `string` value. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Windows Virtual Machine. Possible values are `SystemAssigned`, `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both).