nixos-config/configs/nixos/plover/main.tf

72 lines
1.4 KiB
Terraform
Raw Normal View History

variable "hcloud_token" {
sensitive = true
}
variable "hcloud_dns_token" {
sensitive = true
}
provider "hcloud" {
token = var.hcloud_token
}
provider "hetznerdns" {
apitoken = var.hcloud_dns_token
}
resource "hetznerdns_zone" "main" {
name = "foodogsquared.one"
ttl = 3600
}
resource "hetznerdns_primary_server" "main" {
address = hcloud_server.plover.ipv4_address
port = 53
zone_id = hetznerdns_zone.main.id
}
resource "hcloud_server" "plover" {
2023-06-22 03:12:43 +00:00
name = "plover"
image = "debian-12"
server_type = "cx22"
2023-06-22 03:12:43 +00:00
location = "hel1"
datacenter = "hel1-dc2"
2023-06-22 03:12:43 +00:00
ssh_keys = [hcloud_ssh_key.foodogsquared.id]
2023-06-22 03:12:43 +00:00
delete_protection = true
rebuild_protection = true
public_net {
ipv4_enabled = true
ipv6_enabled = true
}
network {
2023-06-22 03:12:43 +00:00
network_id = hcloud_network.plover.id
ip = "10.0.0.1"
}
depends_on = [
hcloud_network_subnet.plover-subnet
]
}
resource "hcloud_ssh_key" "foodogsquared" {
2023-06-22 03:12:43 +00:00
name = "foodogsquared@foodogsquared.one"
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPR52KfVODfKsgdvYSoQinV3kyOTZ4mtKa0fah5Wkfr foodogsquared@foodogsquared.one"
}
resource "hcloud_network" "plover" {
2023-06-22 03:12:43 +00:00
name = "plover"
ip_range = "10.0.0.0/8"
delete_protection = true
}
resource "hcloud_network_subnet" "plover-subnet" {
2023-06-22 03:12:43 +00:00
network_id = hcloud_network.plover.id
type = "cloud"
network_zone = "eu-central"
ip_range = "10.0.0.0/12"
}