This module will create a linux virtual machine, a network interface and associates the network interface to the target subnet. Optionally one or more data disks and a public ip can be created and additional network interfaces.
It's very easy to use!
provider "azurerm" {
features {}
}
module "virtual_machine" {
source = "../.."
virtual_machine_config = {
hostname = "CUSTAPP001"
location = azurerm_resource_group.this.location
size = "Standard_B1ms"
os_sku = "22_04-lts-gen2"
os_offer = "0001-com-ubuntu-server-jammy"
os_version = "latest"
os_publisher = "Canonical"
severity_group = "01-second-monday-0300-XCSUFEDTG-reboot"
}
admin_username = "local_admin"
admin_credential = {
admin_password = "H3ll0W0rld!"
}
resource_group_name = azurerm_resource_group.this.name
subnet = azurerm_subnet.this
}
resource "azurerm_resource_group" "this" {
name = "rg-TestLinuxBasic-tst-01"
location = "westeurope"
}
resource "azurerm_virtual_network" "this" {
name = "vnet-10-0-0-0-24-${azurerm_resource_group.this.location}"
address_space = ["10.0.0.0/24"]
location = azurerm_resource_group.this.location
resource_group_name = azurerm_resource_group.this.name
}
resource "azurerm_subnet" "this" {
name = "snet-10-0-0-0-24-Test"
resource_group_name = azurerm_resource_group.this.name
virtual_network_name = azurerm_virtual_network.this.name
address_prefixes = ["10.0.0.0/24"]
}
Name | Version |
---|---|
terraform | >=1.5.0 |
azurerm | >= 3.7.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
admin_credential | Specify either admin_password or public_key: |
object({ |
n/a | yes |
resource_group_name | Name of the resource group where the resources will be created. | string |
n/a | yes |
subnet | The variable takes the subnet as input and takes the id and the address prefix for further configuration. | object({ |
n/a | yes |
virtual_machine_config | hostname: Name of system hostname. |
object({ |
n/a | yes |
additional_network_interface_ids | List of ids for additional azurerm_network_interface. | list(string) |
[] |
no |
admin_username | Optionally choose the admin_username of the vm. Defaults to loc_sysadmin. | string |
"loc_sysadmin" |
no |
data_disks | = { |
map(object({ |
{} |
no |
name_overrides | Possibility to override names that will be generated according to q.beyond naming convention. | object({ |
{} |
no |
nic_config | private_ip: Optioanlly specify a private ip to use. Otherwise it will be allocated dynamically. |
object({ |
{} |
no |
public_ip_config | allocation_method: The allocation method of the public ip that will be created. Defaults to static. |
object({ |
null |
no |
tags | A map of tags that will be set on every resource this module creates. | map(string) |
{} |
no |
Name | Description |
---|---|
data_disks | n/a |
network_interface | n/a |
virtual_machine | n/a |
## Resource types
| Type | Used |
|------|-------|
| [azurerm_linux_virtual_machine](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_virtual_machine) | 1 |
| [azurerm_managed_disk](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk) | 1 |
| [azurerm_marketplace_agreement](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/marketplace_agreement) | 1 |
| [azurerm_network_interface](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface) | 1 |
| [azurerm_network_interface_security_group_association](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface_security_group_association) | 1 |
| [azurerm_public_ip](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | 1 |
| [azurerm_virtual_machine_data_disk_attachment](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_data_disk_attachment) | 1 |
**`Used` only includes resource blocks.** `for_each` and `count` meta arguments, as well as resource blocks of modules are not considered.
No modules.
## Resources by Files
### data_disk.tf
| Name | Type |
|------|------|
| [azurerm_managed_disk.data_disk](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk) | resource |
| [azurerm_virtual_machine_data_disk_attachment.data_disk](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_data_disk_attachment) | resource |
### main.tf
| Name | Type |
|------|------|
| [azurerm_linux_virtual_machine.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_virtual_machine) | resource |
| [azurerm_marketplace_agreement.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/marketplace_agreement) | resource |
| [azurerm_network_interface.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface) | resource |
| [azurerm_network_interface_security_group_association.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface_security_group_association) | resource |
| [azurerm_public_ip.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource |
Please use Pull requests to contribute.
When a new Feature or Fix is ready to be released, create a new Github release and adhere to Semantic Versioning 2.0.0.