1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. vpn
  5. PbrRouteEntry
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

alicloud.vpn.PbrRouteEntry

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

    Provides a VPN Pbr Route Entry resource.

    NOTE: Available since v1.162.0+.

    For information about VPN Pbr Route Entry and how to use it, see What is VPN Pbr Route Entry.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tfacc";
    const defaultGateways = alicloud.vpn.getGateways({});
    const defaultCustomerGateway = new alicloud.vpn.CustomerGateway("defaultCustomerGateway", {ipAddress: "192.168.1.1"});
    const defaultConnection = new alicloud.vpn.Connection("defaultConnection", {
        customerGatewayId: defaultCustomerGateway.id,
        vpnGatewayId: defaultGateways.then(defaultGateways => defaultGateways.ids?.[0]),
        localSubnets: ["192.168.2.0/24"],
        remoteSubnets: ["192.168.3.0/24"],
    });
    const defaultPbrRouteEntry = new alicloud.vpn.PbrRouteEntry("defaultPbrRouteEntry", {
        vpnGatewayId: defaultGateways.then(defaultGateways => defaultGateways.ids?.[0]),
        routeSource: "192.168.1.0/24",
        routeDest: "10.0.0.0/24",
        nextHop: defaultConnection.id,
        weight: 0,
        publishVpc: false,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tfacc"
    default_gateways = alicloud.vpn.get_gateways()
    default_customer_gateway = alicloud.vpn.CustomerGateway("defaultCustomerGateway", ip_address="192.168.1.1")
    default_connection = alicloud.vpn.Connection("defaultConnection",
        customer_gateway_id=default_customer_gateway.id,
        vpn_gateway_id=default_gateways.ids[0],
        local_subnets=["192.168.2.0/24"],
        remote_subnets=["192.168.3.0/24"])
    default_pbr_route_entry = alicloud.vpn.PbrRouteEntry("defaultPbrRouteEntry",
        vpn_gateway_id=default_gateways.ids[0],
        route_source="192.168.1.0/24",
        route_dest="10.0.0.0/24",
        next_hop=default_connection.id,
        weight=0,
        publish_vpc=False)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpn"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tfacc"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultGateways, err := vpn.GetGateways(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultCustomerGateway, err := vpn.NewCustomerGateway(ctx, "defaultCustomerGateway", &vpn.CustomerGatewayArgs{
    			IpAddress: pulumi.String("192.168.1.1"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultConnection, err := vpn.NewConnection(ctx, "defaultConnection", &vpn.ConnectionArgs{
    			CustomerGatewayId: defaultCustomerGateway.ID(),
    			VpnGatewayId:      pulumi.String(defaultGateways.Ids[0]),
    			LocalSubnets: pulumi.StringArray{
    				pulumi.String("192.168.2.0/24"),
    			},
    			RemoteSubnets: pulumi.StringArray{
    				pulumi.String("192.168.3.0/24"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vpn.NewPbrRouteEntry(ctx, "defaultPbrRouteEntry", &vpn.PbrRouteEntryArgs{
    			VpnGatewayId: pulumi.String(defaultGateways.Ids[0]),
    			RouteSource:  pulumi.String("192.168.1.0/24"),
    			RouteDest:    pulumi.String("10.0.0.0/24"),
    			NextHop:      defaultConnection.ID(),
    			Weight:       pulumi.Int(0),
    			PublishVpc:   pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tfacc";
        var defaultGateways = AliCloud.Vpn.GetGateways.Invoke();
    
        var defaultCustomerGateway = new AliCloud.Vpn.CustomerGateway("defaultCustomerGateway", new()
        {
            IpAddress = "192.168.1.1",
        });
    
        var defaultConnection = new AliCloud.Vpn.Connection("defaultConnection", new()
        {
            CustomerGatewayId = defaultCustomerGateway.Id,
            VpnGatewayId = defaultGateways.Apply(getGatewaysResult => getGatewaysResult.Ids[0]),
            LocalSubnets = new[]
            {
                "192.168.2.0/24",
            },
            RemoteSubnets = new[]
            {
                "192.168.3.0/24",
            },
        });
    
        var defaultPbrRouteEntry = new AliCloud.Vpn.PbrRouteEntry("defaultPbrRouteEntry", new()
        {
            VpnGatewayId = defaultGateways.Apply(getGatewaysResult => getGatewaysResult.Ids[0]),
            RouteSource = "192.168.1.0/24",
            RouteDest = "10.0.0.0/24",
            NextHop = defaultConnection.Id,
            Weight = 0,
            PublishVpc = false,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpn.VpnFunctions;
    import com.pulumi.alicloud.vpn.inputs.GetGatewaysArgs;
    import com.pulumi.alicloud.vpn.CustomerGateway;
    import com.pulumi.alicloud.vpn.CustomerGatewayArgs;
    import com.pulumi.alicloud.vpn.Connection;
    import com.pulumi.alicloud.vpn.ConnectionArgs;
    import com.pulumi.alicloud.vpn.PbrRouteEntry;
    import com.pulumi.alicloud.vpn.PbrRouteEntryArgs;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tfacc");
            final var defaultGateways = VpnFunctions.getGateways();
    
            var defaultCustomerGateway = new CustomerGateway("defaultCustomerGateway", CustomerGatewayArgs.builder()        
                .ipAddress("192.168.1.1")
                .build());
    
            var defaultConnection = new Connection("defaultConnection", ConnectionArgs.builder()        
                .customerGatewayId(defaultCustomerGateway.id())
                .vpnGatewayId(defaultGateways.applyValue(getGatewaysResult -> getGatewaysResult.ids()[0]))
                .localSubnets("192.168.2.0/24")
                .remoteSubnets("192.168.3.0/24")
                .build());
    
            var defaultPbrRouteEntry = new PbrRouteEntry("defaultPbrRouteEntry", PbrRouteEntryArgs.builder()        
                .vpnGatewayId(defaultGateways.applyValue(getGatewaysResult -> getGatewaysResult.ids()[0]))
                .routeSource("192.168.1.0/24")
                .routeDest("10.0.0.0/24")
                .nextHop(defaultConnection.id())
                .weight(0)
                .publishVpc(false)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tfacc
    resources:
      defaultCustomerGateway:
        type: alicloud:vpn:CustomerGateway
        properties:
          ipAddress: 192.168.1.1
      defaultConnection:
        type: alicloud:vpn:Connection
        properties:
          customerGatewayId: ${defaultCustomerGateway.id}
          vpnGatewayId: ${defaultGateways.ids[0]}
          localSubnets:
            - 192.168.2.0/24
          remoteSubnets:
            - 192.168.3.0/24
      defaultPbrRouteEntry:
        type: alicloud:vpn:PbrRouteEntry
        properties:
          vpnGatewayId: ${defaultGateways.ids[0]}
          routeSource: 192.168.1.0/24
          routeDest: 10.0.0.0/24
          nextHop: ${defaultConnection.id}
          weight: 0
          publishVpc: false
    variables:
      defaultGateways:
        fn::invoke:
          Function: alicloud:vpn:getGateways
          Arguments: {}
    

    Create PbrRouteEntry Resource

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

    Constructor syntax

    new PbrRouteEntry(name: string, args: PbrRouteEntryArgs, opts?: CustomResourceOptions);
    @overload
    def PbrRouteEntry(resource_name: str,
                      args: PbrRouteEntryArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def PbrRouteEntry(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      next_hop: Optional[str] = None,
                      publish_vpc: Optional[bool] = None,
                      route_dest: Optional[str] = None,
                      route_source: Optional[str] = None,
                      vpn_gateway_id: Optional[str] = None,
                      weight: Optional[int] = None)
    func NewPbrRouteEntry(ctx *Context, name string, args PbrRouteEntryArgs, opts ...ResourceOption) (*PbrRouteEntry, error)
    public PbrRouteEntry(string name, PbrRouteEntryArgs args, CustomResourceOptions? opts = null)
    public PbrRouteEntry(String name, PbrRouteEntryArgs args)
    public PbrRouteEntry(String name, PbrRouteEntryArgs args, CustomResourceOptions options)
    
    type: alicloud:vpn:PbrRouteEntry
    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 PbrRouteEntryArgs
    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 PbrRouteEntryArgs
    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 PbrRouteEntryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PbrRouteEntryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PbrRouteEntryArgs
    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 pbrRouteEntryResource = new AliCloud.Vpn.PbrRouteEntry("pbrRouteEntryResource", new()
    {
        NextHop = "string",
        PublishVpc = false,
        RouteDest = "string",
        RouteSource = "string",
        VpnGatewayId = "string",
        Weight = 0,
    });
    
    example, err := vpn.NewPbrRouteEntry(ctx, "pbrRouteEntryResource", &vpn.PbrRouteEntryArgs{
    	NextHop:      pulumi.String("string"),
    	PublishVpc:   pulumi.Bool(false),
    	RouteDest:    pulumi.String("string"),
    	RouteSource:  pulumi.String("string"),
    	VpnGatewayId: pulumi.String("string"),
    	Weight:       pulumi.Int(0),
    })
    
    var pbrRouteEntryResource = new PbrRouteEntry("pbrRouteEntryResource", PbrRouteEntryArgs.builder()        
        .nextHop("string")
        .publishVpc(false)
        .routeDest("string")
        .routeSource("string")
        .vpnGatewayId("string")
        .weight(0)
        .build());
    
    pbr_route_entry_resource = alicloud.vpn.PbrRouteEntry("pbrRouteEntryResource",
        next_hop="string",
        publish_vpc=False,
        route_dest="string",
        route_source="string",
        vpn_gateway_id="string",
        weight=0)
    
    const pbrRouteEntryResource = new alicloud.vpn.PbrRouteEntry("pbrRouteEntryResource", {
        nextHop: "string",
        publishVpc: false,
        routeDest: "string",
        routeSource: "string",
        vpnGatewayId: "string",
        weight: 0,
    });
    
    type: alicloud:vpn:PbrRouteEntry
    properties:
        nextHop: string
        publishVpc: false
        routeDest: string
        routeSource: string
        vpnGatewayId: string
        weight: 0
    

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

    NextHop string
    The next hop of the policy-based route.
    PublishVpc bool
    Whether to issue the destination route to the VPC.
    RouteDest string
    The destination CIDR block of the policy-based route.
    RouteSource string
    The source CIDR block of the policy-based route.
    VpnGatewayId string
    The ID of the vpn gateway.
    Weight int
    The weight of the policy-based route. Valid values: 0 and 100.
    NextHop string
    The next hop of the policy-based route.
    PublishVpc bool
    Whether to issue the destination route to the VPC.
    RouteDest string
    The destination CIDR block of the policy-based route.
    RouteSource string
    The source CIDR block of the policy-based route.
    VpnGatewayId string
    The ID of the vpn gateway.
    Weight int
    The weight of the policy-based route. Valid values: 0 and 100.
    nextHop String
    The next hop of the policy-based route.
    publishVpc Boolean
    Whether to issue the destination route to the VPC.
    routeDest String
    The destination CIDR block of the policy-based route.
    routeSource String
    The source CIDR block of the policy-based route.
    vpnGatewayId String
    The ID of the vpn gateway.
    weight Integer
    The weight of the policy-based route. Valid values: 0 and 100.
    nextHop string
    The next hop of the policy-based route.
    publishVpc boolean
    Whether to issue the destination route to the VPC.
    routeDest string
    The destination CIDR block of the policy-based route.
    routeSource string
    The source CIDR block of the policy-based route.
    vpnGatewayId string
    The ID of the vpn gateway.
    weight number
    The weight of the policy-based route. Valid values: 0 and 100.
    next_hop str
    The next hop of the policy-based route.
    publish_vpc bool
    Whether to issue the destination route to the VPC.
    route_dest str
    The destination CIDR block of the policy-based route.
    route_source str
    The source CIDR block of the policy-based route.
    vpn_gateway_id str
    The ID of the vpn gateway.
    weight int
    The weight of the policy-based route. Valid values: 0 and 100.
    nextHop String
    The next hop of the policy-based route.
    publishVpc Boolean
    Whether to issue the destination route to the VPC.
    routeDest String
    The destination CIDR block of the policy-based route.
    routeSource String
    The source CIDR block of the policy-based route.
    vpnGatewayId String
    The ID of the vpn gateway.
    weight Number
    The weight of the policy-based route. Valid values: 0 and 100.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PbrRouteEntry resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the vpn pbr route entry.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the vpn pbr route entry.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the vpn pbr route entry.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the vpn pbr route entry.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the vpn pbr route entry.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the vpn pbr route entry.

    Look up Existing PbrRouteEntry Resource

    Get an existing PbrRouteEntry 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?: PbrRouteEntryState, opts?: CustomResourceOptions): PbrRouteEntry
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            next_hop: Optional[str] = None,
            publish_vpc: Optional[bool] = None,
            route_dest: Optional[str] = None,
            route_source: Optional[str] = None,
            status: Optional[str] = None,
            vpn_gateway_id: Optional[str] = None,
            weight: Optional[int] = None) -> PbrRouteEntry
    func GetPbrRouteEntry(ctx *Context, name string, id IDInput, state *PbrRouteEntryState, opts ...ResourceOption) (*PbrRouteEntry, error)
    public static PbrRouteEntry Get(string name, Input<string> id, PbrRouteEntryState? state, CustomResourceOptions? opts = null)
    public static PbrRouteEntry get(String name, Output<String> id, PbrRouteEntryState 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:
    NextHop string
    The next hop of the policy-based route.
    PublishVpc bool
    Whether to issue the destination route to the VPC.
    RouteDest string
    The destination CIDR block of the policy-based route.
    RouteSource string
    The source CIDR block of the policy-based route.
    Status string
    The status of the vpn pbr route entry.
    VpnGatewayId string
    The ID of the vpn gateway.
    Weight int
    The weight of the policy-based route. Valid values: 0 and 100.
    NextHop string
    The next hop of the policy-based route.
    PublishVpc bool
    Whether to issue the destination route to the VPC.
    RouteDest string
    The destination CIDR block of the policy-based route.
    RouteSource string
    The source CIDR block of the policy-based route.
    Status string
    The status of the vpn pbr route entry.
    VpnGatewayId string
    The ID of the vpn gateway.
    Weight int
    The weight of the policy-based route. Valid values: 0 and 100.
    nextHop String
    The next hop of the policy-based route.
    publishVpc Boolean
    Whether to issue the destination route to the VPC.
    routeDest String
    The destination CIDR block of the policy-based route.
    routeSource String
    The source CIDR block of the policy-based route.
    status String
    The status of the vpn pbr route entry.
    vpnGatewayId String
    The ID of the vpn gateway.
    weight Integer
    The weight of the policy-based route. Valid values: 0 and 100.
    nextHop string
    The next hop of the policy-based route.
    publishVpc boolean
    Whether to issue the destination route to the VPC.
    routeDest string
    The destination CIDR block of the policy-based route.
    routeSource string
    The source CIDR block of the policy-based route.
    status string
    The status of the vpn pbr route entry.
    vpnGatewayId string
    The ID of the vpn gateway.
    weight number
    The weight of the policy-based route. Valid values: 0 and 100.
    next_hop str
    The next hop of the policy-based route.
    publish_vpc bool
    Whether to issue the destination route to the VPC.
    route_dest str
    The destination CIDR block of the policy-based route.
    route_source str
    The source CIDR block of the policy-based route.
    status str
    The status of the vpn pbr route entry.
    vpn_gateway_id str
    The ID of the vpn gateway.
    weight int
    The weight of the policy-based route. Valid values: 0 and 100.
    nextHop String
    The next hop of the policy-based route.
    publishVpc Boolean
    Whether to issue the destination route to the VPC.
    routeDest String
    The destination CIDR block of the policy-based route.
    routeSource String
    The source CIDR block of the policy-based route.
    status String
    The status of the vpn pbr route entry.
    vpnGatewayId String
    The ID of the vpn gateway.
    weight Number
    The weight of the policy-based route. Valid values: 0 and 100.

    Import

    VPN Pbr route entry can be imported using the id, e.g.

    $ pulumi import alicloud:vpn/pbrRouteEntry:PbrRouteEntry example <vpn_gateway_id>:<next_hop>:<route_source>:<route_dest>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi