https://github.com/kogunlowo123/terraform-azure-virtual-machine-linux
Terraform module for Azure Linux VMs with managed disks, extensions, and availability zones
https://github.com/kogunlowo123/terraform-azure-virtual-machine-linux
azure iaas linux-vm terraform terraform-module virtual-machine
Last synced: about 1 month ago
JSON representation
Terraform module for Azure Linux VMs with managed disks, extensions, and availability zones
- Host: GitHub
- URL: https://github.com/kogunlowo123/terraform-azure-virtual-machine-linux
- Owner: kogunlowo123
- License: mit
- Created: 2026-03-07T18:03:13.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-07T20:54:16.000Z (3 months ago)
- Last Synced: 2026-03-09T14:53:39.286Z (3 months ago)
- Topics: azure, iaas, linux-vm, terraform, terraform-module, virtual-machine
- Language: HCL
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-azure-virtual-machine-linux
Production-ready Terraform module for Azure Linux Virtual Machines with managed disks, SSH key authentication, Azure Monitor Agent, custom extensions, and backup integration.
## Architecture
```mermaid
flowchart TB
subgraph VM["Azure Linux Virtual Machine"]
direction TB
LVM[Linux VM]
OS[OS Disk - Encrypted]
SSH[SSH Key Auth]
ID[Managed Identity]
end
subgraph Storage["Data Disks"]
D1[Data Disk 1]
D2[Data Disk 2]
end
subgraph Extensions["Extensions"]
AMA[Azure Monitor Agent]
CST[Custom Extensions]
end
subgraph Backup["Backup"]
RSV[Recovery Services Vault]
POL[Backup Policy]
end
subgraph Monitoring["Monitoring"]
DCR[Data Collection Rules]
LA[Log Analytics]
end
LVM --> Storage
LVM --> Extensions
AMA --> Monitoring
LVM --> Backup
style VM fill:#0078D4,color:#fff
style Storage fill:#1A73E8,color:#fff
style Extensions fill:#3F8624,color:#fff
style Backup fill:#DD344C,color:#fff
style Monitoring fill:#FF9900,color:#fff
```
## Features
- SSH key authentication with password auth disabled by default
- Managed OS disk with configurable size, type, and encryption
- Additional data disks with independent configurations
- Azure Monitor Agent with data collection rule association
- Custom VM extensions support
- Boot diagnostics
- SystemAssigned and UserAssigned managed identity
- Azure Backup integration with Recovery Services Vault
- Availability zone placement
## Usage
### Basic
```hcl
module "linux_vm" {
source = "github.com/kogunlowo123/terraform-azure-virtual-machine-linux"
name = "my-linux-vm"
resource_group_name = azurerm_resource_group.this.name
location = "East US"
admin_username = "azureuser"
admin_ssh_public_key = file("~/.ssh/id_rsa.pub")
network_interface_ids = [azurerm_network_interface.this.id]
tags = { Environment = "production" }
}
```
## Requirements
| Name | Version |
|------|---------|
| terraform | >= 1.5.0 |
| azurerm | >= 3.80.0 |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|----------|
| name | VM name | `string` | n/a | yes |
| resource_group_name | Resource group name | `string` | n/a | yes |
| location | Azure region | `string` | n/a | yes |
| size | VM size | `string` | `"Standard_D2s_v5"` | no |
| admin_username | Admin username | `string` | `"azureuser"` | no |
| admin_ssh_public_key | SSH public key | `string` | n/a | yes |
| network_interface_ids | NIC IDs | `list(string)` | n/a | yes |
| data_disks | Map of data disk configs | `map(object)` | `{}` | no |
| enable_azure_monitor_agent | Enable AMA | `bool` | `true` | no |
| enable_backup | Enable backup | `bool` | `false` | no |
## Outputs
| Name | Description |
|------|-------------|
| vm_id | The ID of the VM |
| vm_name | The name of the VM |
| private_ip_address | The private IP |
| public_ip_address | The public IP |
| identity | The managed identity block |
| data_disk_ids | Map of data disk IDs |
## License
MIT Licensed. See [LICENSE](LICENSE) for details.