1. Packages
  2. OpenStack
  3. API Docs
  4. networking
  5. RouterRoute
OpenStack v3.15.2 published on Friday, Mar 29, 2024 by Pulumi

openstack.networking.RouterRoute

Explore with Pulumi AI

openstack logo
OpenStack v3.15.2 published on Friday, Mar 29, 2024 by Pulumi

    Creates a routing entry on a OpenStack V2 router.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const router1 = new openstack.networking.Router("router1", {adminStateUp: true});
    const network1 = new openstack.networking.Network("network1", {adminStateUp: true});
    const subnet1 = new openstack.networking.Subnet("subnet1", {
        networkId: network1.id,
        cidr: "192.168.199.0/24",
        ipVersion: 4,
    });
    const int1 = new openstack.networking.RouterInterface("int1", {
        routerId: router1.id,
        subnetId: subnet1.id,
    });
    const routerRoute1 = new openstack.networking.RouterRoute("routerRoute1", {
        routerId: router1.id,
        destinationCidr: "10.0.1.0/24",
        nextHop: "192.168.199.254",
    }, {
        dependsOn: ["openstack_networking_router_interface_v2.int_1"],
    });
    
    import pulumi
    import pulumi_openstack as openstack
    
    router1 = openstack.networking.Router("router1", admin_state_up=True)
    network1 = openstack.networking.Network("network1", admin_state_up=True)
    subnet1 = openstack.networking.Subnet("subnet1",
        network_id=network1.id,
        cidr="192.168.199.0/24",
        ip_version=4)
    int1 = openstack.networking.RouterInterface("int1",
        router_id=router1.id,
        subnet_id=subnet1.id)
    router_route1 = openstack.networking.RouterRoute("routerRoute1",
        router_id=router1.id,
        destination_cidr="10.0.1.0/24",
        next_hop="192.168.199.254",
        opts=pulumi.ResourceOptions(depends_on=["openstack_networking_router_interface_v2.int_1"]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		router1, err := networking.NewRouter(ctx, "router1", &networking.RouterArgs{
    			AdminStateUp: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		network1, err := networking.NewNetwork(ctx, "network1", &networking.NetworkArgs{
    			AdminStateUp: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		subnet1, err := networking.NewSubnet(ctx, "subnet1", &networking.SubnetArgs{
    			NetworkId: network1.ID(),
    			Cidr:      pulumi.String("192.168.199.0/24"),
    			IpVersion: pulumi.Int(4),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = networking.NewRouterInterface(ctx, "int1", &networking.RouterInterfaceArgs{
    			RouterId: router1.ID(),
    			SubnetId: subnet1.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = networking.NewRouterRoute(ctx, "routerRoute1", &networking.RouterRouteArgs{
    			RouterId:        router1.ID(),
    			DestinationCidr: pulumi.String("10.0.1.0/24"),
    			NextHop:         pulumi.String("192.168.199.254"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			pulumi.Resource("openstack_networking_router_interface_v2.int_1"),
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using OpenStack = Pulumi.OpenStack;
    
    return await Deployment.RunAsync(() => 
    {
        var router1 = new OpenStack.Networking.Router("router1", new()
        {
            AdminStateUp = true,
        });
    
        var network1 = new OpenStack.Networking.Network("network1", new()
        {
            AdminStateUp = true,
        });
    
        var subnet1 = new OpenStack.Networking.Subnet("subnet1", new()
        {
            NetworkId = network1.Id,
            Cidr = "192.168.199.0/24",
            IpVersion = 4,
        });
    
        var int1 = new OpenStack.Networking.RouterInterface("int1", new()
        {
            RouterId = router1.Id,
            SubnetId = subnet1.Id,
        });
    
        var routerRoute1 = new OpenStack.Networking.RouterRoute("routerRoute1", new()
        {
            RouterId = router1.Id,
            DestinationCidr = "10.0.1.0/24",
            NextHop = "192.168.199.254",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                "openstack_networking_router_interface_v2.int_1", 
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.openstack.networking.Router;
    import com.pulumi.openstack.networking.RouterArgs;
    import com.pulumi.openstack.networking.Network;
    import com.pulumi.openstack.networking.NetworkArgs;
    import com.pulumi.openstack.networking.Subnet;
    import com.pulumi.openstack.networking.SubnetArgs;
    import com.pulumi.openstack.networking.RouterInterface;
    import com.pulumi.openstack.networking.RouterInterfaceArgs;
    import com.pulumi.openstack.networking.RouterRoute;
    import com.pulumi.openstack.networking.RouterRouteArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 router1 = new Router("router1", RouterArgs.builder()        
                .adminStateUp("true")
                .build());
    
            var network1 = new Network("network1", NetworkArgs.builder()        
                .adminStateUp("true")
                .build());
    
            var subnet1 = new Subnet("subnet1", SubnetArgs.builder()        
                .networkId(network1.id())
                .cidr("192.168.199.0/24")
                .ipVersion(4)
                .build());
    
            var int1 = new RouterInterface("int1", RouterInterfaceArgs.builder()        
                .routerId(router1.id())
                .subnetId(subnet1.id())
                .build());
    
            var routerRoute1 = new RouterRoute("routerRoute1", RouterRouteArgs.builder()        
                .routerId(router1.id())
                .destinationCidr("10.0.1.0/24")
                .nextHop("192.168.199.254")
                .build(), CustomResourceOptions.builder()
                    .dependsOn("openstack_networking_router_interface_v2.int_1")
                    .build());
    
        }
    }
    
    resources:
      router1:
        type: openstack:networking:Router
        properties:
          adminStateUp: 'true'
      network1:
        type: openstack:networking:Network
        properties:
          adminStateUp: 'true'
      subnet1:
        type: openstack:networking:Subnet
        properties:
          networkId: ${network1.id}
          cidr: 192.168.199.0/24
          ipVersion: 4
      int1:
        type: openstack:networking:RouterInterface
        properties:
          routerId: ${router1.id}
          subnetId: ${subnet1.id}
      routerRoute1:
        type: openstack:networking:RouterRoute
        properties:
          routerId: ${router1.id}
          destinationCidr: 10.0.1.0/24
          nextHop: 192.168.199.254
        options:
          dependson:
            - openstack_networking_router_interface_v2.int_1
    

    Notes

    The next_hop IP address must be directly reachable from the router at the openstack.networking.RouterRoute resource creation time. You can ensure that by explicitly specifying a dependency on the openstack.networking.RouterInterface resource that connects the next hop to the router, as in the example above.

    Create RouterRoute Resource

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

    Constructor syntax

    new RouterRoute(name: string, args: RouterRouteArgs, opts?: CustomResourceOptions);
    @overload
    def RouterRoute(resource_name: str,
                    args: RouterRouteArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def RouterRoute(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    destination_cidr: Optional[str] = None,
                    next_hop: Optional[str] = None,
                    router_id: Optional[str] = None,
                    region: Optional[str] = None)
    func NewRouterRoute(ctx *Context, name string, args RouterRouteArgs, opts ...ResourceOption) (*RouterRoute, error)
    public RouterRoute(string name, RouterRouteArgs args, CustomResourceOptions? opts = null)
    public RouterRoute(String name, RouterRouteArgs args)
    public RouterRoute(String name, RouterRouteArgs args, CustomResourceOptions options)
    
    type: openstack:networking:RouterRoute
    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 RouterRouteArgs
    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 RouterRouteArgs
    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 RouterRouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouterRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouterRouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var routerRouteResource = new OpenStack.Networking.RouterRoute("routerRouteResource", new()
    {
        DestinationCidr = "string",
        NextHop = "string",
        RouterId = "string",
        Region = "string",
    });
    
    example, err := networking.NewRouterRoute(ctx, "routerRouteResource", &networking.RouterRouteArgs{
    	DestinationCidr: pulumi.String("string"),
    	NextHop:         pulumi.String("string"),
    	RouterId:        pulumi.String("string"),
    	Region:          pulumi.String("string"),
    })
    
    var routerRouteResource = new RouterRoute("routerRouteResource", RouterRouteArgs.builder()        
        .destinationCidr("string")
        .nextHop("string")
        .routerId("string")
        .region("string")
        .build());
    
    router_route_resource = openstack.networking.RouterRoute("routerRouteResource",
        destination_cidr="string",
        next_hop="string",
        router_id="string",
        region="string")
    
    const routerRouteResource = new openstack.networking.RouterRoute("routerRouteResource", {
        destinationCidr: "string",
        nextHop: "string",
        routerId: "string",
        region: "string",
    });
    
    type: openstack:networking:RouterRoute
    properties:
        destinationCidr: string
        nextHop: string
        region: string
        routerId: string
    

    RouterRoute Resource Properties

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

    Inputs

    The RouterRoute resource accepts the following input properties:

    DestinationCidr string
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    NextHop string
    IP address of the next hop gateway. Changing this creates a new routing entry.
    RouterId string
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    DestinationCidr string
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    NextHop string
    IP address of the next hop gateway. Changing this creates a new routing entry.
    RouterId string
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    destinationCidr String
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    nextHop String
    IP address of the next hop gateway. Changing this creates a new routing entry.
    routerId String
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    destinationCidr string
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    nextHop string
    IP address of the next hop gateway. Changing this creates a new routing entry.
    routerId string
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    destination_cidr str
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    next_hop str
    IP address of the next hop gateway. Changing this creates a new routing entry.
    router_id str
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    destinationCidr String
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    nextHop String
    IP address of the next hop gateway. Changing this creates a new routing entry.
    routerId String
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.

    Outputs

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

    Get an existing RouterRoute 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?: RouterRouteState, opts?: CustomResourceOptions): RouterRoute
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            destination_cidr: Optional[str] = None,
            next_hop: Optional[str] = None,
            region: Optional[str] = None,
            router_id: Optional[str] = None) -> RouterRoute
    func GetRouterRoute(ctx *Context, name string, id IDInput, state *RouterRouteState, opts ...ResourceOption) (*RouterRoute, error)
    public static RouterRoute Get(string name, Input<string> id, RouterRouteState? state, CustomResourceOptions? opts = null)
    public static RouterRoute get(String name, Output<String> id, RouterRouteState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    DestinationCidr string
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    NextHop string
    IP address of the next hop gateway. Changing this creates a new routing entry.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    RouterId string
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    DestinationCidr string
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    NextHop string
    IP address of the next hop gateway. Changing this creates a new routing entry.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    RouterId string
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    destinationCidr String
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    nextHop String
    IP address of the next hop gateway. Changing this creates a new routing entry.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    routerId String
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    destinationCidr string
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    nextHop string
    IP address of the next hop gateway. Changing this creates a new routing entry.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    routerId string
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    destination_cidr str
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    next_hop str
    IP address of the next hop gateway. Changing this creates a new routing entry.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    router_id str
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.
    destinationCidr String
    CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
    nextHop String
    IP address of the next hop gateway. Changing this creates a new routing entry.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure a routing entry on a router. If omitted, the region argument of the provider is used. Changing this creates a new routing entry.
    routerId String
    ID of the router this routing entry belongs to. Changing this creates a new routing entry.

    Import

    Routing entries can be imported using a combined ID using the following format: <router_id>-route-<destination_cidr>-<next_hop>

    $ pulumi import openstack:networking/routerRoute:RouterRoute router_route_1 686fe248-386c-4f70-9f6c-281607dad079-route-10.0.1.0/24-192.168.199.25
    

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

    Package Details

    Repository
    OpenStack pulumi/pulumi-openstack
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the openstack Terraform Provider.
    openstack logo
    OpenStack v3.15.2 published on Friday, Mar 29, 2024 by Pulumi