You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# https://raw.githubusercontent.com/hashicorp/terraform-provider-azurerm/v3.96.0/examples/virtual-machines/linux/ephemeral-os-disk/main.tf# with variables.tf merged and storage_account_type line commented-out########################################## Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0provider"azurerm" {
features {}
}
variable"prefix" {
description="The prefix which should be used for all resources in this example"
}
variable"location" {
description="The Azure Region in which all resources in this example should be created."
}
resource"azurerm_resource_group""main" {
name="${var.prefix}-resources"location=var.location
}
resource"azurerm_virtual_network""main" {
name="${var.prefix}-network"address_space=["10.0.0.0/16"]
location=azurerm_resource_group.main.locationresource_group_name=azurerm_resource_group.main.name
}
resource"azurerm_subnet""internal" {
name="internal"resource_group_name=azurerm_resource_group.main.namevirtual_network_name=azurerm_virtual_network.main.nameaddress_prefixes=["10.0.2.0/24"]
}
resource"azurerm_network_interface""main" {
name="${var.prefix}-nic"resource_group_name=azurerm_resource_group.main.namelocation=azurerm_resource_group.main.locationip_configuration {
name="internal"subnet_id=azurerm_subnet.internal.idprivate_ip_address_allocation="Dynamic"
}
}
resource"azurerm_linux_virtual_machine""main" {
name="${var.prefix}-vm"resource_group_name=azurerm_resource_group.main.namelocation=azurerm_resource_group.main.locationsize="Standard_F2s_v2"admin_username="adminuser"admin_password="P@ssw0rd1234!"disable_password_authentication=falsenetwork_interface_ids=[
azurerm_network_interface.main.id,
]
source_image_reference {
publisher="Canonical"offer="0001-com-ubuntu-server-jammy"sku="22_04-lts"version="latest"
}
os_disk {
## the following line is commented-out: # storage_account_type = "Standard_LRS" caching="ReadWrite"diff_disk_settings {
option="Local"
}
}
}
Debug Output/Panic Output
│ Error: Missing required argument
│
│ on main.tf line 58, in resource "azurerm_linux_virtual_machine""main":
│ 58: os_disk {
│
│ The argument "storage_account_type" is required, but no definition was found.
Expected Behaviour
Currently, when an ephemeral OS disk is defined for a VM or VM scale set, the os_diskstorage_account_type property must still be defined even when an ephemeral OS disk is used (i.e., a diff_disk_settings block is defined in the os_disk block). In this case, storage_account_type is misleading at best, as there is no storage account backing an ephemeral OS disk as there (implicitly) is with a managed disk. Moreover, its presence could perhaps impart a false sense of security, as there is no data replication (e.g., LRS) with an ephemeral OS disk.
The example ARM template referenced by the azurerm docs for deploying a VM with an ephemeral OS disk omits the storageAccountType property:
-> **NOTE:**`diff_disk_settings` can only be set when `caching` is set to `ReadOnly`. More information can be found [here](https://docs.microsoft.com/azure/virtual-machines/ephemeral-os-disks-deploy#vm-template-deployment)
If there is consensus for changing the current requirement that an storage_account_type assignment exist even for ephemeral OS disks, azurerm v3.x could make storage_account_type optional when diff_disk_settings is defined (for backwards compatibility), while v4.x could emit an error if storage_account_type is defined when diff_disk_settings is defined.
Is there an existing issue for this?
Community Note
Terraform Version
1.6.4
AzureRM Provider Version
3.96.0
Affected Resource(s)/Data Source(s)
azurerm_linux_virtual_machine, azurerm_windows_virtual_machine, azurerm_linux_virtual_machine_scale_set, azurerm_windows_virtual_machine_scale_set
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Currently, when an ephemeral OS disk is defined for a VM or VM scale set, the
os_disk
storage_account_type
property must still be defined even when an ephemeral OS disk is used (i.e., adiff_disk_settings
block is defined in theos_disk
block). In this case,storage_account_type
is misleading at best, as there is no storage account backing an ephemeral OS disk as there (implicitly) is with a managed disk. Moreover, its presence could perhaps impart a false sense of security, as there is no data replication (e.g., LRS) with an ephemeral OS disk.The example ARM template referenced by the azurerm docs for deploying a VM with an ephemeral OS disk omits the
storageAccountType
property:terraform-provider-azurerm/website/docs/r/linux_virtual_machine.html.markdown
Line 303 in 7f80c0b
If there is consensus for changing the current requirement that an
storage_account_type
assignment exist even for ephemeral OS disks, azurerm v3.x could makestorage_account_type
optional whendiff_disk_settings
is defined (for backwards compatibility), while v4.x could emit an error ifstorage_account_type
is defined whendiff_disk_settings
is defined.Actual Behaviour
No response
Steps to Reproduce
The text was updated successfully, but these errors were encountered: