43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# Terraform Hetzner Setup
|
|
|
|
This Terraform configuration creates a single Hetzner Cloud server in Nuremberg and manages an SSH key. It also outputs the IPv4 and IPv6 addresses of the server.
|
|
|
|
> ⚠️ Note: Hetzner Cloud Terraform provider does **not** support object storage buckets natively. You will need to create any buckets manually or use an S3-compatible provider.
|
|
|
|
---
|
|
|
|
## Project Structure
|
|
|
|
terraform-hetzner/
|
|
├── main.tf # SSH key, server resource
|
|
├── provider.tf # Hetzner provider configuration
|
|
├── variables.tf # Input variables (API token)
|
|
├── outputs.tf # Outputs IPv4 and IPv6 addresses
|
|
|
|
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
- [Terraform](https://www.terraform.io/downloads) >= 1.3
|
|
- Hetzner Cloud account
|
|
- Hetzner Cloud API token
|
|
- Your SSH public key
|
|
|
|
---
|
|
|
|
## Steps to Run
|
|
|
|
1. **Clone this repository** or copy the files to a folder:
|
|
|
|
```bash
|
|
git clone <your-repo-url>
|
|
cd terraform
|
|
|
|
2. Set your Hetzner API token in the environment
|
|
|
|
export HCLOUD_TOKEN="your-api-token"
|
|
|
|
4. Initialize Terraform
|
|
terraform init
|
|
terraform apply -var="hcloud_token=$HCLOUD_TOKEN" |