1. Packages
  2. Openstack Provider
  3. API Docs
  4. networking
  5. RouterInterface
OpenStack v5.0.0 published on Friday, Sep 27, 2024 by Pulumi

openstack.networking.RouterInterface

Explore with Pulumi AI

openstack logo
OpenStack v5.0.0 published on Friday, Sep 27, 2024 by Pulumi

    Manages a V2 router interface resource within OpenStack.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const network1 = new openstack.networking.Network("network_1", {
        name: "tf_test_network",
        adminStateUp: true,
    });
    const subnet1 = new openstack.networking.Subnet("subnet_1", {
        networkId: network1.id,
        cidr: "192.168.199.0/24",
        ipVersion: 4,
    });
    const router1 = new openstack.networking.Router("router_1", {
        name: "my_router",
        externalNetworkId: "f67f0d72-0ddf-11e4-9d95-e1f29f417e2f",
    });
    const routerInterface1 = new openstack.networking.RouterInterface("router_interface_1", {
        routerId: router1.id,
        subnetId: subnet1.id,
    });
    
    import pulumi
    import pulumi_openstack as openstack
    
    network1 = openstack.networking.Network("network_1",
        name="tf_test_network",
        admin_state_up=True)
    subnet1 = openstack.networking.Subnet("subnet_1",
        network_id=network1.id,
        cidr="192.168.199.0/24",
        ip_version=4)
    router1 = openstack.networking.Router("router_1",
        name="my_router",
        external_network_id="f67f0d72-0ddf-11e4-9d95-e1f29f417e2f")
    router_interface1 = openstack.networking.RouterInterface("router_interface_1",
        router_id=router1.id,
        subnet_id=subnet1.id)
    
    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 {
    		network1, err := networking.NewNetwork(ctx, "network_1", &networking.NetworkArgs{
    			Name:         pulumi.String("tf_test_network"),
    			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
    		}
    		router1, err := networking.NewRouter(ctx, "router_1", &networking.RouterArgs{
    			Name:              pulumi.String("my_router"),
    			ExternalNetworkId: pulumi.String("f67f0d72-0ddf-11e4-9d95-e1f29f417e2f"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = networking.NewRouterInterface(ctx, "router_interface_1", &networking.RouterInterfaceArgs{
    			RouterId: router1.ID(),
    			SubnetId: subnet1.ID(),
    		})
    		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 network1 = new OpenStack.Networking.Network("network_1", new()
        {
            Name = "tf_test_network",
            AdminStateUp = true,
        });
    
        var subnet1 = new OpenStack.Networking.Subnet("subnet_1", new()
        {
            NetworkId = network1.Id,
            Cidr = "192.168.199.0/24",
            IpVersion = 4,
        });
    
        var router1 = new OpenStack.Networking.Router("router_1", new()
        {
            Name = "my_router",
            ExternalNetworkId = "f67f0d72-0ddf-11e4-9d95-e1f29f417e2f",
        });
    
        var routerInterface1 = new OpenStack.Networking.RouterInterface("router_interface_1", new()
        {
            RouterId = router1.Id,
            SubnetId = subnet1.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    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.Router;
    import com.pulumi.openstack.networking.RouterArgs;
    import com.pulumi.openstack.networking.RouterInterface;
    import com.pulumi.openstack.networking.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) {
            var network1 = new Network("network1", NetworkArgs.builder()
                .name("tf_test_network")
                .adminStateUp("true")
                .build());
    
            var subnet1 = new Subnet("subnet1", SubnetArgs.builder()
                .networkId(network1.id())
                .cidr("192.168.199.0/24")
                .ipVersion(4)
                .build());
    
            var router1 = new Router("router1", RouterArgs.builder()
                .name("my_router")
                .externalNetworkId("f67f0d72-0ddf-11e4-9d95-e1f29f417e2f")
                .build());
    
            var routerInterface1 = new RouterInterface("routerInterface1", RouterInterfaceArgs.builder()
                .routerId(router1.id())
                .subnetId(subnet1.id())
                .build());
    
        }
    }
    
    resources:
      network1:
        type: openstack:networking:Network
        name: network_1
        properties:
          name: tf_test_network
          adminStateUp: 'true'
      subnet1:
        type: openstack:networking:Subnet
        name: subnet_1
        properties:
          networkId: ${network1.id}
          cidr: 192.168.199.0/24
          ipVersion: 4
      router1:
        type: openstack:networking:Router
        name: router_1
        properties:
          name: my_router
          externalNetworkId: f67f0d72-0ddf-11e4-9d95-e1f29f417e2f
      routerInterface1:
        type: openstack:networking:RouterInterface
        name: router_interface_1
        properties:
          routerId: ${router1.id}
          subnetId: ${subnet1.id}
    

    Create RouterInterface Resource

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

    Constructor syntax

    new RouterInterface(name: string, args: RouterInterfaceArgs, opts?: CustomResourceOptions);
    @overload
    def RouterInterface(resource_name: str,
                        args: RouterInterfaceArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def RouterInterface(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        router_id: Optional[str] = None,
                        force_destroy: Optional[bool] = None,
                        port_id: Optional[str] = None,
                        region: Optional[str] = None,
                        subnet_id: Optional[str] = None)
    func NewRouterInterface(ctx *Context, name string, args RouterInterfaceArgs, opts ...ResourceOption) (*RouterInterface, error)
    public RouterInterface(string name, RouterInterfaceArgs args, CustomResourceOptions? opts = null)
    public RouterInterface(String name, RouterInterfaceArgs args)
    public RouterInterface(String name, RouterInterfaceArgs args, CustomResourceOptions options)
    
    type: openstack:networking:RouterInterface
    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 RouterInterfaceArgs
    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 RouterInterfaceArgs
    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 RouterInterfaceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouterInterfaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouterInterfaceArgs
    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 routerInterfaceResource = new OpenStack.Networking.RouterInterface("routerInterfaceResource", new()
    {
        RouterId = "string",
        ForceDestroy = false,
        PortId = "string",
        Region = "string",
        SubnetId = "string",
    });
    
    example, err := networking.NewRouterInterface(ctx, "routerInterfaceResource", &networking.RouterInterfaceArgs{
    	RouterId:     pulumi.String("string"),
    	ForceDestroy: pulumi.Bool(false),
    	PortId:       pulumi.String("string"),
    	Region:       pulumi.String("string"),
    	SubnetId:     pulumi.String("string"),
    })
    
    var routerInterfaceResource = new RouterInterface("routerInterfaceResource", RouterInterfaceArgs.builder()
        .routerId("string")
        .forceDestroy(false)
        .portId("string")
        .region("string")
        .subnetId("string")
        .build());
    
    router_interface_resource = openstack.networking.RouterInterface("routerInterfaceResource",
        router_id="string",
        force_destroy=False,
        port_id="string",
        region="string",
        subnet_id="string")
    
    const routerInterfaceResource = new openstack.networking.RouterInterface("routerInterfaceResource", {
        routerId: "string",
        forceDestroy: false,
        portId: "string",
        region: "string",
        subnetId: "string",
    });
    
    type: openstack:networking:RouterInterface
    properties:
        forceDestroy: false
        portId: string
        region: string
        routerId: string
        subnetId: string
    

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

    RouterId string
    ID of the router this interface belongs to. Changing this creates a new router interface.
    ForceDestroy bool
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    PortId string
    ID of the port this interface connects to. Changing this creates a new router interface.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    SubnetId string
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    RouterId string
    ID of the router this interface belongs to. Changing this creates a new router interface.
    ForceDestroy bool
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    PortId string
    ID of the port this interface connects to. Changing this creates a new router interface.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    SubnetId string
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    routerId String
    ID of the router this interface belongs to. Changing this creates a new router interface.
    forceDestroy Boolean
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    portId String
    ID of the port this interface connects to. Changing this creates a new router interface.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    subnetId String
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    routerId string
    ID of the router this interface belongs to. Changing this creates a new router interface.
    forceDestroy boolean
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    portId string
    ID of the port this interface connects to. Changing this creates a new router interface.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    subnetId string
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    router_id str
    ID of the router this interface belongs to. Changing this creates a new router interface.
    force_destroy bool
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    port_id str
    ID of the port this interface connects to. Changing this creates a new router interface.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    subnet_id str
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    routerId String
    ID of the router this interface belongs to. Changing this creates a new router interface.
    forceDestroy Boolean
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    portId String
    ID of the port this interface connects to. Changing this creates a new router interface.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    subnetId String
    ID of the subnet this interface connects to. Changing this creates a new router interface.

    Outputs

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

    Get an existing RouterInterface 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?: RouterInterfaceState, opts?: CustomResourceOptions): RouterInterface
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            force_destroy: Optional[bool] = None,
            port_id: Optional[str] = None,
            region: Optional[str] = None,
            router_id: Optional[str] = None,
            subnet_id: Optional[str] = None) -> RouterInterface
    func GetRouterInterface(ctx *Context, name string, id IDInput, state *RouterInterfaceState, opts ...ResourceOption) (*RouterInterface, error)
    public static RouterInterface Get(string name, Input<string> id, RouterInterfaceState? state, CustomResourceOptions? opts = null)
    public static RouterInterface get(String name, Output<String> id, RouterInterfaceState 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:
    ForceDestroy bool
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    PortId string
    ID of the port this interface connects to. Changing this creates a new router interface.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    RouterId string
    ID of the router this interface belongs to. Changing this creates a new router interface.
    SubnetId string
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    ForceDestroy bool
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    PortId string
    ID of the port this interface connects to. Changing this creates a new router interface.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    RouterId string
    ID of the router this interface belongs to. Changing this creates a new router interface.
    SubnetId string
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    forceDestroy Boolean
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    portId String
    ID of the port this interface connects to. Changing this creates a new router interface.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    routerId String
    ID of the router this interface belongs to. Changing this creates a new router interface.
    subnetId String
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    forceDestroy boolean
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    portId string
    ID of the port this interface connects to. Changing this creates a new router interface.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    routerId string
    ID of the router this interface belongs to. Changing this creates a new router interface.
    subnetId string
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    force_destroy bool
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    port_id str
    ID of the port this interface connects to. Changing this creates a new router interface.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    router_id str
    ID of the router this interface belongs to. Changing this creates a new router interface.
    subnet_id str
    ID of the subnet this interface connects to. Changing this creates a new router interface.
    forceDestroy Boolean
    A boolean indicating whether the routes from the corresponding router ID should be deleted so that the router interface can be destroyed without any errors. The default value is false.
    portId String
    ID of the port this interface connects to. Changing this creates a new router interface.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to create a router. If omitted, the region argument of the provider is used. Changing this creates a new router interface.
    routerId String
    ID of the router this interface belongs to. Changing this creates a new router interface.
    subnetId String
    ID of the subnet this interface connects to. Changing this creates a new router interface.

    Import

    Router Interfaces can be imported using the port id, e.g.

    $ openstack port list –router

    $ pulumi import openstack:networking/routerInterface:RouterInterface int_1 port_id
    

    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.0.0 published on Friday, Sep 27, 2024 by Pulumi