{"id":15155658,"url":"https://github.com/patkoch/terraform_virtual_machine_windows","last_synced_at":"2026-01-20T00:35:07.002Z","repository":{"id":77508401,"uuid":"443144452","full_name":"patkoch/terraform_virtual_machine_windows","owner":"patkoch","description":"Deployment of a Windows virtual machine on Azure using Terraform","archived":false,"fork":false,"pushed_at":"2023-12-29T23:32:54.000Z","size":348,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T15:19:43.249Z","etag":null,"topics":["azure","hashicorp-terraform","infrastructure-as-code","terraform","virtual-machine","vs-code"],"latest_commit_sha":null,"homepage":"https://www.patrickkoch.dev/posts/post_12/","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/patkoch.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":"2021-12-30T17:40:23.000Z","updated_at":"2023-12-29T22:21:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8f5a78e-4a19-41b2-9f08-56dbc1f7607d","html_url":"https://github.com/patkoch/terraform_virtual_machine_windows","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"38e5c72dc87dae682f16167af6ef483ca4fa4089"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patkoch%2Fterraform_virtual_machine_windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patkoch%2Fterraform_virtual_machine_windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patkoch%2Fterraform_virtual_machine_windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patkoch%2Fterraform_virtual_machine_windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patkoch","download_url":"https://codeload.github.com/patkoch/terraform_virtual_machine_windows/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247654979,"owners_count":20974104,"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":["azure","hashicorp-terraform","infrastructure-as-code","terraform","virtual-machine","vs-code"],"created_at":"2024-09-26T18:41:48.858Z","updated_at":"2026-01-20T00:35:06.965Z","avatar_url":"https://github.com/patkoch.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deployment of a Windows virtual machine on Azure using Terraform\n\nThis is the manual for the provisioning of a Windows virtual machine on Azure using Terraform.\n\n# Prerequisites\n\nDespite of having an *Azure* subscription, install following:\n\n - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)\n - [Terraform](https://developer.hashicorp.com/terraform/downloads)\n\n# Sources for the Terraform configuration\n\nI'd like to refer to following to links, which I've used for for that example:\n\n[Hashicorp - azurerm - Windows Virtual Machine](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/windows_virtual_machine)\n\n[Hashicorp - azurerm - public ip](https://registry.terraform.io/providers/hashicorp/azurerm/2.55.0/docs/resources/public_ip)\n\n# Deploy and destroy the Windows virtual machine with Terraform\n\nI recommend to conduct all commands in VS Code using a new Terminal.\n\n## Login in to Azure\n\nRun following command to start the login to *Azure*:\n\n```\naz login\n```\n\nA new browser session pops up, use the login credentials of your account:\n\n\u003cimg src=\"pictures/01_browser_login.png\" width=\"400\"\u003e\n\nAfter that, switch back to VS Code, you should see logs similar in the picture shown below:\n\n\u003cimg src=\"pictures/00_vs_code_az_login.png\" width=\"800\"\u003e\n\nYou can prove whether you are using the right subscription using the following command:\n\n```\naz account show\n```\nThis shows you the current subscription:\n\n\u003cimg src=\"pictures/02_vs_code_az_account_show.png\" width=\"400\"\u003e\n\n## Deploy the virtual machine \n\nThe first *Terraform* command is the \"init\" command:\n\n```\nterraform init\n```\nThe logs in the picture below show a successful execution of the command:\n\n\u003cimg src=\"pictures/03_vs_code_terraform_init.png\" width=\"400\"\u003e\n\nAs next, run the \"format\" command, to ensure that all files of your configuration stick to specific language style conventions:\n\n```\nterraform fmt\n```\n\nAfter that, ensure that your *Terraform* coniguration is valid by executing:\n\n```\nterraform validate\n```\n\n\u003cimg src=\"pictures/05_vs_code_terraform_validate.png\" width=\"400\"\u003e\n\nCreate now a *Terraform* plan file, by running:\n\n```\nterraform plan -out tfplan\n```\nThis creates a file named \"tfplan\" in your directory:\n\n\u003cimg src=\"pictures/06_vs_code_terraform_plan.png\" width=\"500\"\u003e\n\nFinally, the command can be executed for deploying the virtual machine on *Azure* - it uses the *Terraform* plan named \"tfplan\" as an argument:\n\n```\nterraform apply \"tfplan\"\n```\n\n\u003cimg src=\"pictures/07_vs_code_terraform_apply.png\" width=\"400\"\u003e\n\nThe deployment was successful if following log message appears:\n\n\u003cimg src=\"pictures/08_vs_code_apply_complete.png\" width=\"400\"\u003e\n\nProve the deployment of the virtual machine in the *Azure* portal:\n\n\u003cimg src=\"pictures/09_azure_portal_vm.png\" width=\"800\"\u003e\n\n## Destroy the virtual machine\n\nThe virtual machine can be destroyed using the following command:\n\n```\nterraform destroy\n```\n\n\u003cimg src=\"pictures/10_vs_code_terraform_destroy.png\" width=\"400\"\u003e\n\n# References\n\nhttps://developer.hashicorp.com/terraform/tutorials/azure-get-started/azure-build\n\nhttps://developer.hashicorp.com/terraform/cli/commands\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatkoch%2Fterraform_virtual_machine_windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatkoch%2Fterraform_virtual_machine_windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatkoch%2Fterraform_virtual_machine_windows/lists"}