Skip to content

Commit

Permalink
Merge pull request #909 from myoung34/tailscale
Browse files Browse the repository at this point in the history
Add tailscale terraform for ACL management
  • Loading branch information
myoung34 authored Jan 30, 2025
2 parents c9fb125 + 88addc3 commit 818fa83
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
24 changes: 24 additions & 0 deletions terraform/tailscale/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions terraform/tailscale/acl.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
resource "tailscale_acl" "acl" {
acl = <<EOF
{
"tagOwners": {
"tag:k8s-operator": [],
"tag:k8s": ["tag:k8s-operator"],
},
"acls": [
//Allow all connections.
//Comment this section out if you want to define specific restrictions.
{"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.
// Comment this section out if you want to define specific restrictions.
{
"action": "check",
"src": ["autogroup:member"],
"dst": ["autogroup:self"],
"users": ["autogroup:nonroot", "root"],
},
{
"action": "accept",
"src": ["autogroup:member"],
"dst": ["tag:k8s"],
"users": ["[email protected]", "autogroup:nonroot", "myoung"],
},
],
"nodeAttrs": [
{
"target": ["*"],
"app": {
"tailscale.com/app-connectors": [],
},
},
{
"target": ["tag:k8s"],
"attr": ["funnel"],
},
{"target": ["100.125.107.125"], "attr": ["mullvad"]},
{"target": ["100.69.116.77"], "attr": ["mullvad"]},
{"target": ["100.119.170.123"], "attr": ["mullvad"]},
],
// Test access rules every time they're saved.
// "tests": [
// {
// "src": "[email protected]",
// "accept": ["tag:example"],
// "deny": ["100.101.102.103:443"],
// },
// ],
}
EOF
}
2 changes: 2 additions & 0 deletions terraform/tailscale/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
locals {
}
17 changes: 17 additions & 0 deletions terraform/tailscale/sources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
backend "s3" {
bucket = "terraform-847713735871-us-east-1"
key = "tailscale/terraform.tfstate"
region = "us-east-1"
encrypt = true
}
required_providers {
tailscale = {
source = "tailscale/tailscale"
version = "~> 0.17"
}
}
required_version = "1.10.5"
}

provider "tailscale" {}

0 comments on commit 818fa83

Please sign in to comment.