Linux Virtual Machine Module
Creates an Azure Linux Virtual Machine with a network interface. Optionally creates a public IP address.
module "vm" {
source = " ./modules/linux_virtual_machine"
name = " my-vm"
resource_group_name = " se-rg"
location = " eastus"
subnet_id = " /subscriptions/.../subnets/default"
ssh_public_key = file (" ~/.ssh/id_rsa.pub" )
vm_size = " Standard_B2s"
create_public_ip = true
tags = {
environment = " workshop"
}
}
Name
Description
Type
Default
Required
name
Name of the VM
string
—
yes
resource_group_name
Resource group name
string
—
yes
location
Azure region
string
—
yes
subnet_id
Subnet ID for NIC
string
—
yes
ssh_public_key
SSH public key
string
—
yes
vm_size
VM size
string
Standard_B2s
no
admin_username
Admin user
string
azureuser
no
create_public_ip
Create public IP
bool
false
no
os_disk_type
OS disk type
string
Standard_LRS
no
os_disk_size_gb
OS disk size
number
30
no
image_publisher
Image publisher
string
Canonical
no
image_offer
Image offer
string
0001-com-ubuntu-server-jammy
no
image_sku
Image SKU
string
22_04-lts
no
image_version
Image version
string
latest
no
tags
Resource tags
map(string)
{}
no
Name
Description
vm_id
VM resource ID
private_ip_address
Private IP
public_ip_address
Public IP (if created)
vm_name
VM name
network_interface_id
NIC resource ID