feat(tf): tailscale

This commit is contained in:
arcnmx 2024-09-05 12:48:47 -07:00
parent ff688fb97a
commit a618279fed
10 changed files with 111 additions and 22 deletions

40
tf/tailscale_devices.tf Normal file
View file

@ -0,0 +1,40 @@
resource "tailscale_acl" "tailnet" {
acl = jsonencode({
tagOwners = {
"tag:reisen" : ["autogroup:admin"],
"tag:gensokyo" : ["autogroup:admin"],
}
acls = [
{
# Allow all connections
action = "accept"
src = ["*"]
dst = ["*:*"]
},
]
# Define users and devices that can use Tailscale SSH.
ssh = [
# Allow all users to SSH into their own devices in check mode.
{
action = "check",
src = ["autogroup:member"],
dst = ["autogroup:self"],
users = ["autogroup:nonroot", "root"],
},
],
})
}
resource "tailscale_tailnet_key" "reisen" {
reusable = true
ephemeral = false
preauthorized = true
description = "Reisen VM"
tags = ["tag:gensokyo", "tag:reisen"]
depends_on = [tailscale_acl.tailnet]
}
output "tailscale_key_reisen" {
value = tailscale_tailnet_key.reisen.key
sensitive = true
}