tailscale.DeviceSubnetRoutes
Explore with Pulumi AI
Example Usage
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("sample_routes", {
deviceId: sampleDevice.then(sampleDevice => sampleDevice.id),
routes: [
"10.0.1.0/24",
"1.2.0.0/16",
"2.0.0.0/24",
],
});
const sampleExitNode = new tailscale.DeviceSubnetRoutes("sample_exit_node", {
deviceId: sampleDevice.then(sampleDevice => sampleDevice.id),
routes: [
"0.0.0.0/0",
"::/0",
],
});
import pulumi
import pulumi_tailscale as tailscale
sample_device = tailscale.get_device(name="device.example.com")
sample_routes = tailscale.DeviceSubnetRoutes("sample_routes",
device_id=sample_device.id,
routes=[
"10.0.1.0/24",
"1.2.0.0/16",
"2.0.0.0/24",
])
sample_exit_node = tailscale.DeviceSubnetRoutes("sample_exit_node",
device_id=sample_device.id,
routes=[
"0.0.0.0/0",
"::/0",
])
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, &tailscale.GetDeviceArgs{
Name: pulumi.StringRef("device.example.com"),
}, nil)
if err != nil {
return err
}
_, err = tailscale.NewDeviceSubnetRoutes(ctx, "sample_routes", &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
}
_, err = tailscale.NewDeviceSubnetRoutes(ctx, "sample_exit_node", &tailscale.DeviceSubnetRoutesArgs{
DeviceId: pulumi.String(sampleDevice.Id),
Routes: pulumi.StringArray{
pulumi.String("0.0.0.0/0"),
pulumi.String("::/0"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
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("sample_routes", new()
{
DeviceId = sampleDevice.Apply(getDeviceResult => getDeviceResult.Id),
Routes = new[]
{
"10.0.1.0/24",
"1.2.0.0/16",
"2.0.0.0/24",
},
});
var sampleExitNode = new Tailscale.DeviceSubnetRoutes("sample_exit_node", new()
{
DeviceId = sampleDevice.Apply(getDeviceResult => getDeviceResult.Id),
Routes = new[]
{
"0.0.0.0/0",
"::/0",
},
});
});
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());
var sampleExitNode = new DeviceSubnetRoutes("sampleExitNode", DeviceSubnetRoutesArgs.builder()
.deviceId(sampleDevice.applyValue(getDeviceResult -> getDeviceResult.id()))
.routes(
"0.0.0.0/0",
"::/0")
.build());
}
}
resources:
sampleRoutes:
type: tailscale:DeviceSubnetRoutes
name: sample_routes
properties:
deviceId: ${sampleDevice.id}
routes:
- 10.0.1.0/24
- 1.2.0.0/16
- 2.0.0.0/24
sampleExitNode:
type: tailscale:DeviceSubnetRoutes
name: sample_exit_node
properties:
deviceId: ${sampleDevice.id}
routes:
- 0.0.0.0/0
- ::/0
variables:
sampleDevice:
fn::invoke:
Function: tailscale:getDevice
Arguments:
name: device.example.com
Create DeviceSubnetRoutes Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DeviceSubnetRoutes(name: string, args: DeviceSubnetRoutesArgs, opts?: CustomResourceOptions);
@overload
def DeviceSubnetRoutes(resource_name: str,
args: DeviceSubnetRoutesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DeviceSubnetRoutes(resource_name: str,
opts: Optional[ResourceOptions] = None,
device_id: Optional[str] = None,
routes: Optional[Sequence[str]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var deviceSubnetRoutesResource = new Tailscale.DeviceSubnetRoutes("deviceSubnetRoutesResource", new()
{
DeviceId = "string",
Routes = new[]
{
"string",
},
});
example, err := tailscale.NewDeviceSubnetRoutes(ctx, "deviceSubnetRoutesResource", &tailscale.DeviceSubnetRoutesArgs{
DeviceId: pulumi.String("string"),
Routes: pulumi.StringArray{
pulumi.String("string"),
},
})
var deviceSubnetRoutesResource = new DeviceSubnetRoutes("deviceSubnetRoutesResource", DeviceSubnetRoutesArgs.builder()
.deviceId("string")
.routes("string")
.build());
device_subnet_routes_resource = tailscale.DeviceSubnetRoutes("deviceSubnetRoutesResource",
device_id="string",
routes=["string"])
const deviceSubnetRoutesResource = new tailscale.DeviceSubnetRoutes("deviceSubnetRoutesResource", {
deviceId: "string",
routes: ["string"],
});
type: tailscale:DeviceSubnetRoutes
properties:
deviceId: string
routes:
- string
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:
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 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.
Import
Device subnet rules can be imported using the device id, e.g.,
$ pulumi import tailscale:index/deviceSubnetRoutes:DeviceSubnetRoutes sample 123456789
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tailscale pulumi/pulumi-tailscale
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
tailscale
Terraform Provider.