1. Packages
  2. Openstack Provider
  3. API Docs
  4. networking
  5. RouterRoutesV2
OpenStack v5.3.2 published on Friday, Jul 18, 2025 by Pulumi

openstack.networking.RouterRoutesV2

Explore with Pulumi AI

openstack logo
OpenStack v5.3.2 published on Friday, Jul 18, 2025 by Pulumi

    Creates routing entries on a OpenStack V2 router.

    Note: This resource uses the OpenStack Neutron extraroute-atomic extension. If your environment does not have this extension, you should use the openstack.networking.RouterRoute resource to add routes instead.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const router1 = new openstack.networking.Router("router_1", {
        name: "router_1",
        adminStateUp: true,
    });
    const network1 = new openstack.networking.Network("network_1", {
        name: "network_1",
        adminStateUp: true,
    });
    const subnet1 = new openstack.networking.Subnet("subnet_1", {
        networkId: network1.id,
        cidr: "192.168.199.0/24",
        ipVersion: 4,
    });
    const int1 = new openstack.networking.RouterInterface("int_1", {
        routerId: router1.id,
        subnetId: subnet1.id,
    });
    const routerRoutes1 = new openstack.networking.RouterRoutesV2("router_routes_1", {
        routerId: int1.routerId,
        routes: [
            {
                destinationCidr: "10.0.1.0/24",
                nextHop: "192.168.199.254",
            },
            {
                destinationCidr: "10.0.2.0/24",
                nextHop: "192.168.199.254",
            },
        ],
    });
    
    import pulumi
    import pulumi_openstack as openstack
    
    router1 = openstack.networking.Router("router_1",
        name="router_1",
        admin_state_up=True)
    network1 = openstack.networking.Network("network_1",
        name="network_1",
        admin_state_up=True)
    subnet1 = openstack.networking.Subnet("subnet_1",
        network_id=network1.id,
        cidr="192.168.199.0/24",
        ip_version=4)
    int1 = openstack.networking.RouterInterface("int_1",
        router_id=router1.id,
        subnet_id=subnet1.id)
    router_routes1 = openstack.networking.RouterRoutesV2("router_routes_1",
        router_id=int1.router_id,
        routes=[
            {
                "destination_cidr": "10.0.1.0/24",
                "next_hop": "192.168.199.254",
            },
            {
                "destination_cidr": "10.0.2.0/24",
                "next_hop": "192.168.199.254",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v5/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, "router_1", &networking.RouterArgs{
    			Name:         pulumi.String("router_1"),
    			AdminStateUp: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		network1, err := networking.NewNetwork(ctx, "network_1", &networking.NetworkArgs{
    			Name:         pulumi.String("network_1"),
    			AdminStateUp: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		subnet1, err := networking.NewSubnet(ctx, "subnet_1", &networking.SubnetArgs{
    			NetworkId: network1.ID(),
    			Cidr:      pulumi.String("192.168.199.0/24"),
    			IpVersion: pulumi.Int(4),
    		})
    		if err != nil {
    			return err
    		}
    		int1, err := networking.NewRouterInterface(ctx, "int_1", &networking.RouterInterfaceArgs{
    			RouterId: router1.ID(),
    			SubnetId: subnet1.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = networking.NewRouterRoutesV2(ctx, "router_routes_1", &networking.RouterRoutesV2Args{
    			RouterId: int1.RouterId,
    			Routes: networking.RouterRoutesV2RouteArray{
    				&networking.RouterRoutesV2RouteArgs{
    					DestinationCidr: pulumi.String("10.0.1.0/24"),
    					NextHop:         pulumi.String("192.168.199.254"),
    				},
    				&networking.RouterRoutesV2RouteArgs{
    					DestinationCidr: pulumi.String("10.0.2.0/24"),
    					NextHop:         pulumi.String("192.168.199.254"),
    				},
    			},
    		})
    		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("router_1", new()
        {
            Name = "router_1",
            AdminStateUp = true,
        });
    
        var network1 = new OpenStack.Networking.Network("network_1", new()
        {
            Name = "network_1",
            AdminStateUp = true,
        });
    
        var subnet1 = new OpenStack.Networking.Subnet("subnet_1", new()
        {
            NetworkId = network1.Id,
            Cidr = "192.168.199.0/24",
            IpVersion = 4,
        });
    
        var int1 = new OpenStack.Networking.RouterInterface("int_1", new()
        {
            RouterId = router1.Id,
            SubnetId = subnet1.Id,
        });
    
        var routerRoutes1 = new OpenStack.Networking.RouterRoutesV2("router_routes_1", new()
        {
            RouterId = int1.RouterId,
            Routes = new[]
            {
                new OpenStack.Networking.Inputs.RouterRoutesV2RouteArgs
                {
                    DestinationCidr = "10.0.1.0/24",
                    NextHop = "192.168.199.254",
                },
                new OpenStack.Networking.Inputs.RouterRoutesV2RouteArgs
                {
                    DestinationCidr = "10.0.2.0/24",
                    NextHop = "192.168.199.254",
                },
            },
        });
    
    });
    
    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.RouterRoutesV2;
    import com.pulumi.openstack.networking.RouterRoutesV2Args;
    import com.pulumi.openstack.networking.inputs.RouterRoutesV2RouteArgs;
    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()
                .name("router_1")
                .adminStateUp(true)
                .build());
    
            var network1 = new Network("network1", NetworkArgs.builder()
                .name("network_1")
                .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 routerRoutes1 = new RouterRoutesV2("routerRoutes1", RouterRoutesV2Args.builder()
                .routerId(int1.routerId())
                .routes(            
                    RouterRoutesV2RouteArgs.builder()
                        .destinationCidr("10.0.1.0/24")
                        .nextHop("192.168.199.254")
                        .build(),
                    RouterRoutesV2RouteArgs.builder()
                        .destinationCidr("10.0.2.0/24")
                        .nextHop("192.168.199.254")
                        .build())
                .build());
    
        }
    }
    
    resources:
      router1:
        type: openstack:networking:Router
        name: router_1
        properties:
          name: router_1
          adminStateUp: 'true'
      network1:
        type: openstack:networking:Network
        name: network_1
        properties:
          name: network_1
          adminStateUp: 'true'
      subnet1:
        type: openstack:networking:Subnet
        name: subnet_1
        properties:
          networkId: ${network1.id}
          cidr: 192.168.199.0/24
          ipVersion: 4
      int1:
        type: openstack:networking:RouterInterface
        name: int_1
        properties:
          routerId: ${router1.id}
          subnetId: ${subnet1.id}
      routerRoutes1:
        type: openstack:networking:RouterRoutesV2
        name: router_routes_1
        properties:
          routerId: ${int1.routerId}
          routes:
            - destinationCidr: 10.0.1.0/24
              nextHop: 192.168.199.254
            - destinationCidr: 10.0.2.0/24
              nextHop: 192.168.199.254
    

    Notes

    The next_hop IP address must be directly reachable from the router at the openstack.networking.RouterRoutesV2 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 RouterRoutesV2 Resource

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

    Constructor syntax

    new RouterRoutesV2(name: string, args: RouterRoutesV2Args, opts?: CustomResourceOptions);
    @overload
    def RouterRoutesV2(resource_name: str,
                       args: RouterRoutesV2Args,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def RouterRoutesV2(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       router_id: Optional[str] = None,
                       region: Optional[str] = None,
                       routes: Optional[Sequence[RouterRoutesV2RouteArgs]] = None)
    func NewRouterRoutesV2(ctx *Context, name string, args RouterRoutesV2Args, opts ...ResourceOption) (*RouterRoutesV2, error)
    public RouterRoutesV2(string name, RouterRoutesV2Args args, CustomResourceOptions? opts = null)
    public RouterRoutesV2(String name, RouterRoutesV2Args args)
    public RouterRoutesV2(String name, RouterRoutesV2Args args, CustomResourceOptions options)
    
    type: openstack:networking:RouterRoutesV2
    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 RouterRoutesV2Args
    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 RouterRoutesV2Args
    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 RouterRoutesV2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouterRoutesV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouterRoutesV2Args
    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 routerRoutesV2Resource = new OpenStack.Networking.RouterRoutesV2("routerRoutesV2Resource", new()
    {
        RouterId = "string",
        Region = "string",
        Routes = new[]
        {
            new OpenStack.Networking.Inputs.RouterRoutesV2RouteArgs
            {
                DestinationCidr = "string",
                NextHop = "string",
            },
        },
    });
    
    example, err := networking.NewRouterRoutesV2(ctx, "routerRoutesV2Resource", &networking.RouterRoutesV2Args{
    	RouterId: pulumi.String("string"),
    	Region:   pulumi.String("string"),
    	Routes: networking.RouterRoutesV2RouteArray{
    		&networking.RouterRoutesV2RouteArgs{
    			DestinationCidr: pulumi.String("string"),
    			NextHop:         pulumi.String("string"),
    		},
    	},
    })
    
    var routerRoutesV2Resource = new RouterRoutesV2("routerRoutesV2Resource", RouterRoutesV2Args.builder()
        .routerId("string")
        .region("string")
        .routes(RouterRoutesV2RouteArgs.builder()
            .destinationCidr("string")
            .nextHop("string")
            .build())
        .build());
    
    router_routes_v2_resource = openstack.networking.RouterRoutesV2("routerRoutesV2Resource",
        router_id="string",
        region="string",
        routes=[{
            "destination_cidr": "string",
            "next_hop": "string",
        }])
    
    const routerRoutesV2Resource = new openstack.networking.RouterRoutesV2("routerRoutesV2Resource", {
        routerId: "string",
        region: "string",
        routes: [{
            destinationCidr: "string",
            nextHop: "string",
        }],
    });
    
    type: openstack:networking:RouterRoutesV2
    properties:
        region: string
        routerId: string
        routes:
            - destinationCidr: string
              nextHop: string
    

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

    RouterId string
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    Routes List<Pulumi.OpenStack.Networking.Inputs.RouterRoutesV2Route>
    A set of routing entries to add to the router.
    RouterId string
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    Routes []RouterRoutesV2RouteArgs
    A set of routing entries to add to the router.
    routerId String
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routes List<RouterRoutesV2Route>
    A set of routing entries to add to the router.
    routerId string
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routes RouterRoutesV2Route[]
    A set of routing entries to add to the router.
    router_id str
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routes Sequence[RouterRoutesV2RouteArgs]
    A set of routing entries to add to the router.
    routerId String
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routes List<Property Map>
    A set of routing entries to add to the router.

    Outputs

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

    Get an existing RouterRoutesV2 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?: RouterRoutesV2State, opts?: CustomResourceOptions): RouterRoutesV2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            region: Optional[str] = None,
            router_id: Optional[str] = None,
            routes: Optional[Sequence[RouterRoutesV2RouteArgs]] = None) -> RouterRoutesV2
    func GetRouterRoutesV2(ctx *Context, name string, id IDInput, state *RouterRoutesV2State, opts ...ResourceOption) (*RouterRoutesV2, error)
    public static RouterRoutesV2 Get(string name, Input<string> id, RouterRoutesV2State? state, CustomResourceOptions? opts = null)
    public static RouterRoutesV2 get(String name, Output<String> id, RouterRoutesV2State state, CustomResourceOptions options)
    resources:  _:    type: openstack:networking:RouterRoutesV2    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    RouterId string
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    Routes List<Pulumi.OpenStack.Networking.Inputs.RouterRoutesV2Route>
    A set of routing entries to add to the router.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    RouterId string
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    Routes []RouterRoutesV2RouteArgs
    A set of routing entries to add to the router.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routerId String
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    routes List<RouterRoutesV2Route>
    A set of routing entries to add to the router.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routerId string
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    routes RouterRoutesV2Route[]
    A set of routing entries to add to the router.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    router_id str
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    routes Sequence[RouterRoutesV2RouteArgs]
    A set of routing entries to add to the router.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to configure routing entres on a router. If omitted, the region argument of the provider is used. Changing this creates new routing entries.
    routerId String
    ID of the router these routing entries belong to. Changing this creates new routing entries.
    routes List<Property Map>
    A set of routing entries to add to the router.

    Supporting Types

    RouterRoutesV2Route, RouterRoutesV2RouteArgs

    DestinationCidr string
    CIDR block to match on the packet’s destination IP.
    NextHop string
    IP address of the next hop gateway.
    DestinationCidr string
    CIDR block to match on the packet’s destination IP.
    NextHop string
    IP address of the next hop gateway.
    destinationCidr String
    CIDR block to match on the packet’s destination IP.
    nextHop String
    IP address of the next hop gateway.
    destinationCidr string
    CIDR block to match on the packet’s destination IP.
    nextHop string
    IP address of the next hop gateway.
    destination_cidr str
    CIDR block to match on the packet’s destination IP.
    next_hop str
    IP address of the next hop gateway.
    destinationCidr String
    CIDR block to match on the packet’s destination IP.
    nextHop String
    IP address of the next hop gateway.

    Import

    Routing entries can be imported using a router id:

    $ pulumi import openstack:networking/routerRoutesV2:RouterRoutesV2 router_routes_1 686fe248-386c-4f70-9f6c-281607dad079
    

    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 v5.3.2 published on Friday, Jul 18, 2025 by Pulumi