{"id":24849356,"url":"https://github.com/bugbiteme/demo-tform-vm-azure","last_synced_at":"2026-01-06T21:09:46.758Z","repository":{"id":71384493,"uuid":"224945787","full_name":"bugbiteme/demo-tform-vm-azure","owner":"bugbiteme","description":"Terraform to provision a VM in Azure","archived":false,"fork":false,"pushed_at":"2020-10-12T23:40:34.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T12:36:16.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugbiteme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-30T01:54:40.000Z","updated_at":"2020-10-12T23:40:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5e0e472-0a32-4e9f-842c-7ba6949299be","html_url":"https://github.com/bugbiteme/demo-tform-vm-azure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-vm-azure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-vm-azure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-vm-azure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-vm-azure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugbiteme","download_url":"https://codeload.github.com/bugbiteme/demo-tform-vm-azure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245642738,"owners_count":20648910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-31T12:30:57.748Z","updated_at":"2026-01-06T21:09:46.720Z","avatar_url":"https://github.com/bugbiteme.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# az_terraform\nTerraform to provision a VM in Azure\n\nAuthenticates to Azure using either a Service Principal or Managed Service Identity.\n\nInstructions for setting up authentication:\n\n```\nhttps://www.terraform.io/docs/providers/azurerm/guides/service_principal_client_secret.html\n```\n\nIf you have multiple Azure subscriptions, first query your account with az account list to get a list of subscription ID and tenant ID values:\n\nAzure CLI\n\n`az account list --query \"[].{name:name, subscriptionId:id, tenantId:tenantId}\"`\n\nTo use a selected subscription, set the subscription for this session with az account set. Set the SUBSCRIPTION_ID environment variable to hold the value of the returned id field from the subscription you want to use:\n\nAzure CLI\n\n`az account set --subscription=\"${SUBSCRIPTION_ID}\"`\n\nNow you can create a service principal for use with Terraform. Use az ad sp create-for-rbac, and set the scope to your subscription as follows:\n\nAzure CLI\n\n`az ad sp create-for-rbac --role=\"Contributor\" --scopes=\"/subscriptions/${SUBSCRIPTION_ID}\"`\n\nYour appId, password, sp_name, and tenant are returned. Make a note of the appId and password.\n\n```\nARM_SUBSCRIPTION_ID\nARM_CLIENT_ID\nARM_CLIENT_SECRET\nARM_TENANT_ID\nARM_ENVIRONMENT\n```\n\nbefore running \n\n`terraform apply`\n\nplease generate the ssh key (default \"id_rsa.pub\")\n\n*Note: you can generate the key with any name you want, but you need to update the variable with the new filename/location\n\nOnce the VM has been created by terraform, you can get the public IP adress by running the following command:\n\n`az vm show --resource-group myResourceGroup --name myVM -d --query [publicIps] --o tsv`\n\nThen connect to VM using the ssh key:\n\n`ssh -i \"~/.ssh/id_rsa\" azureuser@\u003cIP address\u003e`\n\n(source: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)\n\nNotes: Outputs for public IP address may be blank once `terraform apply` completes. You can then run the command \n`terraform refresh` to obtain these values.\n\nIf anyone reading this has a workaround, please let me know (beer or lunch will be on me!)\n\nTo show configuration:\n`terraform show`\n\nList resources in the state\n`terraform state list`\n\nTo visualize dependencies:\n`terraform graph | dot -Tsvg \u003e graph.svg`\n## Requirements\n\n| Name | Version |\n|------|---------|\n| terraform | ~\u003e 0.12 |\n| archive | ~\u003e 1.2 |\n| azurerm | ~\u003e 1.44 |\n| random | ~\u003e 2.2 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| azurerm | ~\u003e 1.44 |\n| random | ~\u003e 2.2 |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| admin\\_username | n/a | `string` | `\"azureuser\"` | no |\n| client\\_id | client\\_id used in azure provider | `string` | n/a | yes |\n| client\\_secret | client\\_secret used in azure provider | `string` | n/a | yes |\n| namespace | n/a | `string` | `\"Terraform Demo\"` | no |\n| pivate\\_key | n/a | `string` | `\"~/.ssh/id_rsa\"` | no |\n| public\\_key | n/a | `string` | `\"~/.ssh/id_rsa.pub\"` | no |\n| region | n/a | `string` | `\"westus2\"` | no |\n| subscription\\_id | subscription\\_id used in azure provider | `string` | n/a | yes |\n| tenant\\_id | tenant\\_id used in azure provider | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| admin\\_username | Username needed to log into VM consol |\n| connection\\_string | Copy/Paste/Enter - You are in the matrix |\n| public\\_ip\\_address | Public IP address of VM |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugbiteme%2Fdemo-tform-vm-azure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugbiteme%2Fdemo-tform-vm-azure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugbiteme%2Fdemo-tform-vm-azure/lists"}