Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Get Azure VM and VM Scale Set recommendations based on workload, performance, and budget needs.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
workflows/vm-creator/references/output-adapters/terraform.md
1# Terraform adapter23Multi-cloud, existing TF state, organization standardized on Terraform.45## Templates67Emit three code files to [`examples/terraform/`](../../examples/terraform/README.md):8- `main.tf` — provider, RG, VNet, subnet, NSG (SSH allow), public IP, NIC, Linux VM9- `variables.tf` — typed input variables with defaults10- `outputs.tf` — `vm_id`, `public_ip`1112Always emit `examples/terraform/README.md` (Plan Card, prereqs, quickstart, variables table, outputs, cleanup). When the user requests a PR (Mode C), the same README becomes the PR body.1314## Deploy1516```bash17terraform init18terraform plan -var "vm_name={vmName}" -var "admin_public_key=$(cat ~/.ssh/id_rsa.pub)" \19-var "subscription_id=$AZ_SUB" -var "resource_group_name={resourceGroup}"20terraform apply -var "vm_name={vmName}" -var "admin_public_key=$(cat ~/.ssh/id_rsa.pub)" \21-var "subscription_id=$AZ_SUB" -var "resource_group_name={resourceGroup}"22```2324## VMSS2526Replace `azurerm_linux_virtual_machine` with `azurerm_linux_virtual_machine_scale_set` (or Windows variants). Add `instances`, `upgrade_mode = "Manual" | "Automatic" | "Rolling"`. NIC moves inline inside the scale set resource via `network_interface { ip_configuration { ... } }`.2728## Notes29- Provider version pinned to `~> 4.0` — bump deliberately, not implicitly.30- `admin_public_key` is `sensitive = true`; don't print it.31- `zone` is `""` by default (regional); to pin, pass `"1"`, `"2"`, or `"3"`.32- Pre-check quota with `compute_vm_check-quota` before `terraform apply`.33