- Notifications
You must be signed in to change notification settings - Fork52
Terraform provider for Tailscale
License
tailscale/terraform-provider-tailscale
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository contains the source code for theTailscale Terraform provider.This Terraform provider lets you interact with theTailscale API.
See thedocumentation in the Terraform registryfor 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 todavidsbond.
To install this provider, copy and paste this code into your Terraform configuration. Then, runterraform init:
terraform {required_providers {tailscale={ source="tailscale/tailscale" version="~> 0.16"// Latest 0.16.x } }}provider"tailscale" {api_key="tskey-api-..."}
In theprovider block, set your API key in theapi_key field. Alternatively, use theTAILSCALE_API_KEY environment variable.
Instead of using a personal API key, you can configure the provider to use anOAuth client, e.g.:
provider"tailscale" {oauth_client_id="..."oauth_client_secret="tskey-client-..."}
The default api endpoint ishttps://api.tailscale.com. If your coordination/control server API is at another endpoint, you can pass inbase_url in the provider block.
provider"tailscale" {api_key="tskey-api-..."base_url="https://api.us.tailscale.com"}
To update an existing terraform deployment currently using the originaldavidsbond/tailscale provider, use:
terraform state replace-provider registry.terraform.io/davidsbond/tailscale registry.terraform.io/tailscale/tailscalePlease review thecontributing guidelines andcode of conduct beforecontributing to this codebase. Please create anew issuefor bugs and feature requests and fill in as much detail as you can.
TheTerraform plugin documentation on debuggingprovides helpful strategies for debugging while developing plugins.
Namely, adding adevelopment overridefor thetailscale/tailscale provider allows for using your local copy of the provider instead of a published version.
Yourterraformrc should look something like the following:
provider_installation {# This disables the version and checksum verifications for this# provider and forces Terraform to look for the tailscale/tailscale# provider plugin in the given directory.dev_overrides {"tailscale/tailscale" ="/path/to/this/repo/on/disk" }# For all other providers, install them directly from their origin provider# registries as normal. If you omit this, Terraform will _only_ use# the dev_overrides block, and so no other providers will be available.direct {}}
Remember to runmake build to build the provider and pick up your local changes.
Tests in this repo that are prefixed withTestAcc are acceptance tests which run against a real instance of the tailscale control plane.These tests are skipped unless theTF_ACC environment variable is set.Runningmake testacc sets theTF_ACC variable and runs the tests.
TheTF_ACC environment variable is handled byTerraform core codeand is not directly referenced in provider code.
The following tailscale specific environment variables must also be set:
TAILSCALE_BASE_URL- URL of the control plane
TAILSCALE_API_KEY- Tests will be performed against the tailnet which the key belongs to
TAILSCALE_TEST_DEVICE_NAME- The FQDN of a device owned by the owner of the API key in use
If you run a local control server with theterraform-acceptance-testing test scenario, then you can use the make ruletestacc_localwhich will correctly populate the necessary environment variables for you.
./tool/go run -tags tailscale_saas ./cmd/devcontrol --generate-test-devices=terraform-acceptance-testing &make testacc_localOur releases follow sem-ver format and follow the recommended versioning practicesas documented by HashiCorp.
Pushing a tag of the formatvX.Y.Z will trigger therelease workflow which usesgoreleaser to build and sign artifacts and generate aGitHub release.
GitHub releases are pulled in and served by theHashiCorp Terrafrom andOpenTofu registries for usage of the provider via Terraform or OpenTofu.
About
Terraform provider for Tailscale
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.