Pulumi Tailscale Provider

raw JSON →
0.27.1 verified Sat May 09 auth: no python

A Pulumi package for creating and managing Tailscale cloud resources. Version 0.27.1 supports Python >=3.9, wraps the Terraform provider, and follows Pulumi’s major version release cadence (breaking changes alongside provider upgrades).

pip install pulumi-tailscale
error ModuleNotFoundError: No module named 'tailscale'
cause Importing the wrong module name.
fix
Use import pulumi_tailscale instead of import tailscale.
error pulumi.errors.ResourceError: resource '...' has a problem: expected 'userId' to be set
cause Using an older schema with `userId` on OAuthClient after v0.21.0 removed it.
fix
Remove the userId argument from OAuthClient resource definition.
breaking In v0.21.0, the `userId` input was removed from `oauthClient` resource and `nodeId` became required in `getDevicesDevice`. Check your stacks if upgrading from v0.20.x.
fix Remove `userId` from OAuthClient definitions and ensure `nodeId` is set in device queries.
deprecated The `tailscale.Provider` resource is deprecated; use `pulumi.providers.tailscale.Provider` instead.
fix Replace `from pulumi_tailscale import Provider` with `from pulumi_tailscale import Provider as TailscaleProvider` or switch to the new path.
gotcha Do not import from `tailscale` directly. The correct module is `pulumi_tailscale`.
fix Use `import pulumi_tailscale` or `from pulumi_tailscale import ...`

Creates a Tailnet key with the Tailscale provider.

import pulumi
import pulumi_tailscale as tailscale

# Requires TAILSCALE_API_KEY and TAILSCALE_TAILNET env vars
provider = tailscale.Provider(
    "ts-provider",
    api_key=os.environ.get('TAILSCALE_API_KEY', ''),
    tailnet=os.environ.get('TAILSCALE_TAILNET', ''),
)

# Create a Tailnet key
tailnet_key = tailscale.TailnetKey(
    "my-key",
    reusable=False,
    ephemeral=False,
    preauthorized=True,
    expiry_seconds=3600,
    tags=["tag:prod"],
    opts=pulumi.ResourceOptions(provider=provider),
)

pulumi.export("key", tailnet_key.key)