infrastructure/modules/infrastructure/tailscale.tf

20 lines
495 B
HCL

resource "tailscale_tailnet_key" "cloud_init_key" {
reusable = true
ephemeral = false
preauthorized = true
expiry = 21600 # 6 hours
description = "Cloud-init key used by opentofu"
}
resource "time_sleep" "wait_for_hosts" {
for_each = var.hosts
depends_on = [hcloud_server.nodes]
create_duration = "60s"
}
data "tailscale_device" "nodes" {
for_each = var.hosts
depends_on = [time_sleep.wait_for_hosts]
hostname = each.value.hostname
wait_for = "60s"
}