This terraform script sets up a single VPS in Hetzner Cloud ready to be used with Kamal.
I love the Django, SQLite, and Redis combo. So I like setting up a single VPS where I can have everything I need.
- Generate two SSH keys, one for the root user and one for the kamal user using
make generate-ssh-key USER_NAME=root
andmake generate-ssh-key USER_NAME=kamal
- Generate a new API key in Hetzner Cloud and save it in a secure place
- Create a file
terraform.tfvars
at the root of the repository with your Hetzner API key and SSH keys, it will look like this:hetzner_api_key = "your-api-key" ssh_vps_root_key = "<your-ssh-root-public-key>" ssh_vps_kamal_key = "<your-ssh-kamal-public-key>"
- Run
terraform init
to initialize the terraform environment - Run
terraform plan
to see the changes that will be applied - Run
terraform apply
to apply the changes
This script is based on the great work of luizkowalski in terraform-hetzner.