| .. | ||
| main.tf | ||
| outputs.tf | ||
| README.md | ||
| variables.tf | ||
Hetzner Cloud Terraform Setup
This directory manages Hetzner Cloud resources using Terraform.
Prerequisites
- Create a Hetzner Cloud API token: https://console.hetzner.cloud/projects
- (Optional) Register your SSH key in Hetzner Cloud for secure access.
Usage
- Set your API token as an environment variable:
export TF_VAR_hcloud_token="<your-token>" - (Optional) Set SSH key names, image, and location:
export TF_VAR_hcloud_ssh_keys='["your-key-name"]' - Run Terraform:
terraform init terraform plan terraform apply
Outputs
- The server's public IPv4 address and ID will be shown after apply.
Destroying the Server
terraform destroy