1. Packages
  2. Packages
  3. Twingate
  4. API Docs
  5. TwingateGateway
Viewing docs for Twingate v4.1.0
published on Monday, Apr 13, 2026 by Twingate
twingate logo
Viewing docs for Twingate v4.1.0
published on Monday, Apr 13, 2026 by Twingate

    Gateways are the Twingate components that route traffic to remote networks.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as std from "@pulumi/std";
    import * as twingate from "@twingate/pulumi-twingate";
    
    const gcp = new twingate.TwingateRemoteNetwork("gcp", {name: "GCP Network"});
    const tls = new twingate.TwingateX509CertificateAuthority("tls", {
        name: "My TLS CA",
        certificate: std.file({
            input: "ca.pem",
        }).then(invoke => invoke.result),
    });
    const ssh = new twingate.TwingateSSHCertificateAuthority("ssh", {
        name: "My SSH CA",
        publicKey: std.file({
            input: "~/.ssh/id_ed25519.pub",
        }).then(invoke => std.trimspace({
            input: invoke.result,
        })).then(invoke => invoke.result),
    });
    // Gateway with both X.509 and SSH CAs
    const main = new twingate.TwingateGateway("main", {
        remoteNetworkId: gcp.id,
        address: "10.0.0.1:8443",
        x509CaId: tls.id,
        sshCaId: ssh.id,
    });
    // Gateway with only X.509 CA (ssh_ca_id is optional)
    const minimal = new twingate.TwingateGateway("minimal", {
        remoteNetworkId: gcp.id,
        address: "10.0.0.2:9001",
        x509CaId: tls.id,
    });
    
    import pulumi
    import pulumi_std as std
    import pulumi_twingate as twingate
    
    gcp = twingate.TwingateRemoteNetwork("gcp", name="GCP Network")
    tls = twingate.TwingateX509CertificateAuthority("tls",
        name="My TLS CA",
        certificate=std.file(input="ca.pem").result)
    ssh = twingate.TwingateSSHCertificateAuthority("ssh",
        name="My SSH CA",
        public_key=std.trimspace(input=std.file(input="~/.ssh/id_ed25519.pub").result).result)
    # Gateway with both X.509 and SSH CAs
    main = twingate.TwingateGateway("main",
        remote_network_id=gcp.id,
        address="10.0.0.1:8443",
        x509_ca_id=tls.id,
        ssh_ca_id=ssh.id)
    # Gateway with only X.509 CA (ssh_ca_id is optional)
    minimal = twingate.TwingateGateway("minimal",
        remote_network_id=gcp.id,
        address="10.0.0.2:9001",
        x509_ca_id=tls.id)
    
    package main
    
    import (
    	"github.com/Twingate/pulumi-twingate/sdk/v4/go/twingate"
    	"github.com/pulumi/pulumi-std/sdk/v2/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		gcp, err := twingate.NewTwingateRemoteNetwork(ctx, "gcp", &twingate.TwingateRemoteNetworkArgs{
    			Name: pulumi.String("GCP Network"),
    		})
    		if err != nil {
    			return err
    		}
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "ca.pem",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		tls, err := twingate.NewTwingateX509CertificateAuthority(ctx, "tls", &twingate.TwingateX509CertificateAuthorityArgs{
    			Name:        pulumi.String("My TLS CA"),
    			Certificate: pulumi.String(invokeFile.Result),
    		})
    		if err != nil {
    			return err
    		}
    		invokeTrimspace1, err := std.Trimspace(ctx, &std.TrimspaceArgs{
    			Input: std.File(ctx, &std.FileArgs{
    				Input: "~/.ssh/id_ed25519.pub",
    			}, nil).Result,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ssh, err := twingate.NewTwingateSSHCertificateAuthority(ctx, "ssh", &twingate.TwingateSSHCertificateAuthorityArgs{
    			Name:      pulumi.String("My SSH CA"),
    			PublicKey: pulumi.String(invokeTrimspace1.Result),
    		})
    		if err != nil {
    			return err
    		}
    		// Gateway with both X.509 and SSH CAs
    		_, err = twingate.NewTwingateGateway(ctx, "main", &twingate.TwingateGatewayArgs{
    			RemoteNetworkId: gcp.ID(),
    			Address:         pulumi.String("10.0.0.1:8443"),
    			X509CaId:        tls.ID(),
    			SshCaId:         ssh.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		// Gateway with only X.509 CA (ssh_ca_id is optional)
    		_, err = twingate.NewTwingateGateway(ctx, "minimal", &twingate.TwingateGatewayArgs{
    			RemoteNetworkId: gcp.ID(),
    			Address:         pulumi.String("10.0.0.2:9001"),
    			X509CaId:        tls.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Std = Pulumi.Std;
    using Twingate = Twingate.Twingate;
    
    return await Deployment.RunAsync(() => 
    {
        var gcp = new Twingate.TwingateRemoteNetwork("gcp", new()
        {
            Name = "GCP Network",
        });
    
        var tls = new Twingate.TwingateX509CertificateAuthority("tls", new()
        {
            Name = "My TLS CA",
            Certificate = Std.File.Invoke(new()
            {
                Input = "ca.pem",
            }).Apply(invoke => invoke.Result),
        });
    
        var ssh = new Twingate.TwingateSSHCertificateAuthority("ssh", new()
        {
            Name = "My SSH CA",
            PublicKey = Std.File.Invoke(new()
            {
                Input = "~/.ssh/id_ed25519.pub",
            }).Apply(invoke => Std.Trimspace.Invoke(new()
            {
                Input = invoke.Result,
            })).Apply(invoke => invoke.Result),
        });
    
        // Gateway with both X.509 and SSH CAs
        var main = new Twingate.TwingateGateway("main", new()
        {
            RemoteNetworkId = gcp.Id,
            Address = "10.0.0.1:8443",
            X509CaId = tls.Id,
            SshCaId = ssh.Id,
        });
    
        // Gateway with only X.509 CA (ssh_ca_id is optional)
        var minimal = new Twingate.TwingateGateway("minimal", new()
        {
            RemoteNetworkId = gcp.Id,
            Address = "10.0.0.2:9001",
            X509CaId = tls.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.twingate.TwingateRemoteNetwork;
    import com.pulumi.twingate.TwingateRemoteNetworkArgs;
    import com.pulumi.twingate.TwingateX509CertificateAuthority;
    import com.pulumi.twingate.TwingateX509CertificateAuthorityArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.FileArgs;
    import com.pulumi.twingate.TwingateSSHCertificateAuthority;
    import com.pulumi.twingate.TwingateSSHCertificateAuthorityArgs;
    import com.pulumi.std.inputs.TrimspaceArgs;
    import com.pulumi.twingate.TwingateGateway;
    import com.pulumi.twingate.TwingateGatewayArgs;
    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) {
            var gcp = new TwingateRemoteNetwork("gcp", TwingateRemoteNetworkArgs.builder()
                .name("GCP Network")
                .build());
    
            var tls = new TwingateX509CertificateAuthority("tls", TwingateX509CertificateAuthorityArgs.builder()
                .name("My TLS CA")
                .certificate(StdFunctions.file(FileArgs.builder()
                    .input("ca.pem")
                    .build()).result())
                .build());
    
            var ssh = new TwingateSSHCertificateAuthority("ssh", TwingateSSHCertificateAuthorityArgs.builder()
                .name("My SSH CA")
                .publicKey(StdFunctions.trimspace(TrimspaceArgs.builder()
                    .input(StdFunctions.file(FileArgs.builder()
                        .input("~/.ssh/id_ed25519.pub")
                        .build()).result())
                    .build()).result())
                .build());
    
            // Gateway with both X.509 and SSH CAs
            var main = new TwingateGateway("main", TwingateGatewayArgs.builder()
                .remoteNetworkId(gcp.id())
                .address("10.0.0.1:8443")
                .x509CaId(tls.id())
                .sshCaId(ssh.id())
                .build());
    
            // Gateway with only X.509 CA (ssh_ca_id is optional)
            var minimal = new TwingateGateway("minimal", TwingateGatewayArgs.builder()
                .remoteNetworkId(gcp.id())
                .address("10.0.0.2:9001")
                .x509CaId(tls.id())
                .build());
    
        }
    }
    
    resources:
      gcp:
        type: twingate:TwingateRemoteNetwork
        properties:
          name: GCP Network
      tls:
        type: twingate:TwingateX509CertificateAuthority
        properties:
          name: My TLS CA
          certificate:
            fn::invoke:
              function: std:file
              arguments:
                input: ca.pem
              return: result
      ssh:
        type: twingate:TwingateSSHCertificateAuthority
        properties:
          name: My SSH CA
          publicKey:
            fn::invoke:
              function: std:trimspace
              arguments:
                input:
                  fn::invoke:
                    function: std:file
                    arguments:
                      input: ~/.ssh/id_ed25519.pub
                    return: result
              return: result
      # Gateway with both X.509 and SSH CAs
      main:
        type: twingate:TwingateGateway
        properties:
          remoteNetworkId: ${gcp.id}
          address: 10.0.0.1:8443
          x509CaId: ${tls.id}
          sshCaId: ${ssh.id}
      # Gateway with only X.509 CA (ssh_ca_id is optional)
      minimal:
        type: twingate:TwingateGateway
        properties:
          remoteNetworkId: ${gcp.id}
          address: 10.0.0.2:9001
          x509CaId: ${tls.id}
    

    Create TwingateGateway Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TwingateGateway(name: string, args: TwingateGatewayArgs, opts?: CustomResourceOptions);
    @overload
    def TwingateGateway(resource_name: str,
                        args: TwingateGatewayArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def TwingateGateway(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        address: Optional[str] = None,
                        remote_network_id: Optional[str] = None,
                        x509_ca_id: Optional[str] = None,
                        ssh_ca_id: Optional[str] = None)
    func NewTwingateGateway(ctx *Context, name string, args TwingateGatewayArgs, opts ...ResourceOption) (*TwingateGateway, error)
    public TwingateGateway(string name, TwingateGatewayArgs args, CustomResourceOptions? opts = null)
    public TwingateGateway(String name, TwingateGatewayArgs args)
    public TwingateGateway(String name, TwingateGatewayArgs args, CustomResourceOptions options)
    
    type: twingate:TwingateGateway
    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 TwingateGatewayArgs
    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 TwingateGatewayArgs
    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 TwingateGatewayArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TwingateGatewayArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TwingateGatewayArgs
    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 twingateGatewayResource = new Twingate.TwingateGateway("twingateGatewayResource", new()
    {
        Address = "string",
        RemoteNetworkId = "string",
        X509CaId = "string",
        SshCaId = "string",
    });
    
    example, err := twingate.NewTwingateGateway(ctx, "twingateGatewayResource", &twingate.TwingateGatewayArgs{
    	Address:         pulumi.String("string"),
    	RemoteNetworkId: pulumi.String("string"),
    	X509CaId:        pulumi.String("string"),
    	SshCaId:         pulumi.String("string"),
    })
    
    var twingateGatewayResource = new TwingateGateway("twingateGatewayResource", TwingateGatewayArgs.builder()
        .address("string")
        .remoteNetworkId("string")
        .x509CaId("string")
        .sshCaId("string")
        .build());
    
    twingate_gateway_resource = twingate.TwingateGateway("twingateGatewayResource",
        address="string",
        remote_network_id="string",
        x509_ca_id="string",
        ssh_ca_id="string")
    
    const twingateGatewayResource = new twingate.TwingateGateway("twingateGatewayResource", {
        address: "string",
        remoteNetworkId: "string",
        x509CaId: "string",
        sshCaId: "string",
    });
    
    type: twingate:TwingateGateway
    properties:
        address: string
        remoteNetworkId: string
        sshCaId: string
        x509CaId: string
    

    TwingateGateway Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The TwingateGateway resource accepts the following input properties:

    Address string
    The address of the Gateway.
    RemoteNetworkId string
    The ID of the Remote Network the Gateway belongs to.
    X509CaId string
    The ID of the X.509 Certificate Authority used for TLS.
    SshCaId string
    The ID of the SSH Certificate Authority used for SSH access.
    Address string
    The address of the Gateway.
    RemoteNetworkId string
    The ID of the Remote Network the Gateway belongs to.
    X509CaId string
    The ID of the X.509 Certificate Authority used for TLS.
    SshCaId string
    The ID of the SSH Certificate Authority used for SSH access.
    address String
    The address of the Gateway.
    remoteNetworkId String
    The ID of the Remote Network the Gateway belongs to.
    x509CaId String
    The ID of the X.509 Certificate Authority used for TLS.
    sshCaId String
    The ID of the SSH Certificate Authority used for SSH access.
    address string
    The address of the Gateway.
    remoteNetworkId string
    The ID of the Remote Network the Gateway belongs to.
    x509CaId string
    The ID of the X.509 Certificate Authority used for TLS.
    sshCaId string
    The ID of the SSH Certificate Authority used for SSH access.
    address str
    The address of the Gateway.
    remote_network_id str
    The ID of the Remote Network the Gateway belongs to.
    x509_ca_id str
    The ID of the X.509 Certificate Authority used for TLS.
    ssh_ca_id str
    The ID of the SSH Certificate Authority used for SSH access.
    address String
    The address of the Gateway.
    remoteNetworkId String
    The ID of the Remote Network the Gateway belongs to.
    x509CaId String
    The ID of the X.509 Certificate Authority used for TLS.
    sshCaId String
    The ID of the SSH Certificate Authority used for SSH access.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TwingateGateway 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 TwingateGateway Resource

    Get an existing TwingateGateway 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?: TwingateGatewayState, opts?: CustomResourceOptions): TwingateGateway
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address: Optional[str] = None,
            remote_network_id: Optional[str] = None,
            ssh_ca_id: Optional[str] = None,
            x509_ca_id: Optional[str] = None) -> TwingateGateway
    func GetTwingateGateway(ctx *Context, name string, id IDInput, state *TwingateGatewayState, opts ...ResourceOption) (*TwingateGateway, error)
    public static TwingateGateway Get(string name, Input<string> id, TwingateGatewayState? state, CustomResourceOptions? opts = null)
    public static TwingateGateway get(String name, Output<String> id, TwingateGatewayState state, CustomResourceOptions options)
    resources:  _:    type: twingate:TwingateGateway    get:      id: ${id}
    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:
    Address string
    The address of the Gateway.
    RemoteNetworkId string
    The ID of the Remote Network the Gateway belongs to.
    SshCaId string
    The ID of the SSH Certificate Authority used for SSH access.
    X509CaId string
    The ID of the X.509 Certificate Authority used for TLS.
    Address string
    The address of the Gateway.
    RemoteNetworkId string
    The ID of the Remote Network the Gateway belongs to.
    SshCaId string
    The ID of the SSH Certificate Authority used for SSH access.
    X509CaId string
    The ID of the X.509 Certificate Authority used for TLS.
    address String
    The address of the Gateway.
    remoteNetworkId String
    The ID of the Remote Network the Gateway belongs to.
    sshCaId String
    The ID of the SSH Certificate Authority used for SSH access.
    x509CaId String
    The ID of the X.509 Certificate Authority used for TLS.
    address string
    The address of the Gateway.
    remoteNetworkId string
    The ID of the Remote Network the Gateway belongs to.
    sshCaId string
    The ID of the SSH Certificate Authority used for SSH access.
    x509CaId string
    The ID of the X.509 Certificate Authority used for TLS.
    address str
    The address of the Gateway.
    remote_network_id str
    The ID of the Remote Network the Gateway belongs to.
    ssh_ca_id str
    The ID of the SSH Certificate Authority used for SSH access.
    x509_ca_id str
    The ID of the X.509 Certificate Authority used for TLS.
    address String
    The address of the Gateway.
    remoteNetworkId String
    The ID of the Remote Network the Gateway belongs to.
    sshCaId String
    The ID of the SSH Certificate Authority used for SSH access.
    x509CaId String
    The ID of the X.509 Certificate Authority used for TLS.

    Package Details

    Repository
    twingate Twingate/pulumi-twingate
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the twingate Terraform Provider.
    twingate logo
    Viewing docs for Twingate v4.1.0
    published on Monday, Apr 13, 2026 by Twingate
      Try Pulumi Cloud free. Your team will thank you.