terraform-provider-tailscale

Go Reference Go Report Card Github Actions

This repository contains the source code for the Tailscale Terraform provider. This Terraform provider lets you interact with the Tailscale API.

See the documentation in the Terraform registry for the most up-to-date information and latest release.

This provider is maintained by Tailscale. Thanks to everyone who contributed to the development of the Tailscale Terraform provider, and special thanks to davidsbond.

Getting Started

To install this provider, copy and paste this code into your Terraform configuration. Then, run terraform init:

terraform {
  required_providers {
    tailscale = {
      source = "tailscale/tailscale"
      version = "~> 0.13" // Latest 0.13.x
    }
  }
}

provider "tailscale" {
  api_key = "tskey-api-..."
}

In the provider block, set your API key in the api_key field. Alternatively, use the TAILSCALE_API_KEY environment variable.

Using OAuth client

Instead of using a personal API key, you can configure the provider to use an OAuth client, e.g.:

provider "tailscale" {
  oauth_client_id = "..."
  oauth_client_secret = "tskey-client-..."
}

API endpoint

The default api endpoint is https://api.tailscale.com. If your coordination/control server API is at another endpoint, you can pass in base_url in the provider block.

provider "tailscale" {
  api_key = "tskey-api-..."
  base_url = "https://api.us.tailscale.com"
}

Updating an existing installation

To update an existing terraform deployment currently using the original davidsbond/tailscale provider, use:

terraform state replace-provider registry.terraform.io/davidsbond/tailscale registry.terraform.io/tailscale/tailscale

Contributing

Please review the contributing guidelines and code of conduct before contributing to this codebase. Please create a new issue for bugs and feature requests and fill in as much detail as you can.