tf: add tailscale configuration

This commit is contained in:
surtur 2023-08-03 22:37:07 +02:00
parent b3673f9a2f
commit 253c68f590
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
4 changed files with 30 additions and 0 deletions

12
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"))

3
tailscale.tf Normal file

@ -0,0 +1,3 @@
resource "tailscale_dns_preferences" "magic_dns" {
magic_dns = true
}

@ -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

@ -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"
}