hosts/plover/terraform: add Tailscale resources

Not automated per-se since we are dealing with
not-NixOS-but-only-after-it-is-installed Hetzner server. I really have
to figure that part out.
This commit is contained in:
Gabriel Arazas 2024-10-12 13:15:38 +08:00
parent c1cdb7b48b
commit 560230645f
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,22 @@
data "tailscale_device" "plover" {
hostname = "plover"
}
resource "tailscale_device_authorization" "plover_authorization" {
device_id = data.tailscale_device.plover.id
authorized = true
depends_on = [ hcloud_server.plover ]
}
resource "tailscale_tailnet_key" "plover" {
reusable = false
ephemeral = false
preauthorized = true
recreate_if_invalid = "always"
description = "Plover"
}
resource "local_file" "tailscale_auth_key" {
content = tailscale_tailnet_key.plover.key
filename = "${path.module}/plover-tailscale-auth-key"
}

View File

@ -9,5 +9,15 @@ terraform {
source = "timohirt/hetznerdns" source = "timohirt/hetznerdns"
version = "2.2.0" version = "2.2.0"
} }
tailscale = {
source = "tailscale/tailscale"
version = "0.17.2"
}
local = {
source = "hashicorp/local"
version = "2.5.2"
}
} }
} }