Initial commit

This commit is contained in:
2026-05-18 13:01:32 -05:00
commit ad6af49bde
6 changed files with 62 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
terraform.tfvars
.terraform/
*.tfstate
*.tfstate.backup
.terraform.lock.hcl
+16
View File
@@ -0,0 +1,16 @@
# learningunix.net Infrastructure
Infrastructure as code for [learningunix.net](https://learningunix.net). Provisions a Debian server on Hetzner Cloud.
## Provisioning with OpenTofu
Requires a Hetzner API token and an SSH key registered in your Hetzner account. Copy `terraform.tfvars.example` to `terraform.tfvars` and fill in your values. Do not commit `terraform.tfvars`.
```
cd infra/tofu
tofu fmt
tofu init
tofu validate
tofu plan
tofu apply
```
+24
View File
@@ -0,0 +1,24 @@
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "~> 1.50"
}
}
}
provider "hcloud" {
token = var.hcloud_token
}
resource "hcloud_server" "main" {
name = "learningunix"
server_type = "cx23"
image = "debian-13"
location = var.location
ssh_keys = [var.ssh_key_name]
}
+4
View File
@@ -0,0 +1,4 @@
output "server_ip" {
value = hcloud_server.main.ipv4_address
}
+2
View File
@@ -0,0 +1,2 @@
hcloud_token = "your-api-token-here"
ssh_key_name = "your-ssh-key-name"
+11
View File
@@ -0,0 +1,11 @@
variable "hcloud_token" {
sensitive = true
}
variable "ssh_key_name" {
description = "Name of the SSH key registered in your Hetzner account"
}
variable "location" {
default = "nbg1"
}