Infrastructure as code on Hetzner

Provisions infrastructure for a Golang application on Hetzner cloud. The code packs a Golang, PostgreSQL, S3(minio) images using packer then launches the infrastructure using Terraform with helpers such as bash, hcloud and supfile. The main reason behind the setup is the make it as cost effective as possible to launch a small to medium project.

Provision Infrastructure

  • Make sure you have hcloudsupfilepacker and terraform installed locally.
  • Start a new project on Hetzner and get your API token.
  • Rename vars.example.json to vars.json and add your config/secrets.
  • Replace ssh_authorized_keys in cloud-init/base.yml with your public key.
  • Run ./ up to start the provisioning

Destroy Infrastructure

  • Run ./ down to remove all images, volumes and instances.

Minio GUI where is your domain and notice we update Cloudflare DNS automatically while provisioning.

Get code on

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.