1. Registry
  2. Packages
  3. Gcore Provider
  4. API Docs
  5. Router
Viewing docs for gcore 0.37.1
published on Friday, Oct 23, 2026 by g-core
gcore
Viewing docs for gcore 0.37.1
published on Friday, Oct 23, 2026 by g-core

    Represent router. Router enables you to dynamically exchange routes between networks

    Example Usage

    Prerequisite

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const project = gcore.getProject({
        name: "Default",
    });
    const region = gcore.getRegion({
        name: "Luxembourg-2",
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    project = gcore.get_project(name="Default")
    region = gcore.get_region(name="Luxembourg-2")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gcore.GetProject(ctx, &gcore.GetProjectArgs{
    			Name: "Default",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = gcore.GetRegion(ctx, &gcore.GetRegionArgs{
    			Name: "Luxembourg-2",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var project = Gcore.GetProject.Invoke(new()
        {
            Name = "Default",
        });
    
        var region = Gcore.GetRegion.Invoke(new()
        {
            Name = "Luxembourg-2",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.GcoreFunctions;
    import com.pulumi.gcore.inputs.GetProjectArgs;
    import com.pulumi.gcore.inputs.GetRegionArgs;
    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 project = GcoreFunctions.getProject(GetProjectArgs.builder()
                .name("Default")
                .build());
    
            final var region = GcoreFunctions.getRegion(GetRegionArgs.builder()
                .name("Luxembourg-2")
                .build());
    
        }
    }
    
    variables:
      project:
        fn::invoke:
          function: gcore:getProject
          arguments:
            name: Default
      region:
        fn::invoke:
          function: gcore:getRegion
          arguments:
            name: Luxembourg-2
    
    Example coming soon!
    

    Basic Router

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const basic = new gcore.Router("basic", {
        projectId: project.id,
        regionId: region.id,
        name: "my-router",
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    basic = gcore.Router("basic",
        project_id=project["id"],
        region_id=region["id"],
        name="my-router")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gcore.NewRouter(ctx, "basic", &gcore.RouterArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("my-router"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var basic = new Gcore.Router("basic", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "my-router",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.Router;
    import com.pulumi.gcore.RouterArgs;
    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 basic = new Router("basic", RouterArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("my-router")
                .build());
    
        }
    }
    
    resources:
      basic:
        type: gcore:Router
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: my-router
    
    Example coming soon!
    

    Router with Default External Gateway

    Uses the default external network for internet access. This is the simplest way to give your router internet connectivity.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const withDefaultGateway = new gcore.Router("with_default_gateway", {
        projectId: project.id,
        regionId: region.id,
        name: "router-with-internet",
        externalGatewayInfo: {
            type: "default",
            enableSnat: true,
        },
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    with_default_gateway = gcore.Router("with_default_gateway",
        project_id=project["id"],
        region_id=region["id"],
        name="router-with-internet",
        external_gateway_info={
            "type": "default",
            "enable_snat": True,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gcore.NewRouter(ctx, "with_default_gateway", &gcore.RouterArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("router-with-internet"),
    			ExternalGatewayInfo: &gcore.RouterExternalGatewayInfoArgs{
    				Type:       pulumi.String("default"),
    				EnableSnat: pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var withDefaultGateway = new Gcore.Router("with_default_gateway", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "router-with-internet",
            ExternalGatewayInfo = new Gcore.Inputs.RouterExternalGatewayInfoArgs
            {
                Type = "default",
                EnableSnat = true,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.Router;
    import com.pulumi.gcore.RouterArgs;
    import com.pulumi.gcore.inputs.RouterExternalGatewayInfoArgs;
    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 withDefaultGateway = new Router("withDefaultGateway", RouterArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("router-with-internet")
                .externalGatewayInfo(RouterExternalGatewayInfoArgs.builder()
                    .type("default")
                    .enableSnat(true)
                    .build())
                .build());
    
        }
    }
    
    resources:
      withDefaultGateway:
        type: gcore:Router
        name: with_default_gateway
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: router-with-internet
          externalGatewayInfo:
            type: default
            enableSnat: true
    
    Example coming soon!
    

    Router with Manual External Gateway

    Specifies a particular external network for the gateway. Use this when you need control over which external network to use.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    // First, find the external network you want to use
    const external = gcore.getNetwork({
        projectId: project.id,
        regionId: region.id,
        name: "external-network",
    });
    const withManualGateway = new gcore.Router("with_manual_gateway", {
        projectId: project.id,
        regionId: region.id,
        name: "router-manual-gateway",
        externalGatewayInfo: {
            type: "manual",
            enableSnat: true,
            networkId: external.then(external => external.id),
        },
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    # First, find the external network you want to use
    external = gcore.get_network(project_id=project["id"],
        region_id=region["id"],
        name="external-network")
    with_manual_gateway = gcore.Router("with_manual_gateway",
        project_id=project["id"],
        region_id=region["id"],
        name="router-manual-gateway",
        external_gateway_info={
            "type": "manual",
            "enable_snat": True,
            "network_id": external.id,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// First, find the external network you want to use
    		external, err := gcore.LookupNetwork(ctx, &gcore.LookupNetworkArgs{
    			ProjectId: pulumi.Float64Ref(project.Id),
    			RegionId:  pulumi.Float64Ref(region.Id),
    			Name:      "external-network",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = gcore.NewRouter(ctx, "with_manual_gateway", &gcore.RouterArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("router-manual-gateway"),
    			ExternalGatewayInfo: &gcore.RouterExternalGatewayInfoArgs{
    				Type:       pulumi.String("manual"),
    				EnableSnat: pulumi.Bool(true),
    				NetworkId:  pulumi.String(external.Id),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        // First, find the external network you want to use
        var external = Gcore.GetNetwork.Invoke(new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "external-network",
        });
    
        var withManualGateway = new Gcore.Router("with_manual_gateway", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "router-manual-gateway",
            ExternalGatewayInfo = new Gcore.Inputs.RouterExternalGatewayInfoArgs
            {
                Type = "manual",
                EnableSnat = true,
                NetworkId = external.Apply(getNetworkResult => getNetworkResult.Id),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.GcoreFunctions;
    import com.pulumi.gcore.inputs.GetNetworkArgs;
    import com.pulumi.gcore.Router;
    import com.pulumi.gcore.RouterArgs;
    import com.pulumi.gcore.inputs.RouterExternalGatewayInfoArgs;
    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) {
            // First, find the external network you want to use
            final var external = GcoreFunctions.getNetwork(GetNetworkArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("external-network")
                .build());
    
            var withManualGateway = new Router("withManualGateway", RouterArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("router-manual-gateway")
                .externalGatewayInfo(RouterExternalGatewayInfoArgs.builder()
                    .type("manual")
                    .enableSnat(true)
                    .networkId(external.id())
                    .build())
                .build());
    
        }
    }
    
    resources:
      withManualGateway:
        type: gcore:Router
        name: with_manual_gateway
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: router-manual-gateway
          externalGatewayInfo:
            type: manual
            enableSnat: true
            networkId: ${external.id}
    variables:
      # First, find the external network you want to use
      external:
        fn::invoke:
          function: gcore:getNetwork
          arguments:
            projectId: ${project.id}
            regionId: ${region.id}
            name: external-network
    
    Example coming soon!
    

    Router with Interfaces

    Connects the router to multiple subnets, enabling routing between them.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    // Create networks and subnets first
    const networkA = new gcore.Network("network_a", {
        projectId: project.id,
        regionId: region.id,
        name: "network-a",
        createRouter: false,
    });
    const subnetA = new gcore.Subnet("subnet_a", {
        projectId: project.id,
        regionId: region.id,
        name: "subnet-a",
        cidr: "192.168.1.0/24",
        networkId: networkA.networkId,
        gatewayIp: "192.168.1.1",
        dnsNameservers: [
            "8.8.8.8",
            "8.8.4.4",
        ],
    });
    const networkB = new gcore.Network("network_b", {
        projectId: project.id,
        regionId: region.id,
        name: "network-b",
        createRouter: false,
    });
    const subnetB = new gcore.Subnet("subnet_b", {
        projectId: project.id,
        regionId: region.id,
        name: "subnet-b",
        cidr: "192.168.2.0/24",
        networkId: networkB.networkId,
        gatewayIp: "192.168.2.1",
        dnsNameservers: [
            "8.8.8.8",
            "8.8.4.4",
        ],
    });
    // Create router connecting both subnets
    const multiSubnet = new gcore.Router("multi_subnet", {
        projectId: project.id,
        regionId: region.id,
        name: "multi-subnet-router",
        externalGatewayInfo: {
            type: "default",
            enableSnat: true,
        },
        interfaces: [
            {
                type: "subnet",
                subnetId: subnetA.subnetId,
            },
            {
                type: "subnet",
                subnetId: subnetB.subnetId,
            },
        ],
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    # Create networks and subnets first
    network_a = gcore.Network("network_a",
        project_id=project["id"],
        region_id=region["id"],
        name="network-a",
        create_router=False)
    subnet_a = gcore.Subnet("subnet_a",
        project_id=project["id"],
        region_id=region["id"],
        name="subnet-a",
        cidr="192.168.1.0/24",
        network_id=network_a.network_id,
        gateway_ip="192.168.1.1",
        dns_nameservers=[
            "8.8.8.8",
            "8.8.4.4",
        ])
    network_b = gcore.Network("network_b",
        project_id=project["id"],
        region_id=region["id"],
        name="network-b",
        create_router=False)
    subnet_b = gcore.Subnet("subnet_b",
        project_id=project["id"],
        region_id=region["id"],
        name="subnet-b",
        cidr="192.168.2.0/24",
        network_id=network_b.network_id,
        gateway_ip="192.168.2.1",
        dns_nameservers=[
            "8.8.8.8",
            "8.8.4.4",
        ])
    # Create router connecting both subnets
    multi_subnet = gcore.Router("multi_subnet",
        project_id=project["id"],
        region_id=region["id"],
        name="multi-subnet-router",
        external_gateway_info={
            "type": "default",
            "enable_snat": True,
        },
        interfaces=[
            {
                "type": "subnet",
                "subnet_id": subnet_a.subnet_id,
            },
            {
                "type": "subnet",
                "subnet_id": subnet_b.subnet_id,
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create networks and subnets first
    		networkA, err := gcore.NewNetwork(ctx, "network_a", &gcore.NetworkArgs{
    			ProjectId:    pulumi.Any(project.Id),
    			RegionId:     pulumi.Any(region.Id),
    			Name:         pulumi.String("network-a"),
    			CreateRouter: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		subnetA, err := gcore.NewSubnet(ctx, "subnet_a", &gcore.SubnetArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("subnet-a"),
    			Cidr:      pulumi.String("192.168.1.0/24"),
    			NetworkId: networkA.NetworkId,
    			GatewayIp: pulumi.String("192.168.1.1"),
    			DnsNameservers: pulumi.StringArray{
    				pulumi.String("8.8.8.8"),
    				pulumi.String("8.8.4.4"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		networkB, err := gcore.NewNetwork(ctx, "network_b", &gcore.NetworkArgs{
    			ProjectId:    pulumi.Any(project.Id),
    			RegionId:     pulumi.Any(region.Id),
    			Name:         pulumi.String("network-b"),
    			CreateRouter: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		subnetB, err := gcore.NewSubnet(ctx, "subnet_b", &gcore.SubnetArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("subnet-b"),
    			Cidr:      pulumi.String("192.168.2.0/24"),
    			NetworkId: networkB.NetworkId,
    			GatewayIp: pulumi.String("192.168.2.1"),
    			DnsNameservers: pulumi.StringArray{
    				pulumi.String("8.8.8.8"),
    				pulumi.String("8.8.4.4"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Create router connecting both subnets
    		_, err = gcore.NewRouter(ctx, "multi_subnet", &gcore.RouterArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("multi-subnet-router"),
    			ExternalGatewayInfo: &gcore.RouterExternalGatewayInfoArgs{
    				Type:       pulumi.String("default"),
    				EnableSnat: pulumi.Bool(true),
    			},
    			Interfaces: gcore.RouterInterfaceArray{
    				&gcore.RouterInterfaceArgs{
    					Type:     pulumi.String("subnet"),
    					SubnetId: subnetA.SubnetId,
    				},
    				&gcore.RouterInterfaceArgs{
    					Type:     pulumi.String("subnet"),
    					SubnetId: subnetB.SubnetId,
    				},
    			},
    		})
    		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 networks and subnets first
        var networkA = new Gcore.Network("network_a", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "network-a",
            CreateRouter = false,
        });
    
        var subnetA = new Gcore.Subnet("subnet_a", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "subnet-a",
            Cidr = "192.168.1.0/24",
            NetworkId = networkA.NetworkId,
            GatewayIp = "192.168.1.1",
            DnsNameservers = new[]
            {
                "8.8.8.8",
                "8.8.4.4",
            },
        });
    
        var networkB = new Gcore.Network("network_b", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "network-b",
            CreateRouter = false,
        });
    
        var subnetB = new Gcore.Subnet("subnet_b", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "subnet-b",
            Cidr = "192.168.2.0/24",
            NetworkId = networkB.NetworkId,
            GatewayIp = "192.168.2.1",
            DnsNameservers = new[]
            {
                "8.8.8.8",
                "8.8.4.4",
            },
        });
    
        // Create router connecting both subnets
        var multiSubnet = new Gcore.Router("multi_subnet", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "multi-subnet-router",
            ExternalGatewayInfo = new Gcore.Inputs.RouterExternalGatewayInfoArgs
            {
                Type = "default",
                EnableSnat = true,
            },
            Interfaces = new[]
            {
                new Gcore.Inputs.RouterInterfaceArgs
                {
                    Type = "subnet",
                    SubnetId = subnetA.SubnetId,
                },
                new Gcore.Inputs.RouterInterfaceArgs
                {
                    Type = "subnet",
                    SubnetId = subnetB.SubnetId,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.Network;
    import com.pulumi.gcore.NetworkArgs;
    import com.pulumi.gcore.Subnet;
    import com.pulumi.gcore.SubnetArgs;
    import com.pulumi.gcore.Router;
    import com.pulumi.gcore.RouterArgs;
    import com.pulumi.gcore.inputs.RouterExternalGatewayInfoArgs;
    import com.pulumi.gcore.inputs.RouterInterfaceArgs;
    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 networks and subnets first
            var networkA = new Network("networkA", NetworkArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("network-a")
                .createRouter(false)
                .build());
    
            var subnetA = new Subnet("subnetA", SubnetArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("subnet-a")
                .cidr("192.168.1.0/24")
                .networkId(networkA.networkId())
                .gatewayIp("192.168.1.1")
                .dnsNameservers(            
                    "8.8.8.8",
                    "8.8.4.4")
                .build());
    
            var networkB = new Network("networkB", NetworkArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("network-b")
                .createRouter(false)
                .build());
    
            var subnetB = new Subnet("subnetB", SubnetArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("subnet-b")
                .cidr("192.168.2.0/24")
                .networkId(networkB.networkId())
                .gatewayIp("192.168.2.1")
                .dnsNameservers(            
                    "8.8.8.8",
                    "8.8.4.4")
                .build());
    
            // Create router connecting both subnets
            var multiSubnet = new Router("multiSubnet", RouterArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("multi-subnet-router")
                .externalGatewayInfo(RouterExternalGatewayInfoArgs.builder()
                    .type("default")
                    .enableSnat(true)
                    .build())
                .interfaces(            
                    RouterInterfaceArgs.builder()
                        .type("subnet")
                        .subnetId(subnetA.subnetId())
                        .build(),
                    RouterInterfaceArgs.builder()
                        .type("subnet")
                        .subnetId(subnetB.subnetId())
                        .build())
                .build());
    
        }
    }
    
    resources:
      # Create networks and subnets first
      networkA:
        type: gcore:Network
        name: network_a
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: network-a
          createRouter: false
      subnetA:
        type: gcore:Subnet
        name: subnet_a
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: subnet-a
          cidr: 192.168.1.0/24
          networkId: ${networkA.networkId}
          gatewayIp: 192.168.1.1
          dnsNameservers:
            - 8.8.8.8
            - 8.8.4.4
      networkB:
        type: gcore:Network
        name: network_b
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: network-b
          createRouter: false
      subnetB:
        type: gcore:Subnet
        name: subnet_b
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: subnet-b
          cidr: 192.168.2.0/24
          networkId: ${networkB.networkId}
          gatewayIp: 192.168.2.1
          dnsNameservers:
            - 8.8.8.8
            - 8.8.4.4
      # Create router connecting both subnets
      multiSubnet:
        type: gcore:Router
        name: multi_subnet
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: multi-subnet-router
          externalGatewayInfo:
            type: default
            enableSnat: true
          interfaces:
            - type: subnet
              subnetId: ${subnetA.subnetId}
            - type: subnet
              subnetId: ${subnetB.subnetId}
    
    Example coming soon!
    

    Router with Static Routes

    Configures custom static routes for directing traffic to specific destinations.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const withRoutes = new gcore.Router("with_routes", {
        projectId: project.id,
        regionId: region.id,
        name: "router-with-static-routes",
        externalGatewayInfo: {
            type: "default",
            enableSnat: true,
        },
        routes: [
            {
                destination: "10.0.0.0/8",
                nexthop: "192.168.1.254",
            },
            {
                destination: "172.16.0.0/16",
                nexthop: "192.168.1.253",
            },
        ],
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    with_routes = gcore.Router("with_routes",
        project_id=project["id"],
        region_id=region["id"],
        name="router-with-static-routes",
        external_gateway_info={
            "type": "default",
            "enable_snat": True,
        },
        routes=[
            {
                "destination": "10.0.0.0/8",
                "nexthop": "192.168.1.254",
            },
            {
                "destination": "172.16.0.0/16",
                "nexthop": "192.168.1.253",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gcore.NewRouter(ctx, "with_routes", &gcore.RouterArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("router-with-static-routes"),
    			ExternalGatewayInfo: &gcore.RouterExternalGatewayInfoArgs{
    				Type:       pulumi.String("default"),
    				EnableSnat: pulumi.Bool(true),
    			},
    			Routes: gcore.RouterRouteArray{
    				&gcore.RouterRouteArgs{
    					Destination: pulumi.String("10.0.0.0/8"),
    					Nexthop:     pulumi.String("192.168.1.254"),
    				},
    				&gcore.RouterRouteArgs{
    					Destination: pulumi.String("172.16.0.0/16"),
    					Nexthop:     pulumi.String("192.168.1.253"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var withRoutes = new Gcore.Router("with_routes", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "router-with-static-routes",
            ExternalGatewayInfo = new Gcore.Inputs.RouterExternalGatewayInfoArgs
            {
                Type = "default",
                EnableSnat = true,
            },
            Routes = new[]
            {
                new Gcore.Inputs.RouterRouteArgs
                {
                    Destination = "10.0.0.0/8",
                    Nexthop = "192.168.1.254",
                },
                new Gcore.Inputs.RouterRouteArgs
                {
                    Destination = "172.16.0.0/16",
                    Nexthop = "192.168.1.253",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.Router;
    import com.pulumi.gcore.RouterArgs;
    import com.pulumi.gcore.inputs.RouterExternalGatewayInfoArgs;
    import com.pulumi.gcore.inputs.RouterRouteArgs;
    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 withRoutes = new Router("withRoutes", RouterArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("router-with-static-routes")
                .externalGatewayInfo(RouterExternalGatewayInfoArgs.builder()
                    .type("default")
                    .enableSnat(true)
                    .build())
                .routes(            
                    RouterRouteArgs.builder()
                        .destination("10.0.0.0/8")
                        .nexthop("192.168.1.254")
                        .build(),
                    RouterRouteArgs.builder()
                        .destination("172.16.0.0/16")
                        .nexthop("192.168.1.253")
                        .build())
                .build());
    
        }
    }
    
    resources:
      withRoutes:
        type: gcore:Router
        name: with_routes
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: router-with-static-routes
          externalGatewayInfo:
            type: default
            enableSnat: true
          routes:
            - destination: 10.0.0.0/8
              nexthop: 192.168.1.254
            - destination: 172.16.0.0/16
              nexthop: 192.168.1.253
    
    Example coming soon!
    

    Complete Setup

    Full example creating a private network, subnet, and router with internet connectivity.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    // Complete example: Private network with internet access via router
    // 1. Create a private network
    const _private = new gcore.Network("private", {
        projectId: project.id,
        regionId: region.id,
        name: "my-private-network",
        createRouter: false,
    });
    // 2. Create a subnet in the private network
    const privateSubnet = new gcore.Subnet("private", {
        projectId: project.id,
        regionId: region.id,
        name: "my-private-subnet",
        cidr: "192.168.100.0/24",
        networkId: _private.networkId,
        gatewayIp: "192.168.100.1",
        dnsNameservers: [
            "8.8.8.8",
            "8.8.4.4",
        ],
    });
    // 3. Create a router with external gateway for internet access
    const internetGateway = new gcore.Router("internet_gateway", {
        projectId: project.id,
        regionId: region.id,
        name: "internet-gateway-router",
        externalGatewayInfo: {
            type: "default",
            enableSnat: true,
        },
        interfaces: [{
            type: "subnet",
            subnetId: privateSubnet.subnetId,
        }],
    });
    export const routerId = internetGateway.routerId;
    
    import pulumi
    import pulumi_gcore as gcore
    
    # Complete example: Private network with internet access via router
    # 1. Create a private network
    private = gcore.Network("private",
        project_id=project["id"],
        region_id=region["id"],
        name="my-private-network",
        create_router=False)
    # 2. Create a subnet in the private network
    private_subnet = gcore.Subnet("private",
        project_id=project["id"],
        region_id=region["id"],
        name="my-private-subnet",
        cidr="192.168.100.0/24",
        network_id=private.network_id,
        gateway_ip="192.168.100.1",
        dns_nameservers=[
            "8.8.8.8",
            "8.8.4.4",
        ])
    # 3. Create a router with external gateway for internet access
    internet_gateway = gcore.Router("internet_gateway",
        project_id=project["id"],
        region_id=region["id"],
        name="internet-gateway-router",
        external_gateway_info={
            "type": "default",
            "enable_snat": True,
        },
        interfaces=[{
            "type": "subnet",
            "subnet_id": private_subnet.subnet_id,
        }])
    pulumi.export("routerId", internet_gateway.router_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Complete example: Private network with internet access via router
    		// 1. Create a private network
    		private, err := gcore.NewNetwork(ctx, "private", &gcore.NetworkArgs{
    			ProjectId:    pulumi.Any(project.Id),
    			RegionId:     pulumi.Any(region.Id),
    			Name:         pulumi.String("my-private-network"),
    			CreateRouter: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		// 2. Create a subnet in the private network
    		privateSubnet, err := gcore.NewSubnet(ctx, "private", &gcore.SubnetArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("my-private-subnet"),
    			Cidr:      pulumi.String("192.168.100.0/24"),
    			NetworkId: private.NetworkId,
    			GatewayIp: pulumi.String("192.168.100.1"),
    			DnsNameservers: pulumi.StringArray{
    				pulumi.String("8.8.8.8"),
    				pulumi.String("8.8.4.4"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// 3. Create a router with external gateway for internet access
    		internetGateway, err := gcore.NewRouter(ctx, "internet_gateway", &gcore.RouterArgs{
    			ProjectId: pulumi.Any(project.Id),
    			RegionId:  pulumi.Any(region.Id),
    			Name:      pulumi.String("internet-gateway-router"),
    			ExternalGatewayInfo: &gcore.RouterExternalGatewayInfoArgs{
    				Type:       pulumi.String("default"),
    				EnableSnat: pulumi.Bool(true),
    			},
    			Interfaces: gcore.RouterInterfaceArray{
    				&gcore.RouterInterfaceArgs{
    					Type:     pulumi.String("subnet"),
    					SubnetId: privateSubnet.SubnetId,
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("routerId", internetGateway.RouterId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        // Complete example: Private network with internet access via router
        // 1. Create a private network
        var @private = new Gcore.Network("private", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "my-private-network",
            CreateRouter = false,
        });
    
        // 2. Create a subnet in the private network
        var privateSubnet = new Gcore.Subnet("private", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "my-private-subnet",
            Cidr = "192.168.100.0/24",
            NetworkId = @private.NetworkId,
            GatewayIp = "192.168.100.1",
            DnsNameservers = new[]
            {
                "8.8.8.8",
                "8.8.4.4",
            },
        });
    
        // 3. Create a router with external gateway for internet access
        var internetGateway = new Gcore.Router("internet_gateway", new()
        {
            ProjectId = project.Id,
            RegionId = region.Id,
            Name = "internet-gateway-router",
            ExternalGatewayInfo = new Gcore.Inputs.RouterExternalGatewayInfoArgs
            {
                Type = "default",
                EnableSnat = true,
            },
            Interfaces = new[]
            {
                new Gcore.Inputs.RouterInterfaceArgs
                {
                    Type = "subnet",
                    SubnetId = privateSubnet.SubnetId,
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["routerId"] = internetGateway.RouterId,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.Network;
    import com.pulumi.gcore.NetworkArgs;
    import com.pulumi.gcore.Subnet;
    import com.pulumi.gcore.SubnetArgs;
    import com.pulumi.gcore.Router;
    import com.pulumi.gcore.RouterArgs;
    import com.pulumi.gcore.inputs.RouterExternalGatewayInfoArgs;
    import com.pulumi.gcore.inputs.RouterInterfaceArgs;
    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) {
            // Complete example: Private network with internet access via router
            // 1. Create a private network
            var private_ = new Network("private", NetworkArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("my-private-network")
                .createRouter(false)
                .build());
    
            // 2. Create a subnet in the private network
            var privateSubnet = new Subnet("privateSubnet", SubnetArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("my-private-subnet")
                .cidr("192.168.100.0/24")
                .networkId(private_.networkId())
                .gatewayIp("192.168.100.1")
                .dnsNameservers(            
                    "8.8.8.8",
                    "8.8.4.4")
                .build());
    
            // 3. Create a router with external gateway for internet access
            var internetGateway = new Router("internetGateway", RouterArgs.builder()
                .projectId(project.id())
                .regionId(region.id())
                .name("internet-gateway-router")
                .externalGatewayInfo(RouterExternalGatewayInfoArgs.builder()
                    .type("default")
                    .enableSnat(true)
                    .build())
                .interfaces(RouterInterfaceArgs.builder()
                    .type("subnet")
                    .subnetId(privateSubnet.subnetId())
                    .build())
                .build());
    
            ctx.export("routerId", internetGateway.routerId());
        }
    }
    
    resources:
      # Complete example: Private network with internet access via router
    
      # 1. Create a private network
      private:
        type: gcore:Network
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: my-private-network
          createRouter: false
      # 2. Create a subnet in the private network
      privateSubnet:
        type: gcore:Subnet
        name: private
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: my-private-subnet
          cidr: 192.168.100.0/24
          networkId: ${private.networkId}
          gatewayIp: 192.168.100.1
          dnsNameservers:
            - 8.8.8.8
            - 8.8.4.4
      # 3. Create a router with external gateway for internet access
      internetGateway:
        type: gcore:Router
        name: internet_gateway
        properties:
          projectId: ${project.id}
          regionId: ${region.id}
          name: internet-gateway-router
          externalGatewayInfo:
            type: default
            enableSnat: true
          interfaces:
            - type: subnet
              subnetId: ${privateSubnet.subnetId}
    outputs:
      # Output the router ID
      routerId: ${internetGateway.routerId}
    
    Example coming soon!
    

    Create Router Resource

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

    Constructor syntax

    new Router(name: string, args?: RouterArgs, opts?: CustomResourceOptions);
    @overload
    def Router(resource_name: str,
               args: Optional[RouterArgs] = None,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Router(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               external_gateway_info: Optional[RouterExternalGatewayInfoArgs] = None,
               interfaces: Optional[Sequence[RouterInterfaceArgs]] = None,
               name: Optional[str] = None,
               project_id: Optional[float] = None,
               project_name: Optional[str] = None,
               region_id: Optional[float] = None,
               region_name: Optional[str] = None,
               router_id: Optional[str] = None,
               routes: Optional[Sequence[RouterRouteArgs]] = None)
    func NewRouter(ctx *Context, name string, args *RouterArgs, opts ...ResourceOption) (*Router, error)
    public Router(string name, RouterArgs? args = null, CustomResourceOptions? opts = null)
    public Router(String name, RouterArgs args)
    public Router(String name, RouterArgs args, CustomResourceOptions options)
    
    type: gcore:Router
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "gcore_router" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args RouterArgs
    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 RouterArgs
    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 RouterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouterArgs
    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 routerResource = new Gcore.Router("routerResource", new()
    {
        ExternalGatewayInfo = new Gcore.Inputs.RouterExternalGatewayInfoArgs
        {
            EnableSnat = false,
            ExternalFixedIps = new[]
            {
                new Gcore.Inputs.RouterExternalGatewayInfoExternalFixedIpArgs
                {
                    IpAddress = "string",
                    SubnetId = "string",
                },
            },
            NetworkId = "string",
            Type = "string",
        },
        Interfaces = new[]
        {
            new Gcore.Inputs.RouterInterfaceArgs
            {
                SubnetId = "string",
                Type = "string",
                IpAddress = "string",
                MacAddress = "string",
                NetworkId = "string",
                PortId = "string",
            },
        },
        Name = "string",
        ProjectId = 0.0,
        ProjectName = "string",
        RegionId = 0.0,
        RegionName = "string",
        RouterId = "string",
        Routes = new[]
        {
            new Gcore.Inputs.RouterRouteArgs
            {
                Destination = "string",
                Nexthop = "string",
            },
        },
    });
    
    example, err := gcore.NewRouter(ctx, "routerResource", &gcore.RouterArgs{
    	ExternalGatewayInfo: &gcore.RouterExternalGatewayInfoArgs{
    		EnableSnat: pulumi.Bool(false),
    		ExternalFixedIps: gcore.RouterExternalGatewayInfoExternalFixedIpArray{
    			&gcore.RouterExternalGatewayInfoExternalFixedIpArgs{
    				IpAddress: pulumi.String("string"),
    				SubnetId:  pulumi.String("string"),
    			},
    		},
    		NetworkId: pulumi.String("string"),
    		Type:      pulumi.String("string"),
    	},
    	Interfaces: gcore.RouterInterfaceArray{
    		&gcore.RouterInterfaceArgs{
    			SubnetId:   pulumi.String("string"),
    			Type:       pulumi.String("string"),
    			IpAddress:  pulumi.String("string"),
    			MacAddress: pulumi.String("string"),
    			NetworkId:  pulumi.String("string"),
    			PortId:     pulumi.String("string"),
    		},
    	},
    	Name:        pulumi.String("string"),
    	ProjectId:   pulumi.Float64(0),
    	ProjectName: pulumi.String("string"),
    	RegionId:    pulumi.Float64(0),
    	RegionName:  pulumi.String("string"),
    	RouterId:    pulumi.String("string"),
    	Routes: gcore.RouterRouteArray{
    		&gcore.RouterRouteArgs{
    			Destination: pulumi.String("string"),
    			Nexthop:     pulumi.String("string"),
    		},
    	},
    })
    
    resource "gcore_router" "routerResource" {
      lifecycle {
        create_before_destroy = true
      }
      external_gateway_info = {
        enable_snat = false
        external_fixed_ips = [{
          ip_address = "string"
          subnet_id  = "string"
        }]
        network_id = "string"
        type       = "string"
      }
      interfaces {
        subnet_id   = "string"
        type        = "string"
        ip_address  = "string"
        mac_address = "string"
        network_id  = "string"
        port_id     = "string"
      }
      name         = "string"
      project_id   = 0
      project_name = "string"
      region_id    = 0
      region_name  = "string"
      router_id    = "string"
      routes {
        destination = "string"
        nexthop     = "string"
      }
    }
    
    var routerResource = new Router("routerResource", RouterArgs.builder()
        .externalGatewayInfo(RouterExternalGatewayInfoArgs.builder()
            .enableSnat(false)
            .externalFixedIps(RouterExternalGatewayInfoExternalFixedIpArgs.builder()
                .ipAddress("string")
                .subnetId("string")
                .build())
            .networkId("string")
            .type("string")
            .build())
        .interfaces(RouterInterfaceArgs.builder()
            .subnetId("string")
            .type("string")
            .ipAddress("string")
            .macAddress("string")
            .networkId("string")
            .portId("string")
            .build())
        .name("string")
        .projectId(0.0)
        .projectName("string")
        .regionId(0.0)
        .regionName("string")
        .routerId("string")
        .routes(RouterRouteArgs.builder()
            .destination("string")
            .nexthop("string")
            .build())
        .build());
    
    router_resource = gcore.Router("routerResource",
        external_gateway_info={
            "enable_snat": False,
            "external_fixed_ips": [{
                "ip_address": "string",
                "subnet_id": "string",
            }],
            "network_id": "string",
            "type": "string",
        },
        interfaces=[{
            "subnet_id": "string",
            "type": "string",
            "ip_address": "string",
            "mac_address": "string",
            "network_id": "string",
            "port_id": "string",
        }],
        name="string",
        project_id=float(0),
        project_name="string",
        region_id=float(0),
        region_name="string",
        router_id="string",
        routes=[{
            "destination": "string",
            "nexthop": "string",
        }])
    
    const routerResource = new gcore.Router("routerResource", {
        externalGatewayInfo: {
            enableSnat: false,
            externalFixedIps: [{
                ipAddress: "string",
                subnetId: "string",
            }],
            networkId: "string",
            type: "string",
        },
        interfaces: [{
            subnetId: "string",
            type: "string",
            ipAddress: "string",
            macAddress: "string",
            networkId: "string",
            portId: "string",
        }],
        name: "string",
        projectId: 0,
        projectName: "string",
        regionId: 0,
        regionName: "string",
        routerId: "string",
        routes: [{
            destination: "string",
            nexthop: "string",
        }],
    });
    
    type: gcore:Router
    properties:
        externalGatewayInfo:
            enableSnat: false
            externalFixedIps:
                - ipAddress: string
                  subnetId: string
            networkId: string
            type: string
        interfaces:
            - ipAddress: string
              macAddress: string
              networkId: string
              portId: string
              subnetId: string
              type: string
        name: string
        projectId: 0
        projectName: string
        regionId: 0
        regionName: string
        routerId: string
        routes:
            - destination: string
              nexthop: string
    

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

    ExternalGatewayInfo RouterExternalGatewayInfo
    External gateway configuration for the router.
    Interfaces List<RouterInterface>
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    Name string
    The name of the router.
    ProjectId double
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    ProjectName string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    RegionId double
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    RegionName string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    RouterId string
    The ID of this resource.
    Routes List<RouterRoute>
    List of custom static routes to be advertised by the router.
    ExternalGatewayInfo RouterExternalGatewayInfoArgs
    External gateway configuration for the router.
    Interfaces []RouterInterfaceArgs
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    Name string
    The name of the router.
    ProjectId float64
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    ProjectName string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    RegionId float64
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    RegionName string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    RouterId string
    The ID of this resource.
    Routes []RouterRouteArgs
    List of custom static routes to be advertised by the router.
    external_gateway_info object
    External gateway configuration for the router.
    interfaces list(object)
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name string
    The name of the router.
    project_id number
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    project_name string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    region_id number
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    region_name string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    router_id string
    The ID of this resource.
    routes list(object)
    List of custom static routes to be advertised by the router.
    externalGatewayInfo RouterExternalGatewayInfo
    External gateway configuration for the router.
    interfaces List<RouterInterface>
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name String
    The name of the router.
    projectId Double
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    projectName String
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    regionId Double
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    regionName String
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    routerId String
    The ID of this resource.
    routes List<RouterRoute>
    List of custom static routes to be advertised by the router.
    externalGatewayInfo RouterExternalGatewayInfo
    External gateway configuration for the router.
    interfaces RouterInterface[]
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name string
    The name of the router.
    projectId number
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    projectName string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    regionId number
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    regionName string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    routerId string
    The ID of this resource.
    routes RouterRoute[]
    List of custom static routes to be advertised by the router.
    external_gateway_info RouterExternalGatewayInfoArgs
    External gateway configuration for the router.
    interfaces Sequence[RouterInterfaceArgs]
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name str
    The name of the router.
    project_id float
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    project_name str
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    region_id float
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    region_name str
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    router_id str
    The ID of this resource.
    routes Sequence[RouterRouteArgs]
    List of custom static routes to be advertised by the router.
    externalGatewayInfo Property Map
    External gateway configuration for the router.
    interfaces List<Property Map>
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name String
    The name of the router.
    projectId Number
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    projectName String
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    regionId Number
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    regionName String
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    routerId String
    The ID of this resource.
    routes List<Property Map>
    List of custom static routes to be advertised by the router.

    Outputs

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

    Get an existing Router 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?: RouterState, opts?: CustomResourceOptions): Router
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            external_gateway_info: Optional[RouterExternalGatewayInfoArgs] = None,
            interfaces: Optional[Sequence[RouterInterfaceArgs]] = None,
            name: Optional[str] = None,
            project_id: Optional[float] = None,
            project_name: Optional[str] = None,
            region_id: Optional[float] = None,
            region_name: Optional[str] = None,
            router_id: Optional[str] = None,
            routes: Optional[Sequence[RouterRouteArgs]] = None) -> Router
    func GetRouter(ctx *Context, name string, id IDInput, state *RouterState, opts ...ResourceOption) (*Router, error)
    public static Router Get(string name, Input<string> id, RouterState? state, CustomResourceOptions? opts = null)
    public static Router get(String name, Output<String> id, RouterState state, CustomResourceOptions options)
    resources:  _:    type: gcore:Router    get:      id: ${id}
    import {
      to = gcore_router.example
      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:
    ExternalGatewayInfo RouterExternalGatewayInfo
    External gateway configuration for the router.
    Interfaces List<RouterInterface>
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    Name string
    The name of the router.
    ProjectId double
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    ProjectName string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    RegionId double
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    RegionName string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    RouterId string
    The ID of this resource.
    Routes List<RouterRoute>
    List of custom static routes to be advertised by the router.
    ExternalGatewayInfo RouterExternalGatewayInfoArgs
    External gateway configuration for the router.
    Interfaces []RouterInterfaceArgs
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    Name string
    The name of the router.
    ProjectId float64
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    ProjectName string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    RegionId float64
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    RegionName string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    RouterId string
    The ID of this resource.
    Routes []RouterRouteArgs
    List of custom static routes to be advertised by the router.
    external_gateway_info object
    External gateway configuration for the router.
    interfaces list(object)
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name string
    The name of the router.
    project_id number
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    project_name string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    region_id number
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    region_name string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    router_id string
    The ID of this resource.
    routes list(object)
    List of custom static routes to be advertised by the router.
    externalGatewayInfo RouterExternalGatewayInfo
    External gateway configuration for the router.
    interfaces List<RouterInterface>
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name String
    The name of the router.
    projectId Double
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    projectName String
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    regionId Double
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    regionName String
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    routerId String
    The ID of this resource.
    routes List<RouterRoute>
    List of custom static routes to be advertised by the router.
    externalGatewayInfo RouterExternalGatewayInfo
    External gateway configuration for the router.
    interfaces RouterInterface[]
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name string
    The name of the router.
    projectId number
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    projectName string
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    regionId number
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    regionName string
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    routerId string
    The ID of this resource.
    routes RouterRoute[]
    List of custom static routes to be advertised by the router.
    external_gateway_info RouterExternalGatewayInfoArgs
    External gateway configuration for the router.
    interfaces Sequence[RouterInterfaceArgs]
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name str
    The name of the router.
    project_id float
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    project_name str
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    region_id float
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    region_name str
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    router_id str
    The ID of this resource.
    routes Sequence[RouterRouteArgs]
    List of custom static routes to be advertised by the router.
    externalGatewayInfo Property Map
    External gateway configuration for the router.
    interfaces List<Property Map>
    Set of interfaces attached to the router. Each interface connects the router to a subnet.
    name String
    The name of the router.
    projectId Number
    The id of the project. Either 'projectid' or 'projectname' must be specified.
    projectName String
    The name of the project. Either 'projectid' or 'projectname' must be specified.
    regionId Number
    The id of the region. Either 'regionid' or 'regionname' must be specified.
    regionName String
    The name of the region. Either 'regionid' or 'regionname' must be specified.
    routerId String
    The ID of this resource.
    routes List<Property Map>
    List of custom static routes to be advertised by the router.

    Supporting Types

    RouterExternalGatewayInfo, RouterExternalGatewayInfoArgs

    EnableSnat bool
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    ExternalFixedIps List<RouterExternalGatewayInfoExternalFixedIp>
    List of external fixed IPs assigned to the router's gateway.
    NetworkId string
    Id of the external network
    Type string
    Must be 'manual' or 'default'
    EnableSnat bool
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    ExternalFixedIps []RouterExternalGatewayInfoExternalFixedIp
    List of external fixed IPs assigned to the router's gateway.
    NetworkId string
    Id of the external network
    Type string
    Must be 'manual' or 'default'
    enable_snat bool
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    external_fixed_ips list(object)
    List of external fixed IPs assigned to the router's gateway.
    network_id string
    Id of the external network
    type string
    Must be 'manual' or 'default'
    enableSnat Boolean
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    externalFixedIps List<RouterExternalGatewayInfoExternalFixedIp>
    List of external fixed IPs assigned to the router's gateway.
    networkId String
    Id of the external network
    type String
    Must be 'manual' or 'default'
    enableSnat boolean
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    externalFixedIps RouterExternalGatewayInfoExternalFixedIp[]
    List of external fixed IPs assigned to the router's gateway.
    networkId string
    Id of the external network
    type string
    Must be 'manual' or 'default'
    enable_snat bool
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    external_fixed_ips Sequence[RouterExternalGatewayInfoExternalFixedIp]
    List of external fixed IPs assigned to the router's gateway.
    network_id str
    Id of the external network
    type str
    Must be 'manual' or 'default'
    enableSnat Boolean
    Whether SNAT (Source Network Address Translation) is enabled on the external gateway.
    externalFixedIps List<Property Map>
    List of external fixed IPs assigned to the router's gateway.
    networkId String
    Id of the external network
    type String
    Must be 'manual' or 'default'

    RouterExternalGatewayInfoExternalFixedIp, RouterExternalGatewayInfoExternalFixedIpArgs

    IpAddress string
    SubnetId string
    IpAddress string
    SubnetId string
    ip_address string
    subnet_id string
    ipAddress String
    subnetId String
    ipAddress string
    subnetId string
    ipAddress String
    subnetId String

    RouterInterface, RouterInterfaceArgs

    SubnetId string
    Subnet for router interface must have a gateway IP
    Type string
    must be 'subnet'
    IpAddress string
    The IP address assigned to the router interface.
    MacAddress string
    The MAC address of the router interface.
    NetworkId string
    The network ID the interface is connected to.
    PortId string
    The port ID of the router interface.
    SubnetId string
    Subnet for router interface must have a gateway IP
    Type string
    must be 'subnet'
    IpAddress string
    The IP address assigned to the router interface.
    MacAddress string
    The MAC address of the router interface.
    NetworkId string
    The network ID the interface is connected to.
    PortId string
    The port ID of the router interface.
    subnet_id string
    Subnet for router interface must have a gateway IP
    type string
    must be 'subnet'
    ip_address string
    The IP address assigned to the router interface.
    mac_address string
    The MAC address of the router interface.
    network_id string
    The network ID the interface is connected to.
    port_id string
    The port ID of the router interface.
    subnetId String
    Subnet for router interface must have a gateway IP
    type String
    must be 'subnet'
    ipAddress String
    The IP address assigned to the router interface.
    macAddress String
    The MAC address of the router interface.
    networkId String
    The network ID the interface is connected to.
    portId String
    The port ID of the router interface.
    subnetId string
    Subnet for router interface must have a gateway IP
    type string
    must be 'subnet'
    ipAddress string
    The IP address assigned to the router interface.
    macAddress string
    The MAC address of the router interface.
    networkId string
    The network ID the interface is connected to.
    portId string
    The port ID of the router interface.
    subnet_id str
    Subnet for router interface must have a gateway IP
    type str
    must be 'subnet'
    ip_address str
    The IP address assigned to the router interface.
    mac_address str
    The MAC address of the router interface.
    network_id str
    The network ID the interface is connected to.
    port_id str
    The port ID of the router interface.
    subnetId String
    Subnet for router interface must have a gateway IP
    type String
    must be 'subnet'
    ipAddress String
    The IP address assigned to the router interface.
    macAddress String
    The MAC address of the router interface.
    networkId String
    The network ID the interface is connected to.
    portId String
    The port ID of the router interface.

    RouterRoute, RouterRouteArgs

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

    Import

    import using <project_id>:<region_id>:<router_id> format

    $ pulumi import gcore:index/router:Router router1 1:6:447d2959-8ae0-4ca0-8d47-9f050a3637d7
    

    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
    Viewing docs for gcore 0.37.1
    published on Friday, Oct 23, 2026 by g-core

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial