{"id":15750813,"url":"https://github.com/rgl/terraform-vsphere-windows-example","last_synced_at":"2025-07-17T17:32:48.654Z","repository":{"id":65393590,"uuid":"215382265","full_name":"rgl/terraform-vsphere-windows-example","owner":"rgl","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-05T09:11:07.000Z","size":20,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T09:01:34.840Z","etag":null,"topics":["cloud-init","example","terraform","vsphere","windows"],"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/rgl.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-10-15T19:40:11.000Z","updated_at":"2024-11-05T09:11:12.000Z","dependencies_parsed_at":"2025-03-13T15:43:09.439Z","dependency_job_id":null,"html_url":"https://github.com/rgl/terraform-vsphere-windows-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rgl/terraform-vsphere-windows-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-windows-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-windows-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-windows-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-windows-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/terraform-vsphere-windows-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-windows-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265636857,"owners_count":23802574,"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":["cloud-init","example","terraform","vsphere","windows"],"created_at":"2024-10-04T07:00:18.627Z","updated_at":"2025-07-17T17:32:48.613Z","avatar_url":"https://github.com/rgl.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Usage (Ubuntu 22.04 host)\n\nInstall the [Windows 2022 VM template](https://github.com/rgl/windows-vagrant).\n\nInstall Terraform and govc (Ubuntu):\n\n```bash\nwget https://releases.hashicorp.com/terraform/1.9.8/terraform_1.9.8_linux_amd64.zip\nunzip terraform_1.9.8_linux_amd64.zip\nsudo install terraform /usr/local/bin\nrm terraform terraform_*_linux_amd64.zip\nwget https://github.com/vmware/govmomi/releases/download/v0.45.1/govc_Linux_x86_64.tar.gz\ntar xf govc_Linux_x86_64.tar.gz govc\nsudo install govc /usr/local/bin/govc\nrm govc govc_Linux_x86_64.tar.gz\n```\n\nInstall Terraform and govc (Windows):\n\n```bash\nchoco install -y --version 1.9.8 terraform\nchoco install -y --version 0.45.1 govc\n```\n\nSave your environment details as a script that sets the terraform variables from environment variables, e.g.:\n\n```bash\ncat \u003esecrets.sh \u003c\u003c'EOF'\nexport TF_VAR_vm_hostname_prefix='example'\nexport TF_VAR_vm_count='1'\nexport TF_VAR_vm_cpu='2'\nexport TF_VAR_vm_memory='4' # [GiB]\nexport TF_VAR_vm_disk_os_size='60' # [GiB]\nexport TF_VAR_vm_disk_data_size='1' # [GiB]\nexport TF_VAR_vsphere_user='administrator@vsphere.local'\nexport TF_VAR_vsphere_password='password'\nexport TF_VAR_vsphere_server='vsphere.local'\nexport TF_VAR_vsphere_datacenter='Datacenter'\nexport TF_VAR_vsphere_compute_cluster='Cluster'\nexport TF_VAR_vsphere_datastore='Datastore'\nexport TF_VAR_vsphere_network='VM Network'\nexport TF_VAR_vsphere_folder='example'\nexport TF_VAR_vsphere_windows_template='vagrant-templates/windows-2022-amd64-vsphere'\nexport TF_VAR_winrm_username='vagrant'\n# NB this value must meet the Windows password policy requirements.\n#    see https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/password-must-meet-complexity-requirements\nexport TF_VAR_winrm_password='HeyH0Password'\nexport GOVC_INSECURE='1'\nexport GOVC_URL=\"https://$TF_VAR_vsphere_server/sdk\"\nexport GOVC_USERNAME=\"$TF_VAR_vsphere_user\"\nexport GOVC_PASSWORD=\"$TF_VAR_vsphere_password\"\nEOF\n```\n\n**NB** You could also add these variables definitions into the `terraform.tfvars` file, but I find the environment variables more versatile as they can also be used from other tools, like govc.\n\nLaunch this example:\n\n```bash\nsource secrets.sh\n# see https://github.com/vmware/govmomi/blob/master/govc/USAGE.md\ngovc version\ngovc about\ngovc datacenter.info # list datacenters\ngovc find # find all managed objects\nterraform init\nterraform plan -out=tfplan\ntime terraform apply tfplan\n```\n\nLogin into the machine using SSH:\n\n```bash\nssh-keygen -f ~/.ssh/known_hosts -R \"$(terraform output --json ips | jq -r '.[0]')\"\nssh \"vagrant@$(terraform output --json ips | jq -r '.[0]')\"\ntype C:\\\\cloudinit-config-example.ps1.log\nexit # ssh\n```\n\nLogin into the machine using PowerShell Remoting over SSH:\n\n```bash\npwsh\nEnter-PSSession -HostName \"vagrant@$(terraform output --json ips | jq -r '.[0]')\"\n$PSVersionTable\nwhoami /all\nGet-Content C:/cloudinit-config-example.ps1.log\nexit # Enter-PSSession\nexit # pwsh\n```\n\nDestroy the infrastructure:\n\n```bash\ntime terraform destroy -auto-approve\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fterraform-vsphere-windows-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fterraform-vsphere-windows-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fterraform-vsphere-windows-example/lists"}