hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

Virtual Machine OS Disk network_access_policy setting #14756

Open scott1138 opened 2 years ago

scott1138 commented 2 years ago

Community Note

Description

Managed disk have a network_access_policy property, but this is not available when creating a VM for the OS disk.

New or Affected Resource(s)

azurerm_windows_virtual_machine azurerm_linux_virtual_machine azurerm_windows_virtual_machine_scale_set azurerm_linux_virtual_machine_scale_set

Potential Terraform Configuration

resource "azurerm_windows_virtual_machine" "example" {
  name                = "example-machine"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  size                = "Standard_F2"
  admin_username      = "adminuser"
  admin_password      = "P@$$w0rd1234!"
  network_interface_ids = [
    azurerm_network_interface.example.id,
  ]

  os_disk {
    caching               = "ReadWrite"
    storage_account_type  = "Standard_LRS"
    network_access_policy = "DenyAll"
  }

  source_image_reference {
    publisher = "MicrosoftWindowsServer"
    offer     = "WindowsServer"
    sku       = "2016-Datacenter"
    version   = "latest"
  }
}

References

ChechuJA commented 2 years ago

And azurerm_windows_virtual_machine please!!!

tombuildsstuff commented 1 year ago

Dependent on https://github.com/Azure/azure-rest-api-specs/issues/21325