{"id":15698852,"url":"https://github.com/rgl/terraform-vsphere-ubuntu-example","last_synced_at":"2025-10-23T17:26:56.320Z","repository":{"id":45801345,"uuid":"215158592","full_name":"rgl/terraform-vsphere-ubuntu-example","owner":"rgl","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-18T18:33:01.000Z","size":16,"stargazers_count":11,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T09:38:41.021Z","etag":null,"topics":["cloud-init","example","terraform","ubuntu","vshpere"],"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}},"created_at":"2019-10-14T22:46:22.000Z","updated_at":"2025-02-23T19:10:52.000Z","dependencies_parsed_at":"2023-02-10T16:45:15.673Z","dependency_job_id":null,"html_url":"https://github.com/rgl/terraform-vsphere-ubuntu-example","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/rgl%2Fterraform-vsphere-ubuntu-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-ubuntu-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-ubuntu-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-vsphere-ubuntu-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/terraform-vsphere-ubuntu-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253155595,"owners_count":21862726,"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","ubuntu","vshpere"],"created_at":"2024-10-03T19:34:57.649Z","updated_at":"2025-10-23T17:26:51.269Z","avatar_url":"https://github.com/rgl.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Usage (Ubuntu 22.04 host)\n\nInstall the [Ubuntu 22.04 VM template](https://github.com/rgl/ubuntu-vagrant).\n\nInstall Terraform and govc (Ubuntu):\n\n```bash\nwget https://releases.hashicorp.com/terraform/1.3.7/terraform_1.3.7_linux_amd64.zip\nunzip terraform_1.3.7_linux_amd64.zip\nsudo install terraform /usr/local/bin\nrm terraform terraform_*_linux_amd64.zip\nwget https://github.com/vmware/govmomi/releases/download/v0.29.0/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.3.7 terraform\nchoco install -y --version 0.29.0 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='1' # [GiB]\nexport TF_VAR_vm_disk_os_size='10' # [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_ubuntu_template='vagrant-templates/ubuntu-22.04-amd64-vsphere'\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\nssh-keygen -f ~/.ssh/known_hosts -R \"$(terraform output --json ips | jq -r '.[0]')\"\nssh \"vagrant@$(terraform output --json ips | jq -r '.[0]')\"\nexit\ntime terraform destroy --auto-approve\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fterraform-vsphere-ubuntu-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fterraform-vsphere-ubuntu-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fterraform-vsphere-ubuntu-example/lists"}