openstack.networking.SubnetRoute
Explore with Pulumi AI
Creates a routing entry on a OpenStack V2 subnet.
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 subnetRoute1 = new openstack.networking.SubnetRoute("subnet_route_1", {
subnetId: subnet1.id,
destinationCidr: "10.0.1.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)
subnet_route1 = openstack.networking.SubnetRoute("subnet_route_1",
subnet_id=subnet1.id,
destination_cidr="10.0.1.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 {
_, 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
}
_, err = networking.NewSubnetRoute(ctx, "subnet_route_1", &networking.SubnetRouteArgs{
SubnetId: subnet1.ID(),
DestinationCidr: pulumi.String("10.0.1.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 subnetRoute1 = new OpenStack.Networking.SubnetRoute("subnet_route_1", new()
{
SubnetId = subnet1.Id,
DestinationCidr = "10.0.1.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.SubnetRoute;
import com.pulumi.openstack.networking.SubnetRouteArgs;
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 subnetRoute1 = new SubnetRoute("subnetRoute1", SubnetRouteArgs.builder()
.subnetId(subnet1.id())
.destinationCidr("10.0.1.0/24")
.nextHop("192.168.199.254")
.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
subnetRoute1:
type: openstack:networking:SubnetRoute
name: subnet_route_1
properties:
subnetId: ${subnet1.id}
destinationCidr: 10.0.1.0/24
nextHop: 192.168.199.254
Create SubnetRoute Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SubnetRoute(name: string, args: SubnetRouteArgs, opts?: CustomResourceOptions);
@overload
def SubnetRoute(resource_name: str,
args: SubnetRouteArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SubnetRoute(resource_name: str,
opts: Optional[ResourceOptions] = None,
destination_cidr: Optional[str] = None,
next_hop: Optional[str] = None,
subnet_id: Optional[str] = None,
region: Optional[str] = None)
func NewSubnetRoute(ctx *Context, name string, args SubnetRouteArgs, opts ...ResourceOption) (*SubnetRoute, error)
public SubnetRoute(string name, SubnetRouteArgs args, CustomResourceOptions? opts = null)
public SubnetRoute(String name, SubnetRouteArgs args)
public SubnetRoute(String name, SubnetRouteArgs args, CustomResourceOptions options)
type: openstack:networking:SubnetRoute
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 SubnetRouteArgs
- 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 SubnetRouteArgs
- 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 SubnetRouteArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubnetRouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SubnetRouteArgs
- 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 subnetRouteResource = new OpenStack.Networking.SubnetRoute("subnetRouteResource", new()
{
DestinationCidr = "string",
NextHop = "string",
SubnetId = "string",
Region = "string",
});
example, err := networking.NewSubnetRoute(ctx, "subnetRouteResource", &networking.SubnetRouteArgs{
DestinationCidr: pulumi.String("string"),
NextHop: pulumi.String("string"),
SubnetId: pulumi.String("string"),
Region: pulumi.String("string"),
})
var subnetRouteResource = new SubnetRoute("subnetRouteResource", SubnetRouteArgs.builder()
.destinationCidr("string")
.nextHop("string")
.subnetId("string")
.region("string")
.build());
subnet_route_resource = openstack.networking.SubnetRoute("subnetRouteResource",
destination_cidr="string",
next_hop="string",
subnet_id="string",
region="string")
const subnetRouteResource = new openstack.networking.SubnetRoute("subnetRouteResource", {
destinationCidr: "string",
nextHop: "string",
subnetId: "string",
region: "string",
});
type: openstack:networking:SubnetRoute
properties:
destinationCidr: string
nextHop: string
region: string
subnetId: string
SubnetRoute 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 SubnetRoute resource accepts the following input properties:
- Destination
Cidr string - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- Next
Hop string - IP address of the next hop gateway. Changing this creates a new routing entry.
- Subnet
Id string - ID of the subnet 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry.
- Destination
Cidr string - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- Next
Hop string - IP address of the next hop gateway. Changing this creates a new routing entry.
- Subnet
Id string - ID of the subnet 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry.
- destination
Cidr String - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- next
Hop String - IP address of the next hop gateway. Changing this creates a new routing entry.
- subnet
Id String - ID of the subnet 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry.
- destination
Cidr string - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- next
Hop string - IP address of the next hop gateway. Changing this creates a new routing entry.
- subnet
Id string - ID of the subnet 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 subnet. 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.
- subnet_
id str - ID of the subnet 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry.
- destination
Cidr String - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- next
Hop String - IP address of the next hop gateway. Changing this creates a new routing entry.
- subnet
Id String - ID of the subnet 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 subnet. 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 SubnetRoute 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 SubnetRoute Resource
Get an existing SubnetRoute 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?: SubnetRouteState, opts?: CustomResourceOptions): SubnetRoute
@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,
subnet_id: Optional[str] = None) -> SubnetRoute
func GetSubnetRoute(ctx *Context, name string, id IDInput, state *SubnetRouteState, opts ...ResourceOption) (*SubnetRoute, error)
public static SubnetRoute Get(string name, Input<string> id, SubnetRouteState? state, CustomResourceOptions? opts = null)
public static SubnetRoute get(String name, Output<String> id, SubnetRouteState 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.
- Destination
Cidr string - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- Next
Hop 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry. - Subnet
Id string - ID of the subnet this routing entry belongs to. Changing this creates a new routing entry.
- Destination
Cidr string - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- Next
Hop 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry. - Subnet
Id string - ID of the subnet this routing entry belongs to. Changing this creates a new routing entry.
- destination
Cidr String - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- next
Hop 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry. - subnet
Id String - ID of the subnet this routing entry belongs to. Changing this creates a new routing entry.
- destination
Cidr string - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- next
Hop 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry. - subnet
Id string - ID of the subnet 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry. - subnet_
id str - ID of the subnet this routing entry belongs to. Changing this creates a new routing entry.
- destination
Cidr String - CIDR block to match on the packet’s destination IP. Changing this creates a new routing entry.
- next
Hop 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 subnet. If omitted, the
region
argument of the provider is used. Changing this creates a new routing entry. - subnet
Id String - ID of the subnet 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: <subnet_id>-route-<destination_cidr>-<next_hop>
$ pulumi import openstack:networking/subnetRoute:SubnetRoute subnet_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.