Skip to content
Snippets Groups Projects

SI-GitOps Terraform

This terraform definition is used to do the base deployment of cloud infrastructure for the future Kubernetes clusters.

Preparation

  1. Create a Hetzner Cloud account
  2. Create a Project on Hetzner Cloud
  3. Upload your SSH key(s) to Hetzner Cloud
  4. Create an API key for Hetzner Cloud and export it to your shell environment using export HCLOUD_TOKEN=<your token>
  5. Create and API key for Cloudflare and export your email address used for Cloudflare using export CLOUDFLARE_EMAIL=<your cloudflare email> and the API token using export CLOUDFLARE_API_TOKEN=<your cloudflare token>
  6. Install terraform

What does it do?

It'll deploy:

  • 3 control plane nodes on Hetzner Cloud with respective DNS entries on Cloudflare
  • 1 load balancer on Hetzner Cloud with a respective DNS entry on Cloudflare for the API
  • Firewall rules for all nodes as well as specific ones for the control plane and ingress nodes
  • A placement group that should prevent all nodes from ending up on the same machine
  • All nodes will get the required tools installed and configurations prepared for the Kubernetes bootstrapping

Why?

Because.

Deployment

To deploy the infrastructure you can just use the make-CLI this project provides by running make plan to preview the project and make apply to deploy the project.

Additional options

In order to customise the terraform commands, one is able to pass TERRAFORM_PARAMETERS as variable to the make command, which will pass them to the terraform commands. This can be used like TERRAFORM_PARAMETERS="-auto-approve" in order to run the commands in a CI environment.

You can also always run make help to get a help dialogue for all commands.