Tailscale

v0.11.0 published on Tuesday, Aug 30, 2022 by Pulumi

DeviceSubnetRoutes

The device_subnet_routes resource allows you to configure subnet routes for your Tailscale devices. See https://tailscale.com/kb/1019/subnets for more information.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Tailscale = Pulumi.Tailscale;

return await Deployment.RunAsync(() => 
{
    var sampleDevice = Tailscale.GetDevice.Invoke(new()
    {
        Name = "device.example.com",
    });

    var sampleRoutes = new Tailscale.DeviceSubnetRoutes("sampleRoutes", new()
    {
        DeviceId = sampleDevice.Apply(getDeviceResult => getDeviceResult.Id),
        Routes = new[]
        {
            "10.0.1.0/24",
            "1.2.0.0/16",
            "2.0.0.0/24",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-tailscale/sdk/go/tailscale"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		sampleDevice, err := tailscale.GetDevice(ctx, &GetDeviceArgs{
			Name: "device.example.com",
		}, nil)
		if err != nil {
			return err
		}
		_, err = tailscale.NewDeviceSubnetRoutes(ctx, "sampleRoutes", &tailscale.DeviceSubnetRoutesArgs{
			DeviceId: pulumi.String(sampleDevice.Id),
			Routes: pulumi.StringArray{
				pulumi.String("10.0.1.0/24"),
				pulumi.String("1.2.0.0/16"),
				pulumi.String("2.0.0.0/24"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tailscale.TailscaleFunctions;
import com.pulumi.tailscale.inputs.GetDeviceArgs;
import com.pulumi.tailscale.DeviceSubnetRoutes;
import com.pulumi.tailscale.DeviceSubnetRoutesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var sampleDevice = TailscaleFunctions.getDevice(GetDeviceArgs.builder()
            .name("device.example.com")
            .build());

        var sampleRoutes = new DeviceSubnetRoutes("sampleRoutes", DeviceSubnetRoutesArgs.builder()        
            .deviceId(sampleDevice.applyValue(getDeviceResult -> getDeviceResult.id()))
            .routes(            
                "10.0.1.0/24",
                "1.2.0.0/16",
                "2.0.0.0/24")
            .build());

    }
}
import pulumi
import pulumi_tailscale as tailscale

sample_device = tailscale.get_device(name="device.example.com")
sample_routes = tailscale.DeviceSubnetRoutes("sampleRoutes",
    device_id=sample_device.id,
    routes=[
        "10.0.1.0/24",
        "1.2.0.0/16",
        "2.0.0.0/24",
    ])
import * as pulumi from "@pulumi/pulumi";
import * as tailscale from "@pulumi/tailscale";

const sampleDevice = tailscale.getDevice({
    name: "device.example.com",
});
const sampleRoutes = new tailscale.DeviceSubnetRoutes("sampleRoutes", {
    deviceId: sampleDevice.then(sampleDevice => sampleDevice.id),
    routes: [
        "10.0.1.0/24",
        "1.2.0.0/16",
        "2.0.0.0/24",
    ],
});
resources:
  sampleRoutes:
    type: tailscale:DeviceSubnetRoutes
    properties:
      deviceId: ${sampleDevice.id}
      routes:
        - 10.0.1.0/24
        - 1.2.0.0/16
        - 2.0.0.0/24
variables:
  sampleDevice:
    Fn::Invoke:
      Function: tailscale:getDevice
      Arguments:
        name: device.example.com

Create a DeviceSubnetRoutes Resource

new DeviceSubnetRoutes(name: string, args: DeviceSubnetRoutesArgs, opts?: CustomResourceOptions);
@overload
def DeviceSubnetRoutes(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       device_id: Optional[str] = None,
                       routes: Optional[Sequence[str]] = None)
@overload
def DeviceSubnetRoutes(resource_name: str,
                       args: DeviceSubnetRoutesArgs,
                       opts: Optional[ResourceOptions] = None)
func NewDeviceSubnetRoutes(ctx *Context, name string, args DeviceSubnetRoutesArgs, opts ...ResourceOption) (*DeviceSubnetRoutes, error)
public DeviceSubnetRoutes(string name, DeviceSubnetRoutesArgs args, CustomResourceOptions? opts = null)
public DeviceSubnetRoutes(String name, DeviceSubnetRoutesArgs args)
public DeviceSubnetRoutes(String name, DeviceSubnetRoutesArgs args, CustomResourceOptions options)
type: tailscale:DeviceSubnetRoutes
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DeviceSubnetRoutesArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args DeviceSubnetRoutesArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DeviceSubnetRoutesArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DeviceSubnetRoutesArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DeviceSubnetRoutesArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

DeviceSubnetRoutes Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The DeviceSubnetRoutes resource accepts the following input properties:

DeviceId string

The device to set subnet routes for

Routes List<string>

The subnet routes that are enabled to be routed by a device

DeviceId string

The device to set subnet routes for

Routes []string

The subnet routes that are enabled to be routed by a device

deviceId String

The device to set subnet routes for

routes List<String>

The subnet routes that are enabled to be routed by a device

deviceId string

The device to set subnet routes for

routes string[]

The subnet routes that are enabled to be routed by a device

device_id str

The device to set subnet routes for

routes Sequence[str]

The subnet routes that are enabled to be routed by a device

deviceId String

The device to set subnet routes for

routes List<String>

The subnet routes that are enabled to be routed by a device

Outputs

All input properties are implicitly available as output properties. Additionally, the DeviceSubnetRoutes resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing DeviceSubnetRoutes Resource

Get an existing DeviceSubnetRoutes resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DeviceSubnetRoutesState, opts?: CustomResourceOptions): DeviceSubnetRoutes
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        device_id: Optional[str] = None,
        routes: Optional[Sequence[str]] = None) -> DeviceSubnetRoutes
func GetDeviceSubnetRoutes(ctx *Context, name string, id IDInput, state *DeviceSubnetRoutesState, opts ...ResourceOption) (*DeviceSubnetRoutes, error)
public static DeviceSubnetRoutes Get(string name, Input<string> id, DeviceSubnetRoutesState? state, CustomResourceOptions? opts = null)
public static DeviceSubnetRoutes get(String name, Output<String> id, DeviceSubnetRoutesState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DeviceId string

The device to set subnet routes for

Routes List<string>

The subnet routes that are enabled to be routed by a device

DeviceId string

The device to set subnet routes for

Routes []string

The subnet routes that are enabled to be routed by a device

deviceId String

The device to set subnet routes for

routes List<String>

The subnet routes that are enabled to be routed by a device

deviceId string

The device to set subnet routes for

routes string[]

The subnet routes that are enabled to be routed by a device

device_id str

The device to set subnet routes for

routes Sequence[str]

The subnet routes that are enabled to be routed by a device

deviceId String

The device to set subnet routes for

routes List<String>

The subnet routes that are enabled to be routed by a device

Package Details

Repository
https://github.com/pulumi/pulumi-tailscale
License
Apache-2.0
Notes

This Pulumi package is based on the tailscale Terraform Provider.