published on Monday, Mar 30, 2026 by g-core
published on Monday, Mar 30, 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.Index.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:
- External
Gateway CloudInfo Network Router External Gateway Info - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - Interfaces
List<Cloud
Network Router Interface> - List of interfaces to attach to router immediately after creation.
- Name string
- name of router
- Project
Id double - Region
Id double - Routes
List<Cloud
Network Router Route> - List of custom routes.
- External
Gateway CloudInfo Network Router External Gateway Info Args - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - Interfaces
[]Cloud
Network Router Interface Args - List of interfaces to attach to router immediately after creation.
- Name string
- name of router
- Project
Id float64 - Region
Id float64 - Routes
[]Cloud
Network Router Route Args - List of custom routes.
- external
Gateway CloudInfo Network Router External Gateway Info - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces
List<Cloud
Network Router Interface> - List of interfaces to attach to router immediately after creation.
- name String
- name of router
- project
Id Double - region
Id Double - routes
List<Cloud
Network Router Route> - List of custom routes.
- external
Gateway CloudInfo Network Router External Gateway Info - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces
Cloud
Network Router Interface[] - List of interfaces to attach to router immediately after creation.
- name string
- name of router
- project
Id number - region
Id number - routes
Cloud
Network Router Route[] - List of custom routes.
- external_
gateway_ Cloudinfo Network Router External Gateway Info Args - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces
Sequence[Cloud
Network Router Interface Args] - List of interfaces to attach to router immediately after creation.
- name str
- name of router
- project_
id float - region_
id float - routes
Sequence[Cloud
Network Router Route Args] - List of custom routes.
- external
Gateway Property MapInfo - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces List<Property Map>
- List of interfaces to attach to router immediately after creation.
- name String
- name of router
- project
Id Number - region
Id 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:
- Created
At string - Datetime when the router was created
- Creator
Task stringId - 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.
- Updated
At string - Datetime when the router was last updated
- Created
At string - Datetime when the router was created
- Creator
Task stringId - 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.
- Updated
At string - Datetime when the router was last updated
- created
At String - Datetime when the router was created
- creator
Task StringId - 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.
- updated
At String - Datetime when the router was last updated
- created
At string - Datetime when the router was created
- creator
Task stringId - 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.
- updated
At string - Datetime when the router was last updated
- created_
at str - Datetime when the router was created
- creator_
task_ strid - 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
- created
At String - Datetime when the router was created
- creator
Task StringId - 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.
- updated
At 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) -> CloudNetworkRouterfunc 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.
- Created
At string - Datetime when the router was created
- Creator
Task stringId - Task that created this entity
- Distributed bool
- Whether the router is distributed or centralized.
- External
Gateway CloudInfo Network Router External Gateway Info - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - Interfaces
List<Cloud
Network Router Interface> - List of interfaces to attach to router immediately after creation.
- Name string
- name of router
- Project
Id double - Region string
- Region name
- Region
Id double - Routes
List<Cloud
Network Router Route> - List of custom routes.
- Status string
- Status of the router.
- Updated
At string - Datetime when the router was last updated
- Created
At string - Datetime when the router was created
- Creator
Task stringId - Task that created this entity
- Distributed bool
- Whether the router is distributed or centralized.
- External
Gateway CloudInfo Network Router External Gateway Info Args - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - Interfaces
[]Cloud
Network Router Interface Args - List of interfaces to attach to router immediately after creation.
- Name string
- name of router
- Project
Id float64 - Region string
- Region name
- Region
Id float64 - Routes
[]Cloud
Network Router Route Args - List of custom routes.
- Status string
- Status of the router.
- Updated
At string - Datetime when the router was last updated
- created
At String - Datetime when the router was created
- creator
Task StringId - Task that created this entity
- distributed Boolean
- Whether the router is distributed or centralized.
- external
Gateway CloudInfo Network Router External Gateway Info - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces
List<Cloud
Network Router Interface> - List of interfaces to attach to router immediately after creation.
- name String
- name of router
- project
Id Double - region String
- Region name
- region
Id Double - routes
List<Cloud
Network Router Route> - List of custom routes.
- status String
- Status of the router.
- updated
At String - Datetime when the router was last updated
- created
At string - Datetime when the router was created
- creator
Task stringId - Task that created this entity
- distributed boolean
- Whether the router is distributed or centralized.
- external
Gateway CloudInfo Network Router External Gateway Info - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces
Cloud
Network Router Interface[] - List of interfaces to attach to router immediately after creation.
- name string
- name of router
- project
Id number - region string
- Region name
- region
Id number - routes
Cloud
Network Router Route[] - List of custom routes.
- status string
- Status of the router.
- updated
At string - Datetime when the router was last updated
- created_
at str - Datetime when the router was created
- creator_
task_ strid - Task that created this entity
- distributed bool
- Whether the router is distributed or centralized.
- external_
gateway_ Cloudinfo Network Router External Gateway Info Args - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces
Sequence[Cloud
Network Router Interface Args] - 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[Cloud
Network Router Route Args] - List of custom routes.
- status str
- Status of the router.
- updated_
at str - Datetime when the router was last updated
- created
At String - Datetime when the router was created
- creator
Task StringId - Task that created this entity
- distributed Boolean
- Whether the router is distributed or centralized.
- external
Gateway Property MapInfo - External gateway configuration. Use type 'default' to let the platform automatically select the external network, or type 'manual' to specify a particular external network via
network_id. If omitted, the router is created without an external gateway. - interfaces List<Property Map>
- List of interfaces to attach to router immediately after creation.
- name String
- name of router
- project
Id Number - region String
- Region name
- region
Id Number - routes List<Property Map>
- List of custom routes.
- status String
- Status of the router.
- updated
At String - Datetime when the router was last updated
Supporting Types
CloudNetworkRouterExternalGatewayInfo, CloudNetworkRouterExternalGatewayInfoArgs
- Enable
Snat bool - Is SNAT enabled. Defaults to true.
- Network
Id string - ID of the external network to connect the router to.
- Type string
- Gateway type. Use 'manual' to explicitly specify which external network the router connects to via
network_id. Required for PATCH/update operations. Available values: "manual", "default".
- Enable
Snat bool - Is SNAT enabled. Defaults to true.
- Network
Id string - ID of the external network to connect the router to.
- Type string
- Gateway type. Use 'manual' to explicitly specify which external network the router connects to via
network_id. Required for PATCH/update operations. Available values: "manual", "default".
- enable
Snat Boolean - Is SNAT enabled. Defaults to true.
- network
Id String - ID of the external network to connect the router to.
- type String
- Gateway type. Use 'manual' to explicitly specify which external network the router connects to via
network_id. Required for PATCH/update operations. Available values: "manual", "default".
- enable
Snat boolean - Is SNAT enabled. Defaults to true.
- network
Id string - ID of the external network to connect the router to.
- type string
- Gateway type. Use 'manual' to explicitly specify which external network the router connects to via
network_id. Required for PATCH/update operations. Available values: "manual", "default".
- enable_
snat bool - Is SNAT enabled. Defaults to true.
- network_
id str - ID of the external network to connect the router to.
- type str
- Gateway type. Use 'manual' to explicitly specify which external network the router connects to via
network_id. Required for PATCH/update operations. Available values: "manual", "default".
- enable
Snat Boolean - Is SNAT enabled. Defaults to true.
- network
Id String - ID of the external network to connect the router to.
- type String
- Gateway type. Use 'manual' to explicitly specify which external network the router connects to via
network_id. Required for PATCH/update operations. Available values: "manual", "default".
CloudNetworkRouterInterface, CloudNetworkRouterInterfaceArgs
CloudNetworkRouterRoute, CloudNetworkRouterRouteArgs
- Destination string
- CIDR of destination IPv4 or IPv6 subnet.
- Nexthop string
- IPv4 or IPv6 address to forward traffic to if it's destination IP matches 'destination' CIDR.
- Destination string
- CIDR of destination IPv4 or IPv6 subnet.
- Nexthop string
- IPv4 or IPv6 address to forward traffic to if it's destination IP matches 'destination' CIDR.
- destination String
- CIDR of destination IPv4 or IPv6 subnet.
- nexthop String
- IPv4 or IPv6 address to forward traffic to if it's destination IP matches 'destination' CIDR.
- destination string
- CIDR of destination IPv4 or IPv6 subnet.
- nexthop string
- IPv4 or IPv6 address to forward traffic to if it's destination IP matches 'destination' CIDR.
- destination str
- CIDR of destination IPv4 or IPv6 subnet.
- nexthop str
- IPv4 or IPv6 address to forward traffic to if it's destination IP matches 'destination' CIDR.
- destination String
- CIDR of destination IPv4 or IPv6 subnet.
- nexthop String
- IPv4 or IPv6 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
gcoreTerraform Provider.
published on Monday, Mar 30, 2026 by g-core
