gcorelabs.Router
Explore with Pulumi AI
Represent router. Router enables you to dynamically exchange routes between networks
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcore from "@pulumi/gcore";
const router = new gcore.index.Gcore_router("router", {
name: "router_example",
dynamic: [
{
iterator: egi,
forEach: _var.external_gateway_info,
content: [{
type: egi.value.type,
enableSnat: egi.value.enable_snat,
networkId: egi.value.network_id,
}],
},
{
iterator: ifaces,
forEach: _var.interfaces,
content: [{
type: ifaces.value.type,
subnetId: ifaces.value.subnet_id,
}],
},
{
iterator: rs,
forEach: _var.routes,
content: [{
destination: rs.value.destination,
nexthop: rs.value.nexthop,
}],
},
],
regionId: 1,
projectId: 1,
});
import pulumi
import pulumi_gcore as gcore
router = gcore.index.Gcore_router("router",
name=router_example,
dynamic=[
{
iterator: egi,
forEach: var.external_gateway_info,
content: [{
type: egi.value.type,
enableSnat: egi.value.enable_snat,
networkId: egi.value.network_id,
}],
},
{
iterator: ifaces,
forEach: var.interfaces,
content: [{
type: ifaces.value.type,
subnetId: ifaces.value.subnet_id,
}],
},
{
iterator: rs,
forEach: var.routes,
content: [{
destination: rs.value.destination,
nexthop: rs.value.nexthop,
}],
},
],
region_id=1,
project_id=1)
package main
import (
"github.com/pulumi/pulumi-gcore/sdk/go/gcore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gcore.NewGcore_router(ctx, "router", &gcore.Gcore_routerArgs{
Name: "router_example",
Dynamic: []map[string]interface{}{
map[string]interface{}{
"iterator": egi,
"forEach": _var.External_gateway_info,
"content": []map[string]interface{}{
map[string]interface{}{
"type": egi.Value.Type,
"enableSnat": egi.Value.Enable_snat,
"networkId": egi.Value.Network_id,
},
},
},
map[string]interface{}{
"iterator": ifaces,
"forEach": _var.Interfaces,
"content": []map[string]interface{}{
map[string]interface{}{
"type": ifaces.Value.Type,
"subnetId": ifaces.Value.Subnet_id,
},
},
},
map[string]interface{}{
"iterator": rs,
"forEach": _var.Routes,
"content": []map[string]interface{}{
map[string]interface{}{
"destination": rs.Value.Destination,
"nexthop": rs.Value.Nexthop,
},
},
},
},
RegionId: 1,
ProjectId: 1,
})
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 router = new Gcore.Index.Gcore_router("router", new()
{
Name = "router_example",
Dynamic = new[]
{
{
{ "iterator", egi },
{ "forEach", @var.External_gateway_info },
{ "content", new[]
{
{
{ "type", egi.Value.Type },
{ "enableSnat", egi.Value.Enable_snat },
{ "networkId", egi.Value.Network_id },
},
} },
},
{
{ "iterator", ifaces },
{ "forEach", @var.Interfaces },
{ "content", new[]
{
{
{ "type", ifaces.Value.Type },
{ "subnetId", ifaces.Value.Subnet_id },
},
} },
},
{
{ "iterator", rs },
{ "forEach", @var.Routes },
{ "content", new[]
{
{
{ "destination", rs.Value.Destination },
{ "nexthop", rs.Value.Nexthop },
},
} },
},
},
RegionId = 1,
ProjectId = 1,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.gcore_router;
import com.pulumi.gcore.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 router = new Gcore_router("router", Gcore_routerArgs.builder()
.name("router_example")
.dynamic(
%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.regionId(1)
.projectId(1)
.build());
}
}
resources:
router:
type: gcore:gcore_router
properties:
name: router_example
dynamic:
- iterator: ${egi}
forEach: ${var.external_gateway_info}
content:
- type: ${egi.value.type}
enableSnat: ${egi.value.enable_snat}
networkId: ${egi.value.network_id}
- iterator: ${ifaces}
forEach: ${var.interfaces}
content:
- type: ${ifaces.value.type}
subnetId: ${ifaces.value.subnet_id}
- iterator: ${rs}
forEach: ${var.routes}
content:
- destination: ${rs.value.destination}
nexthop: ${rs.value.nexthop}
regionId: 1
projectId: 1
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,
last_updated: Optional[str] = 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: gcorelabs:Router
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 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 Gcorelabs.Router("routerResource", new()
{
ExternalGatewayInfo = new Gcorelabs.Inputs.RouterExternalGatewayInfoArgs
{
EnableSnat = false,
ExternalFixedIps = new[]
{
new Gcorelabs.Inputs.RouterExternalGatewayInfoExternalFixedIpArgs
{
IpAddress = "string",
SubnetId = "string",
},
},
NetworkId = "string",
Type = "string",
},
Interfaces = new[]
{
new Gcorelabs.Inputs.RouterInterfaceArgs
{
SubnetId = "string",
Type = "string",
IpAddress = "string",
MacAddress = "string",
NetworkId = "string",
PortId = "string",
},
},
LastUpdated = "string",
Name = "string",
ProjectId = 0,
ProjectName = "string",
RegionId = 0,
RegionName = "string",
RouterId = "string",
Routes = new[]
{
new Gcorelabs.Inputs.RouterRouteArgs
{
Destination = "string",
Nexthop = "string",
},
},
});
example, err := gcorelabs.NewRouter(ctx, "routerResource", &gcorelabs.RouterArgs{
ExternalGatewayInfo: &gcorelabs.RouterExternalGatewayInfoArgs{
EnableSnat: pulumi.Bool(false),
ExternalFixedIps: gcorelabs.RouterExternalGatewayInfoExternalFixedIpArray{
&gcorelabs.RouterExternalGatewayInfoExternalFixedIpArgs{
IpAddress: pulumi.String("string"),
SubnetId: pulumi.String("string"),
},
},
NetworkId: pulumi.String("string"),
Type: pulumi.String("string"),
},
Interfaces: gcorelabs.RouterInterfaceArray{
&gcorelabs.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"),
},
},
LastUpdated: 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: gcorelabs.RouterRouteArray{
&gcorelabs.RouterRouteArgs{
Destination: pulumi.String("string"),
Nexthop: pulumi.String("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())
.lastUpdated("string")
.name("string")
.projectId(0)
.projectName("string")
.regionId(0)
.regionName("string")
.routerId("string")
.routes(RouterRouteArgs.builder()
.destination("string")
.nexthop("string")
.build())
.build());
router_resource = gcorelabs.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",
}],
last_updated="string",
name="string",
project_id=0,
project_name="string",
region_id=0,
region_name="string",
router_id="string",
routes=[{
"destination": "string",
"nexthop": "string",
}])
const routerResource = new gcorelabs.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",
}],
lastUpdated: "string",
name: "string",
projectId: 0,
projectName: "string",
regionId: 0,
regionName: "string",
routerId: "string",
routes: [{
destination: "string",
nexthop: "string",
}],
});
type: gcorelabs: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
lastUpdated: 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:
- External
Gateway RouterInfo External Gateway Info - Interfaces
List<Router
Interface> - Last
Updated string - Name string
- Project
Id double - Project
Name string - Region
Id double - Region
Name string - Router
Id string - The ID of this resource.
- Routes
List<Router
Route>
- External
Gateway RouterInfo External Gateway Info Args - Interfaces
[]Router
Interface Args - Last
Updated string - Name string
- Project
Id float64 - Project
Name string - Region
Id float64 - Region
Name string - Router
Id string - The ID of this resource.
- Routes
[]Router
Route Args
- external
Gateway RouterInfo External Gateway Info - interfaces
List<Router
Interface> - last
Updated String - name String
- project
Id Double - project
Name String - region
Id Double - region
Name String - router
Id String - The ID of this resource.
- routes
List<Router
Route>
- external
Gateway RouterInfo External Gateway Info - interfaces
Router
Interface[] - last
Updated string - name string
- project
Id number - project
Name string - region
Id number - region
Name string - router
Id string - The ID of this resource.
- routes
Router
Route[]
- external_
gateway_ Routerinfo External Gateway Info Args - interfaces
Sequence[Router
Interface Args] - last_
updated str - name str
- project_
id float - project_
name str - region_
id float - region_
name str - router_
id str - The ID of this resource.
- routes
Sequence[Router
Route Args]
- external
Gateway Property MapInfo - interfaces List<Property Map>
- last
Updated String - name String
- project
Id Number - project
Name String - region
Id Number - region
Name String - router
Id String - The ID of this resource.
- routes List<Property Map>
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 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,
last_updated: Optional[str] = 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: gcorelabs:Router 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.
- External
Gateway RouterInfo External Gateway Info - Interfaces
List<Router
Interface> - Last
Updated string - Name string
- Project
Id double - Project
Name string - Region
Id double - Region
Name string - Router
Id string - The ID of this resource.
- Routes
List<Router
Route>
- External
Gateway RouterInfo External Gateway Info Args - Interfaces
[]Router
Interface Args - Last
Updated string - Name string
- Project
Id float64 - Project
Name string - Region
Id float64 - Region
Name string - Router
Id string - The ID of this resource.
- Routes
[]Router
Route Args
- external
Gateway RouterInfo External Gateway Info - interfaces
List<Router
Interface> - last
Updated String - name String
- project
Id Double - project
Name String - region
Id Double - region
Name String - router
Id String - The ID of this resource.
- routes
List<Router
Route>
- external
Gateway RouterInfo External Gateway Info - interfaces
Router
Interface[] - last
Updated string - name string
- project
Id number - project
Name string - region
Id number - region
Name string - router
Id string - The ID of this resource.
- routes
Router
Route[]
- external_
gateway_ Routerinfo External Gateway Info Args - interfaces
Sequence[Router
Interface Args] - last_
updated str - name str
- project_
id float - project_
name str - region_
id float - region_
name str - router_
id str - The ID of this resource.
- routes
Sequence[Router
Route Args]
- external
Gateway Property MapInfo - interfaces List<Property Map>
- last
Updated String - name String
- project
Id Number - project
Name String - region
Id Number - region
Name String - router
Id String - The ID of this resource.
- routes List<Property Map>
Supporting Types
RouterExternalGatewayInfo, RouterExternalGatewayInfoArgs
- Enable
Snat bool - External
Fixed List<RouterIps External Gateway Info External Fixed Ip> - Network
Id string - Id of the external network
- Type string
- Must be 'manual' or 'default'
- Enable
Snat bool - External
Fixed []RouterIps External Gateway Info External Fixed Ip - Network
Id string - Id of the external network
- Type string
- Must be 'manual' or 'default'
- enable
Snat Boolean - external
Fixed List<RouterIps External Gateway Info External Fixed Ip> - network
Id String - Id of the external network
- type String
- Must be 'manual' or 'default'
- enable
Snat boolean - external
Fixed RouterIps External Gateway Info External Fixed Ip[] - network
Id string - Id of the external network
- type string
- Must be 'manual' or 'default'
- enable_
snat bool - external_
fixed_ Sequence[Routerips External Gateway Info External Fixed Ip] - network_
id str - Id of the external network
- type str
- Must be 'manual' or 'default'
- enable
Snat Boolean - external
Fixed List<Property Map>Ips - network
Id String - Id of the external network
- type String
- Must be 'manual' or 'default'
RouterExternalGatewayInfoExternalFixedIp, RouterExternalGatewayInfoExternalFixedIpArgs
- ip_
address str - subnet_
id str
RouterInterface, RouterInterfaceArgs
- subnet_
id str - Subnet for router interface must have a gateway IP
- type str
- must be 'subnet'
- ip_
address str - mac_
address str - network_
id str - port_
id str
RouterRoute, RouterRouteArgs
- Destination string
- Nexthop string
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- Destination string
- Nexthop string
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination String
- nexthop String
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination string
- nexthop string
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination str
- nexthop str
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination String
- 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 gcorelabs: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
- gcorelabs g-core/terraform-provider-gcorelabs
- License
- Notes
- This Pulumi package is based on the
gcorelabs
Terraform Provider.