diff --git a/main.tf b/main.tf index 455f8f7..350d44f 100644 --- a/main.tf +++ b/main.tf @@ -1,11 +1,23 @@ # https://www.tweag.io/blog/2019-04-03-terraform-provider-secret/ # resource "secret_resource" "" {} + +##### provider block start +# + # https://www.linode.com/docs/guides/secrets-management-with-terraform/ provider "linode" { token = var.linode_token } +provider "tailscale" { + api_key = var.tailscale_api_key + tailnet = var.tailscale_tailnet +} + +# +##### provider block end + resource "linode_sshkey" "surtur" { label = "nbgw" ssh_key = chomp(file("~/.ssh/surtur.pub")) diff --git a/tailscale.tf b/tailscale.tf new file mode 100644 index 0000000..d82ee9e --- /dev/null +++ b/tailscale.tf @@ -0,0 +1,3 @@ +resource "tailscale_dns_preferences" "magic_dns" { + magic_dns = true +} diff --git a/terraform.tf b/terraform.tf index 4f86c68..4840971 100644 --- a/terraform.tf +++ b/terraform.tf @@ -4,6 +4,11 @@ terraform { linode = { source = "linode/linode" } + + tailscale = { + source = "tailscale/tailscale" + version = "0.13.7" + } } # init using: tfi -backend-config=path/to/decrypted/infra-backend diff --git a/variables.tf b/variables.tf index d848503..b2ae951 100644 --- a/variables.tf +++ b/variables.tf @@ -20,3 +20,13 @@ variable "linode_wheel_login" { type = string description = "username of the admin user" } + +variable "tailscale_api_key" { + type = string + description = "Tailscale API key" +} + +variable "tailscale_tailnet" { + type = string + description = "Tailscale Tailnet to manage" +}