Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Terraform provider for Tailscale

License

NotificationsYou must be signed in to change notification settings

tailscale/terraform-provider-tailscale

Go ReferenceGo Report CardGithub Actions

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.

Getting Started

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.

Using OAuth client

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

API endpoint

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

Updating an existing installation

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/tailscale

Contributing

Please 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.

Local Provider Development

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.

Acceptance Tests

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_local

Releasing

Our 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

Stars

Watchers

Forks

Contributors40

Languages


[8]ページ先頭

©2009-2025 Movatter.jp