Initial commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
terraform.tfvars
|
||||||
|
.terraform/
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.backup
|
||||||
|
.terraform.lock.hcl
|
||||||
@@ -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
|
||||||
|
```
|
||||||
@@ -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]
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
output "server_ip" {
|
||||||
|
value = hcloud_server.main.ipv4_address
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
hcloud_token = "your-api-token-here"
|
||||||
|
ssh_key_name = "your-ssh-key-name"
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user