1. Packages
  2. Gcore Provider
  3. API Docs
  4. CloudNetworkRouter
Viewing docs for gcore 2.0.0-alpha.2
published on Tuesday, Mar 24, 2026 by g-core
gcore logo
Viewing docs for gcore 2.0.0-alpha.2
published on Tuesday, Mar 24, 2026 by g-core

    Routers interconnect subnets and manage network routing, including external gateway connectivity and static routes.

    Example Usage

    Router with external gateway

    Creates a router with an external gateway (SNAT enabled) and a subnet interface.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    // Create a router with external gateway and subnet interface
    const main = new gcore.CloudNetworkRouter("main", {
        projectId: 1,
        regionId: 1,
        name: "main-router",
        externalGatewayInfo: {
            enableSnat: true,
            type: "default",
        },
        interfaces: [{
            subnetId: _private.id,
            type: "subnet",
        }],
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    # Create a router with external gateway and subnet interface
    main = gcore.CloudNetworkRouter("main",
        project_id=1,
        region_id=1,
        name="main-router",
        external_gateway_info={
            "enable_snat": True,
            "type": "default",
        },
        interfaces=[{
            "subnet_id": private["id"],
            "type": "subnet",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/v2/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a router with external gateway and subnet interface
    		_, err := gcore.NewCloudNetworkRouter(ctx, "main", &gcore.CloudNetworkRouterArgs{
    			ProjectId: pulumi.Float64(1),
    			RegionId:  pulumi.Float64(1),
    			Name:      pulumi.String("main-router"),
    			ExternalGatewayInfo: &gcore.CloudNetworkRouterExternalGatewayInfoArgs{
    				EnableSnat: pulumi.Bool(true),
    				Type:       pulumi.String("default"),
    			},
    			Interfaces: gcore.CloudNetworkRouterInterfaceArray{
    				&gcore.CloudNetworkRouterInterfaceArgs{
    					SubnetId: pulumi.Any(private.Id),
    					Type:     pulumi.String("subnet"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a router with external gateway and subnet interface
        var main = new Gcore.CloudNetworkRouter("main", new()
        {
            ProjectId = 1,
            RegionId = 1,
            Name = "main-router",
            ExternalGatewayInfo = new Gcore.Inputs.CloudNetworkRouterExternalGatewayInfoArgs
            {
                EnableSnat = true,
                Type = "default",
            },
            Interfaces = new[]
            {
                new Gcore.Inputs.CloudNetworkRouterInterfaceArgs
                {
                    SubnetId = @private.Id,
                    Type = "subnet",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.CloudNetworkRouter;
    import com.pulumi.gcore.CloudNetworkRouterArgs;
    import com.pulumi.gcore.inputs.CloudNetworkRouterExternalGatewayInfoArgs;
    import com.pulumi.gcore.inputs.CloudNetworkRouterInterfaceArgs;
    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) {
            // Create a router with external gateway and subnet interface
            var main = new CloudNetworkRouter("main", CloudNetworkRouterArgs.builder()
                .projectId(1.0)
                .regionId(1.0)
                .name("main-router")
                .externalGatewayInfo(CloudNetworkRouterExternalGatewayInfoArgs.builder()
                    .enableSnat(true)
                    .type("default")
                    .build())
                .interfaces(CloudNetworkRouterInterfaceArgs.builder()
                    .subnetId(private_.id())
                    .type("subnet")
                    .build())
                .build());
    
        }
    }
    
    resources:
      # Create a router with external gateway and subnet interface
      main:
        type: gcore:CloudNetworkRouter
        properties:
          projectId: 1
          regionId: 1
          name: main-router
          externalGatewayInfo:
            enableSnat: true
            type: default
          interfaces:
            - subnetId: ${private.id}
              type: subnet
    

    Create CloudNetworkRouter Resource

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

    Constructor syntax

    new CloudNetworkRouter(name: string, args?: CloudNetworkRouterArgs, opts?: CustomResourceOptions);
    @overload
    def CloudNetworkRouter(resource_name: str,
                           args: Optional[CloudNetworkRouterArgs] = None,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def CloudNetworkRouter(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           external_gateway_info: Optional[CloudNetworkRouterExternalGatewayInfoArgs] = None,
                           interfaces: Optional[Sequence[CloudNetworkRouterInterfaceArgs]] = None,
                           name: Optional[str] = None,
                           project_id: Optional[float] = None,
                           region_id: Optional[float] = None,
                           routes: Optional[Sequence[CloudNetworkRouterRouteArgs]] = None)
    func NewCloudNetworkRouter(ctx *Context, name string, args *CloudNetworkRouterArgs, opts ...ResourceOption) (*CloudNetworkRouter, error)
    public CloudNetworkRouter(string name, CloudNetworkRouterArgs? args = null, CustomResourceOptions? opts = null)
    public CloudNetworkRouter(String name, CloudNetworkRouterArgs args)
    public CloudNetworkRouter(String name, CloudNetworkRouterArgs args, CustomResourceOptions options)
    
    type: gcore:CloudNetworkRouter
    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 CloudNetworkRouterArgs
    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 CloudNetworkRouterArgs
    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 CloudNetworkRouterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CloudNetworkRouterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CloudNetworkRouterArgs
    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 cloudNetworkRouterResource = new Gcore.CloudNetworkRouter("cloudNetworkRouterResource", new()
    {
        ExternalGatewayInfo = new Gcore.Inputs.CloudNetworkRouterExternalGatewayInfoArgs
        {
            EnableSnat = false,
            NetworkId = "string",
            Type = "string",
        },
        Interfaces = new[]
        {
            new Gcore.Inputs.CloudNetworkRouterInterfaceArgs
            {
                SubnetId = "string",
                Type = "string",
            },
        },
        Name = "string",
        ProjectId = 0,
        RegionId = 0,
        Routes = new[]
        {
            new Gcore.Inputs.CloudNetworkRouterRouteArgs
            {
                Destination = "string",
                Nexthop = "string",
            },
        },
    });
    
    example, err := gcore.NewCloudNetworkRouter(ctx, "cloudNetworkRouterResource", &gcore.CloudNetworkRouterArgs{
    	ExternalGatewayInfo: &gcore.CloudNetworkRouterExternalGatewayInfoArgs{
    		EnableSnat: pulumi.Bool(false),
    		NetworkId:  pulumi.String("string"),
    		Type:       pulumi.String("string"),
    	},
    	Interfaces: gcore.CloudNetworkRouterInterfaceArray{
    		&gcore.CloudNetworkRouterInterfaceArgs{
    			SubnetId: pulumi.String("string"),
    			Type:     pulumi.String("string"),
    		},
    	},
    	Name:      pulumi.String("string"),
    	ProjectId: pulumi.Float64(0),
    	RegionId:  pulumi.Float64(0),
    	Routes: gcore.CloudNetworkRouterRouteArray{
    		&gcore.CloudNetworkRouterRouteArgs{
    			Destination: pulumi.String("string"),
    			Nexthop:     pulumi.String("string"),
    		},
    	},
    })
    
    var cloudNetworkRouterResource = new CloudNetworkRouter("cloudNetworkRouterResource", CloudNetworkRouterArgs.builder()
        .externalGatewayInfo(CloudNetworkRouterExternalGatewayInfoArgs.builder()
            .enableSnat(false)
            .networkId("string")
            .type("string")
            .build())
        .interfaces(CloudNetworkRouterInterfaceArgs.builder()
            .subnetId("string")
            .type("string")
            .build())
        .name("string")
        .projectId(0.0)
        .regionId(0.0)
        .routes(CloudNetworkRouterRouteArgs.builder()
            .destination("string")
            .nexthop("string")
            .build())
        .build());
    
    cloud_network_router_resource = gcore.CloudNetworkRouter("cloudNetworkRouterResource",
        external_gateway_info={
            "enable_snat": False,
            "network_id": "string",
            "type": "string",
        },
        interfaces=[{
            "subnet_id": "string",
            "type": "string",
        }],
        name="string",
        project_id=0,
        region_id=0,
        routes=[{
            "destination": "string",
            "nexthop": "string",
        }])
    
    const cloudNetworkRouterResource = new gcore.CloudNetworkRouter("cloudNetworkRouterResource", {
        externalGatewayInfo: {
            enableSnat: false,
            networkId: "string",
            type: "string",
        },
        interfaces: [{
            subnetId: "string",
            type: "string",
        }],
        name: "string",
        projectId: 0,
        regionId: 0,
        routes: [{
            destination: "string",
            nexthop: "string",
        }],
    });
    
    type: gcore:CloudNetworkRouter
    properties:
        externalGatewayInfo:
            enableSnat: false
            networkId: string
            type: string
        interfaces:
            - subnetId: string
              type: string
        name: string
        projectId: 0
        regionId: 0
        routes:
            - destination: string
              nexthop: string
    

    CloudNetworkRouter 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 CloudNetworkRouter resource accepts the following input properties:

    ExternalGatewayInfo CloudNetworkRouterExternalGatewayInfo
    Interfaces List<CloudNetworkRouterInterface>
    List of interfaces to attach to router immediately after creation.
    Name string
    name of router
    ProjectId double
    RegionId double
    Routes List<CloudNetworkRouterRoute>
    List of custom routes.
    ExternalGatewayInfo CloudNetworkRouterExternalGatewayInfoArgs
    Interfaces []CloudNetworkRouterInterfaceArgs
    List of interfaces to attach to router immediately after creation.
    Name string
    name of router
    ProjectId float64
    RegionId float64
    Routes []CloudNetworkRouterRouteArgs
    List of custom routes.
    externalGatewayInfo CloudNetworkRouterExternalGatewayInfo
    interfaces List<CloudNetworkRouterInterface>
    List of interfaces to attach to router immediately after creation.
    name String
    name of router
    projectId Double
    regionId Double
    routes List<CloudNetworkRouterRoute>
    List of custom routes.
    externalGatewayInfo CloudNetworkRouterExternalGatewayInfo
    interfaces CloudNetworkRouterInterface[]
    List of interfaces to attach to router immediately after creation.
    name string
    name of router
    projectId number
    regionId number
    routes CloudNetworkRouterRoute[]
    List of custom routes.
    external_gateway_info CloudNetworkRouterExternalGatewayInfoArgs
    interfaces Sequence[CloudNetworkRouterInterfaceArgs]
    List of interfaces to attach to router immediately after creation.
    name str
    name of router
    project_id float
    region_id float
    routes Sequence[CloudNetworkRouterRouteArgs]
    List of custom routes.
    externalGatewayInfo Property Map
    interfaces List<Property Map>
    List of interfaces to attach to router immediately after creation.
    name String
    name of router
    projectId Number
    regionId Number
    routes List<Property Map>
    List of custom routes.

    Outputs

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

    CreatedAt string
    Datetime when the router was created
    CreatorTaskId string
    Task that created this entity
    Distributed bool
    Whether the router is distributed or centralized.
    Id string
    The provider-assigned unique ID for this managed resource.
    Region string
    Region name
    Status string
    Status of the router.
    UpdatedAt string
    Datetime when the router was last updated
    CreatedAt string
    Datetime when the router was created
    CreatorTaskId string
    Task that created this entity
    Distributed bool
    Whether the router is distributed or centralized.
    Id string
    The provider-assigned unique ID for this managed resource.
    Region string
    Region name
    Status string
    Status of the router.
    UpdatedAt string
    Datetime when the router was last updated
    createdAt String
    Datetime when the router was created
    creatorTaskId String
    Task that created this entity
    distributed Boolean
    Whether the router is distributed or centralized.
    id String
    The provider-assigned unique ID for this managed resource.
    region String
    Region name
    status String
    Status of the router.
    updatedAt String
    Datetime when the router was last updated
    createdAt string
    Datetime when the router was created
    creatorTaskId string
    Task that created this entity
    distributed boolean
    Whether the router is distributed or centralized.
    id string
    The provider-assigned unique ID for this managed resource.
    region string
    Region name
    status string
    Status of the router.
    updatedAt string
    Datetime when the router was last updated
    created_at str
    Datetime when the router was created
    creator_task_id str
    Task that created this entity
    distributed bool
    Whether the router is distributed or centralized.
    id str
    The provider-assigned unique ID for this managed resource.
    region str
    Region name
    status str
    Status of the router.
    updated_at str
    Datetime when the router was last updated
    createdAt String
    Datetime when the router was created
    creatorTaskId String
    Task that created this entity
    distributed Boolean
    Whether the router is distributed or centralized.
    id String
    The provider-assigned unique ID for this managed resource.
    region String
    Region name
    status String
    Status of the router.
    updatedAt String
    Datetime when the router was last updated

    Look up Existing CloudNetworkRouter Resource

    Get an existing CloudNetworkRouter 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?: CloudNetworkRouterState, opts?: CustomResourceOptions): CloudNetworkRouter
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            creator_task_id: Optional[str] = None,
            distributed: Optional[bool] = None,
            external_gateway_info: Optional[CloudNetworkRouterExternalGatewayInfoArgs] = None,
            interfaces: Optional[Sequence[CloudNetworkRouterInterfaceArgs]] = None,
            name: Optional[str] = None,
            project_id: Optional[float] = None,
            region: Optional[str] = None,
            region_id: Optional[float] = None,
            routes: Optional[Sequence[CloudNetworkRouterRouteArgs]] = None,
            status: Optional[str] = None,
            updated_at: Optional[str] = None) -> CloudNetworkRouter
    func GetCloudNetworkRouter(ctx *Context, name string, id IDInput, state *CloudNetworkRouterState, opts ...ResourceOption) (*CloudNetworkRouter, error)
    public static CloudNetworkRouter Get(string name, Input<string> id, CloudNetworkRouterState? state, CustomResourceOptions? opts = null)
    public static CloudNetworkRouter get(String name, Output<String> id, CloudNetworkRouterState state, CustomResourceOptions options)
    resources:  _:    type: gcore:CloudNetworkRouter    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:
    CreatedAt string
    Datetime when the router was created
    CreatorTaskId string
    Task that created this entity
    Distributed bool
    Whether the router is distributed or centralized.
    ExternalGatewayInfo CloudNetworkRouterExternalGatewayInfo
    Interfaces List<CloudNetworkRouterInterface>
    List of interfaces to attach to router immediately after creation.
    Name string
    name of router
    ProjectId double
    Region string
    Region name
    RegionId double
    Routes List<CloudNetworkRouterRoute>
    List of custom routes.
    Status string
    Status of the router.
    UpdatedAt string
    Datetime when the router was last updated
    CreatedAt string
    Datetime when the router was created
    CreatorTaskId string
    Task that created this entity
    Distributed bool
    Whether the router is distributed or centralized.
    ExternalGatewayInfo CloudNetworkRouterExternalGatewayInfoArgs
    Interfaces []CloudNetworkRouterInterfaceArgs
    List of interfaces to attach to router immediately after creation.
    Name string
    name of router
    ProjectId float64
    Region string
    Region name
    RegionId float64
    Routes []CloudNetworkRouterRouteArgs
    List of custom routes.
    Status string
    Status of the router.
    UpdatedAt string
    Datetime when the router was last updated
    createdAt String
    Datetime when the router was created
    creatorTaskId String
    Task that created this entity
    distributed Boolean
    Whether the router is distributed or centralized.
    externalGatewayInfo CloudNetworkRouterExternalGatewayInfo
    interfaces List<CloudNetworkRouterInterface>
    List of interfaces to attach to router immediately after creation.
    name String
    name of router
    projectId Double
    region String
    Region name
    regionId Double
    routes List<CloudNetworkRouterRoute>
    List of custom routes.
    status String
    Status of the router.
    updatedAt String
    Datetime when the router was last updated
    createdAt string
    Datetime when the router was created
    creatorTaskId string
    Task that created this entity
    distributed boolean
    Whether the router is distributed or centralized.
    externalGatewayInfo CloudNetworkRouterExternalGatewayInfo
    interfaces CloudNetworkRouterInterface[]
    List of interfaces to attach to router immediately after creation.
    name string
    name of router
    projectId number
    region string
    Region name
    regionId number
    routes CloudNetworkRouterRoute[]
    List of custom routes.
    status string
    Status of the router.
    updatedAt string
    Datetime when the router was last updated
    created_at str
    Datetime when the router was created
    creator_task_id str
    Task that created this entity
    distributed bool
    Whether the router is distributed or centralized.
    external_gateway_info CloudNetworkRouterExternalGatewayInfoArgs
    interfaces Sequence[CloudNetworkRouterInterfaceArgs]
    List of interfaces to attach to router immediately after creation.
    name str
    name of router
    project_id float
    region str
    Region name
    region_id float
    routes Sequence[CloudNetworkRouterRouteArgs]
    List of custom routes.
    status str
    Status of the router.
    updated_at str
    Datetime when the router was last updated
    createdAt String
    Datetime when the router was created
    creatorTaskId String
    Task that created this entity
    distributed Boolean
    Whether the router is distributed or centralized.
    externalGatewayInfo Property Map
    interfaces List<Property Map>
    List of interfaces to attach to router immediately after creation.
    name String
    name of router
    projectId Number
    region String
    Region name
    regionId Number
    routes List<Property Map>
    List of custom routes.
    status String
    Status of the router.
    updatedAt String
    Datetime when the router was last updated

    Supporting Types

    CloudNetworkRouterExternalGatewayInfo, CloudNetworkRouterExternalGatewayInfoArgs

    EnableSnat bool
    Is SNAT enabled. Defaults to true.
    NetworkId string
    id of the external network.
    Type string
    must be 'manual'. Available values: "manual", "default".
    EnableSnat bool
    Is SNAT enabled. Defaults to true.
    NetworkId string
    id of the external network.
    Type string
    must be 'manual'. Available values: "manual", "default".
    enableSnat Boolean
    Is SNAT enabled. Defaults to true.
    networkId String
    id of the external network.
    type String
    must be 'manual'. Available values: "manual", "default".
    enableSnat boolean
    Is SNAT enabled. Defaults to true.
    networkId string
    id of the external network.
    type string
    must be 'manual'. Available values: "manual", "default".
    enable_snat bool
    Is SNAT enabled. Defaults to true.
    network_id str
    id of the external network.
    type str
    must be 'manual'. Available values: "manual", "default".
    enableSnat Boolean
    Is SNAT enabled. Defaults to true.
    networkId String
    id of the external network.
    type String
    must be 'manual'. Available values: "manual", "default".

    CloudNetworkRouterInterface, CloudNetworkRouterInterfaceArgs

    SubnetId string
    id of the subnet to attach to.
    Type string
    must be 'subnet'. Available values: "subnet".
    SubnetId string
    id of the subnet to attach to.
    Type string
    must be 'subnet'. Available values: "subnet".
    subnetId String
    id of the subnet to attach to.
    type String
    must be 'subnet'. Available values: "subnet".
    subnetId string
    id of the subnet to attach to.
    type string
    must be 'subnet'. Available values: "subnet".
    subnet_id str
    id of the subnet to attach to.
    type str
    must be 'subnet'. Available values: "subnet".
    subnetId String
    id of the subnet to attach to.
    type String
    must be 'subnet'. Available values: "subnet".

    CloudNetworkRouterRoute, CloudNetworkRouterRouteArgs

    Destination string
    CIDR of destination IPv4 subnet.
    Nexthop string
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    Destination string
    CIDR of destination IPv4 subnet.
    Nexthop string
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination String
    CIDR of destination IPv4 subnet.
    nexthop String
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination string
    CIDR of destination IPv4 subnet.
    nexthop string
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination str
    CIDR of destination IPv4 subnet.
    nexthop str
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination String
    CIDR of destination IPv4 subnet.
    nexthop String
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.

    Import

    $ pulumi import gcore:index/cloudNetworkRouter:CloudNetworkRouter example '<project_id>/<region_id>/<router_id>'
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    gcore g-core/terraform-provider-gcore
    License
    Notes
    This Pulumi package is based on the gcore Terraform Provider.
    gcore logo
    Viewing docs for gcore 2.0.0-alpha.2
    published on Tuesday, Mar 24, 2026 by g-core
      Try Pulumi Cloud free. Your team will thank you.