mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-09 23:54:17 -06:00
provider/azurerm: Add documentation for azurerm_virtual_machine
with (#7369)
another data_disk attached Fixes #7362
This commit is contained in:
parent
85ccf3b6b4
commit
ebb9b7a696
@ -92,13 +92,110 @@ resource "azurerm_virtual_machine" "test" {
|
||||
os_profile_linux_config {
|
||||
disable_password_authentication = false
|
||||
}
|
||||
|
||||
|
||||
tags {
|
||||
environment = "staging"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Example Usage with additional Empty DataDisk
|
||||
|
||||
```
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestrg"
|
||||
location = "West US"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctvn"
|
||||
address_space = ["10.0.0.0/16"]
|
||||
location = "West US"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "test" {
|
||||
name = "acctsub"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
virtual_network_name = "${azurerm_virtual_network.test.name}"
|
||||
address_prefix = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
resource "azurerm_network_interface" "test" {
|
||||
name = "acctni"
|
||||
location = "West US"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
|
||||
ip_configuration {
|
||||
name = "testconfiguration1"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
private_ip_address_allocation = "dynamic"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "test" {
|
||||
name = "accsa"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "westus"
|
||||
account_type = "Standard_LRS"
|
||||
|
||||
tags {
|
||||
environment = "staging"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_storage_container" "test" {
|
||||
name = "vhds"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
storage_account_name = "${azurerm_storage_account.test.name}"
|
||||
container_access_type = "private"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine" "test" {
|
||||
name = "acctvm"
|
||||
location = "West US"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
network_interface_ids = ["${azurerm_network_interface.test.id}"]
|
||||
vm_size = "Standard_A0"
|
||||
|
||||
storage_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
storage_os_disk {
|
||||
name = "myosdisk1"
|
||||
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/myosdisk1.vhd"
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
}
|
||||
|
||||
storage_data_disk {
|
||||
name = "datadisk0"
|
||||
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/datadisk0.vhd"
|
||||
disk_size_gb = "1023"
|
||||
create_option = "empty"
|
||||
lun = 0
|
||||
}
|
||||
|
||||
os_profile {
|
||||
computer_name = "hostname"
|
||||
admin_username = "testadmin"
|
||||
admin_password = "Password1234!"
|
||||
}
|
||||
|
||||
os_profile_linux_config {
|
||||
disable_password_authentication = false
|
||||
}
|
||||
|
||||
tags {
|
||||
environment = "staging"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
@ -119,7 +216,7 @@ The following arguments are supported:
|
||||
* `os_profile_linux_config` - (Required, when a linux machine) A Linux config block as documented below.
|
||||
* `os_profile_secrets` - (Optional) A collection of Secret blocks as documented below.
|
||||
* `network_interface_ids` - (Required) Specifies the list of resource IDs for the network interfaces associated with the virtual machine.
|
||||
* `tags` - (Optional) A mapping of tags to assign to the resource.
|
||||
* `tags` - (Optional) A mapping of tags to assign to the resource.
|
||||
|
||||
For more information on the different example configurations, please check out the [azure documentation](https://msdn.microsoft.com/en-us/library/mt163591.aspx#Anchor_2)
|
||||
|
||||
@ -151,7 +248,7 @@ For more information on the different example configurations, please check out t
|
||||
* `vhd_uri` - (Required) Specifies the uri of the location in storage where the vhd for the virtual machine should be placed.
|
||||
* `create_option` - (Required) Specifies how the data disk should be created.
|
||||
* `disk_size_gb` - (Required) Specifies the size of the data disk in gigabytes.
|
||||
* `lun` - (Required) Specifies the logical unit number of the data disk.
|
||||
* `lun` - (Required) Specifies the logical unit number of the data disk.
|
||||
|
||||
`os_profile` supports the following:
|
||||
|
||||
@ -188,7 +285,7 @@ For more information on the different example configurations, please check out t
|
||||
`os_profile_linux_config` supports the following:
|
||||
|
||||
* `disable_password_authentication` - (Required) Specifies whether password authentication should be disabled.
|
||||
* `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine.
|
||||
* `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine.
|
||||
|
||||
~> **Note:** Please note that the only allowed `path` is `/home/<username>/.ssh/authorized_keys` due to a limitation of Azure_
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user