{"id":27944603,"url":"https://github.com/cwc1222/hcloud","last_synced_at":"2025-06-29T13:03:49.859Z","repository":{"id":291050417,"uuid":"974908934","full_name":"cwc1222/hcloud","owner":"cwc1222","description":"VPS management on Hetzner Cloud using Terraform and cloud-init","archived":false,"fork":false,"pushed_at":"2025-05-31T05:05:01.000Z","size":39,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T05:56:28.452Z","etag":null,"topics":["cloud-init","cloudflare","devops","helm","hetzner","k3s","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cwc1222.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-04-29T13:42:05.000Z","updated_at":"2025-05-24T18:03:44.000Z","dependencies_parsed_at":"2025-05-18T22:36:28.229Z","dependency_job_id":"b008129a-dc97-411d-bb03-703c4c486d8f","html_url":"https://github.com/cwc1222/hcloud","commit_stats":null,"previous_names":["cwc1222/hcloud"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cwc1222/hcloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwc1222%2Fhcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwc1222%2Fhcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwc1222%2Fhcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwc1222%2Fhcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cwc1222","download_url":"https://codeload.github.com/cwc1222/hcloud/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwc1222%2Fhcloud/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262598162,"owners_count":23334668,"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","cloudflare","devops","helm","hetzner","k3s","terraform"],"created_at":"2025-05-07T12:53:25.295Z","updated_at":"2025-06-29T13:03:49.812Z","avatar_url":"https://github.com/cwc1222.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hcloud\nVPS management on Hetzner Cloud\n\n## Quick Start\n\n```bash\n# Install wrangler to interact with cloudflare\nbun install\n# Create the R2 bucket to store the terraform state\nbun run create\n\n# export PG_CONN_STR=postgres://user:pass@db.example.com/terraform\n# terraform init\n\n# Remember to fill the cloudflare R2 bucket info in backend.hcl\n# bun run create // create r2 bucket tokens\n# cp backend.hcl.example backend.hcl // fill the previous output secrets to this file\nterraform init -backend-config=backend.hcl\nterraform plan\nterraform apply\nterraform destroy\n```\n\n## How to find available images\n\n1. Use curl\n\n```bash\ncurl \\\n\t-H \"Authorization: Bearer $H_API_TOKEN\" \\\n\t\"https://api.hetzner.cloud/v1/images\"\n\ncurl \\\n\t-H \"Authorization: Bearer $H_API_TOKEN\" \\\n\t\"https://api.hetzner.cloud/v1/images/$ID\"\n```\n\n2. Use [hcloud cli](https://github.com/hetznercloud/cli)\n\n```bash\nhcloud context create \u003cur-project-name\u003e\nhcloud image list -t system -a x86\n```\n\n## SSH Tunnels\n\nTo access the remote Postgres and K3S cluster without modifying the firewall rules,\nwhich only open 80, 443, and ssh for security concerns, we can use the ssh tunnel\nenabling the connection from the local machine to the remote services.\n\nThe *sshtunnels* folder has the systemd configurations and installation bash, following\nthe commands will install the systemd services.\n\n```bash\ncd sshtunnels/\n# Ensure the SSH_USER and REMOTE_HOST are configured in tne env\n# e.g., \n# - export SSH_USER=xxx\n# - export REMOTE_HOST=xxx\nbash install_tunnel.sh\n\n# Check the install services\nsystemctl status --user postgres-tunnel.service\nsystemctl status --user k3s-ssh-tunnel.service\n# To see the logs\njournalctl --user --unit=postgres-tunnel.service --no-pager\njournalctl --user --unit=k3s-ssh-tunnel.service --no-pager\n```\n\n## Reference\n\n- [developer.hashicorp.com/terraform/intro](https://developer.hashicorp.com/terraform/intro)\n- [docs.hetzner.com/cloud](https://docs.hetzner.com/cloud)\n- [registry.terraform.io/providers/hetznercloud/hcloud/latest/docs](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs)\n- [developer.hashicorp.com/terraform/tutorials/provision/cloud-init](https://developer.hashicorp.com/terraform/tutorials/provision/cloud-init)\n- [dennmart.com/articles/get-started-with-hetzner-cloud-and-terraform-for-easy-deployments/](https://dennmart.com/articles/get-started-with-hetzner-cloud-and-terraform-for-easy-deployments/)\n- [medium.com/@orestovyevhen/set-up-infrastructure-in-hetzner-cloud-using-terraform-ce85491e92d](https://medium.com/@orestovyevhen/set-up-infrastructure-in-hetzner-cloud-using-terraform-ce85491e92d)\n- [community.hetzner.com/tutorials/setup-your-own-scalable-kubernetes-cluster](https://community.hetzner.com/tutorials/setup-your-own-scalable-kubernetes-cluster)\n- [scottspence.com/posts/setting-up-my-vps-on-hetzner](https://scottspence.com/posts/setting-up-my-vps-on-hetzner)\n- [github.com/hetznercloud/cli](https://github.com/hetznercloud/cli)\n- [registry.terraform.io/providers/cloudflare/cloudflare/latest/docs](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs)\n- [developers.cloudflare.com/workers/wrangler/install-and-update](https://developers.cloudflare.com/workers/wrangler/install-and-update/)\n- [developers.cloudflare.com/terraform/advanced-topics/remote-backend](https://developers.cloudflare.com/terraform/advanced-topics/remote-backend/)\n- [medium.com/@GarisSpace/terraform-state-management-integrating-cloudflare-r2](https://medium.com/@GarisSpace/terraform-state-management-integrating-cloudflare-r2-b2e82798896d)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwc1222%2Fhcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcwc1222%2Fhcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwc1222%2Fhcloud/lists"}