alicloud.expressconnect.RouterVpcAssociation
Explore with Pulumi AI
Provides a Express Connect Router Express Connect Router Vpc Association resource. Bind relationship object between leased line gateway and VPC.
For information about Express Connect Router Express Connect Router Vpc Association and how to use it, see What is Express Connect Router Vpc Association.
NOTE: Available since v1.224.0.
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") || "terraform-example";
const default8qAtD6 = new alicloud.vpc.Network("default8qAtD6", {cidrBlock: "172.16.0.0/16"});
const defaultM9YxGW = new alicloud.expressconnect.RouterExpressConnectRouter("defaultM9YxGW", {alibabaSideAsn: 65533});
const current = alicloud.getAccount({});
const _default = new alicloud.expressconnect.RouterVpcAssociation("default", {
    ecrId: defaultM9YxGW.id,
    allowedPrefixes: [
        "172.16.4.0/24",
        "172.16.3.0/24",
        "172.16.2.0/24",
        "172.16.1.0/24",
    ],
    vpcOwnerId: current.then(current => current.id),
    associationRegionId: "cn-hangzhou",
    vpcId: default8qAtD6.id,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
default8q_at_d6 = alicloud.vpc.Network("default8qAtD6", cidr_block="172.16.0.0/16")
default_m9_yx_gw = alicloud.expressconnect.RouterExpressConnectRouter("defaultM9YxGW", alibaba_side_asn=65533)
current = alicloud.get_account()
default = alicloud.expressconnect.RouterVpcAssociation("default",
    ecr_id=default_m9_yx_gw.id,
    allowed_prefixes=[
        "172.16.4.0/24",
        "172.16.3.0/24",
        "172.16.2.0/24",
        "172.16.1.0/24",
    ],
    vpc_owner_id=current.id,
    association_region_id="cn-hangzhou",
    vpc_id=default8q_at_d6.id)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/expressconnect"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"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 := "terraform-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		default8qAtD6, err := vpc.NewNetwork(ctx, "default8qAtD6", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		defaultM9YxGW, err := expressconnect.NewRouterExpressConnectRouter(ctx, "defaultM9YxGW", &expressconnect.RouterExpressConnectRouterArgs{
			AlibabaSideAsn: pulumi.Int(65533),
		})
		if err != nil {
			return err
		}
		current, err := alicloud.GetAccount(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		_, err = expressconnect.NewRouterVpcAssociation(ctx, "default", &expressconnect.RouterVpcAssociationArgs{
			EcrId: defaultM9YxGW.ID(),
			AllowedPrefixes: pulumi.StringArray{
				pulumi.String("172.16.4.0/24"),
				pulumi.String("172.16.3.0/24"),
				pulumi.String("172.16.2.0/24"),
				pulumi.String("172.16.1.0/24"),
			},
			VpcOwnerId:          pulumi.String(current.Id),
			AssociationRegionId: pulumi.String("cn-hangzhou"),
			VpcId:               default8qAtD6.ID(),
		})
		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") ?? "terraform-example";
    var default8qAtD6 = new AliCloud.Vpc.Network("default8qAtD6", new()
    {
        CidrBlock = "172.16.0.0/16",
    });
    var defaultM9YxGW = new AliCloud.ExpressConnect.RouterExpressConnectRouter("defaultM9YxGW", new()
    {
        AlibabaSideAsn = 65533,
    });
    var current = AliCloud.GetAccount.Invoke();
    var @default = new AliCloud.ExpressConnect.RouterVpcAssociation("default", new()
    {
        EcrId = defaultM9YxGW.Id,
        AllowedPrefixes = new[]
        {
            "172.16.4.0/24",
            "172.16.3.0/24",
            "172.16.2.0/24",
            "172.16.1.0/24",
        },
        VpcOwnerId = current.Apply(getAccountResult => getAccountResult.Id),
        AssociationRegionId = "cn-hangzhou",
        VpcId = default8qAtD6.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.expressconnect.RouterExpressConnectRouter;
import com.pulumi.alicloud.expressconnect.RouterExpressConnectRouterArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.expressconnect.RouterVpcAssociation;
import com.pulumi.alicloud.expressconnect.RouterVpcAssociationArgs;
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("terraform-example");
        var default8qAtD6 = new Network("default8qAtD6", NetworkArgs.builder()
            .cidrBlock("172.16.0.0/16")
            .build());
        var defaultM9YxGW = new RouterExpressConnectRouter("defaultM9YxGW", RouterExpressConnectRouterArgs.builder()
            .alibabaSideAsn("65533")
            .build());
        final var current = AlicloudFunctions.getAccount();
        var default_ = new RouterVpcAssociation("default", RouterVpcAssociationArgs.builder()
            .ecrId(defaultM9YxGW.id())
            .allowedPrefixes(            
                "172.16.4.0/24",
                "172.16.3.0/24",
                "172.16.2.0/24",
                "172.16.1.0/24")
            .vpcOwnerId(current.applyValue(getAccountResult -> getAccountResult.id()))
            .associationRegionId("cn-hangzhou")
            .vpcId(default8qAtD6.id())
            .build());
    }
}
configuration:
  name:
    type: string
    default: terraform-example
resources:
  default8qAtD6:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/16
  defaultM9YxGW:
    type: alicloud:expressconnect:RouterExpressConnectRouter
    properties:
      alibabaSideAsn: '65533'
  default:
    type: alicloud:expressconnect:RouterVpcAssociation
    properties:
      ecrId: ${defaultM9YxGW.id}
      allowedPrefixes:
        - 172.16.4.0/24
        - 172.16.3.0/24
        - 172.16.2.0/24
        - 172.16.1.0/24
      vpcOwnerId: ${current.id}
      associationRegionId: cn-hangzhou
      vpcId: ${default8qAtD6.id}
variables:
  current:
    fn::invoke:
      function: alicloud:getAccount
      arguments: {}
Create RouterVpcAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RouterVpcAssociation(name: string, args: RouterVpcAssociationArgs, opts?: CustomResourceOptions);@overload
def RouterVpcAssociation(resource_name: str,
                         args: RouterVpcAssociationArgs,
                         opts: Optional[ResourceOptions] = None)
@overload
def RouterVpcAssociation(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         association_region_id: Optional[str] = None,
                         ecr_id: Optional[str] = None,
                         vpc_id: Optional[str] = None,
                         allowed_prefixes: Optional[Sequence[str]] = None,
                         vpc_owner_id: Optional[int] = None)func NewRouterVpcAssociation(ctx *Context, name string, args RouterVpcAssociationArgs, opts ...ResourceOption) (*RouterVpcAssociation, error)public RouterVpcAssociation(string name, RouterVpcAssociationArgs args, CustomResourceOptions? opts = null)
public RouterVpcAssociation(String name, RouterVpcAssociationArgs args)
public RouterVpcAssociation(String name, RouterVpcAssociationArgs args, CustomResourceOptions options)
type: alicloud:expressconnect:RouterVpcAssociation
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 RouterVpcAssociationArgs
- 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 RouterVpcAssociationArgs
- 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 RouterVpcAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouterVpcAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouterVpcAssociationArgs
- 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 routerVpcAssociationResource = new AliCloud.ExpressConnect.RouterVpcAssociation("routerVpcAssociationResource", new()
{
    AssociationRegionId = "string",
    EcrId = "string",
    VpcId = "string",
    AllowedPrefixes = new[]
    {
        "string",
    },
    VpcOwnerId = 0,
});
example, err := expressconnect.NewRouterVpcAssociation(ctx, "routerVpcAssociationResource", &expressconnect.RouterVpcAssociationArgs{
	AssociationRegionId: pulumi.String("string"),
	EcrId:               pulumi.String("string"),
	VpcId:               pulumi.String("string"),
	AllowedPrefixes: pulumi.StringArray{
		pulumi.String("string"),
	},
	VpcOwnerId: pulumi.Int(0),
})
var routerVpcAssociationResource = new RouterVpcAssociation("routerVpcAssociationResource", RouterVpcAssociationArgs.builder()
    .associationRegionId("string")
    .ecrId("string")
    .vpcId("string")
    .allowedPrefixes("string")
    .vpcOwnerId(0)
    .build());
router_vpc_association_resource = alicloud.expressconnect.RouterVpcAssociation("routerVpcAssociationResource",
    association_region_id="string",
    ecr_id="string",
    vpc_id="string",
    allowed_prefixes=["string"],
    vpc_owner_id=0)
const routerVpcAssociationResource = new alicloud.expressconnect.RouterVpcAssociation("routerVpcAssociationResource", {
    associationRegionId: "string",
    ecrId: "string",
    vpcId: "string",
    allowedPrefixes: ["string"],
    vpcOwnerId: 0,
});
type: alicloud:expressconnect:RouterVpcAssociation
properties:
    allowedPrefixes:
        - string
    associationRegionId: string
    ecrId: string
    vpcId: string
    vpcOwnerId: 0
RouterVpcAssociation 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 RouterVpcAssociation resource accepts the following input properties:
- AssociationRegion stringId 
- The region to which the VPC or TR belongs.
- EcrId string
- The ID of the leased line gateway instance.
- VpcId string
- The ID of the VPC instance.
- AllowedPrefixes List<string>
- List of allowed route prefixes.
- VpcOwner intId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- AssociationRegion stringId 
- The region to which the VPC or TR belongs.
- EcrId string
- The ID of the leased line gateway instance.
- VpcId string
- The ID of the VPC instance.
- AllowedPrefixes []string
- List of allowed route prefixes.
- VpcOwner intId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- associationRegion StringId 
- The region to which the VPC or TR belongs.
- ecrId String
- The ID of the leased line gateway instance.
- vpcId String
- The ID of the VPC instance.
- allowedPrefixes List<String>
- List of allowed route prefixes.
- vpcOwner IntegerId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- associationRegion stringId 
- The region to which the VPC or TR belongs.
- ecrId string
- The ID of the leased line gateway instance.
- vpcId string
- The ID of the VPC instance.
- allowedPrefixes string[]
- List of allowed route prefixes.
- vpcOwner numberId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- association_region_ strid 
- The region to which the VPC or TR belongs.
- ecr_id str
- The ID of the leased line gateway instance.
- vpc_id str
- The ID of the VPC instance.
- allowed_prefixes Sequence[str]
- List of allowed route prefixes.
- vpc_owner_ intid 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- associationRegion StringId 
- The region to which the VPC or TR belongs.
- ecrId String
- The ID of the leased line gateway instance.
- vpcId String
- The ID of the VPC instance.
- allowedPrefixes List<String>
- List of allowed route prefixes.
- vpcOwner NumberId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
Outputs
All input properties are implicitly available as output properties. Additionally, the RouterVpcAssociation resource produces the following output properties:
- AssociationId string
- The first ID of the resource.
- CreateTime string
- The creation time of the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the resource.
- AssociationId string
- The first ID of the resource.
- CreateTime string
- The creation time of the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the resource.
- associationId String
- The first ID of the resource.
- createTime String
- The creation time of the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the resource.
- associationId string
- The first ID of the resource.
- createTime string
- The creation time of the resource.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of the resource.
- association_id str
- The first ID of the resource.
- create_time str
- The creation time of the resource.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of the resource.
- associationId String
- The first ID of the resource.
- createTime String
- The creation time of the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the resource.
Look up Existing RouterVpcAssociation Resource
Get an existing RouterVpcAssociation 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?: RouterVpcAssociationState, opts?: CustomResourceOptions): RouterVpcAssociation@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allowed_prefixes: Optional[Sequence[str]] = None,
        association_id: Optional[str] = None,
        association_region_id: Optional[str] = None,
        create_time: Optional[str] = None,
        ecr_id: Optional[str] = None,
        status: Optional[str] = None,
        vpc_id: Optional[str] = None,
        vpc_owner_id: Optional[int] = None) -> RouterVpcAssociationfunc GetRouterVpcAssociation(ctx *Context, name string, id IDInput, state *RouterVpcAssociationState, opts ...ResourceOption) (*RouterVpcAssociation, error)public static RouterVpcAssociation Get(string name, Input<string> id, RouterVpcAssociationState? state, CustomResourceOptions? opts = null)public static RouterVpcAssociation get(String name, Output<String> id, RouterVpcAssociationState state, CustomResourceOptions options)resources:  _:    type: alicloud:expressconnect:RouterVpcAssociation    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.
- AllowedPrefixes List<string>
- List of allowed route prefixes.
- AssociationId string
- The first ID of the resource.
- AssociationRegion stringId 
- The region to which the VPC or TR belongs.
- CreateTime string
- The creation time of the resource.
- EcrId string
- The ID of the leased line gateway instance.
- Status string
- The status of the resource.
- VpcId string
- The ID of the VPC instance.
- VpcOwner intId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- AllowedPrefixes []string
- List of allowed route prefixes.
- AssociationId string
- The first ID of the resource.
- AssociationRegion stringId 
- The region to which the VPC or TR belongs.
- CreateTime string
- The creation time of the resource.
- EcrId string
- The ID of the leased line gateway instance.
- Status string
- The status of the resource.
- VpcId string
- The ID of the VPC instance.
- VpcOwner intId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- allowedPrefixes List<String>
- List of allowed route prefixes.
- associationId String
- The first ID of the resource.
- associationRegion StringId 
- The region to which the VPC or TR belongs.
- createTime String
- The creation time of the resource.
- ecrId String
- The ID of the leased line gateway instance.
- status String
- The status of the resource.
- vpcId String
- The ID of the VPC instance.
- vpcOwner IntegerId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- allowedPrefixes string[]
- List of allowed route prefixes.
- associationId string
- The first ID of the resource.
- associationRegion stringId 
- The region to which the VPC or TR belongs.
- createTime string
- The creation time of the resource.
- ecrId string
- The ID of the leased line gateway instance.
- status string
- The status of the resource.
- vpcId string
- The ID of the VPC instance.
- vpcOwner numberId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- allowed_prefixes Sequence[str]
- List of allowed route prefixes.
- association_id str
- The first ID of the resource.
- association_region_ strid 
- The region to which the VPC or TR belongs.
- create_time str
- The creation time of the resource.
- ecr_id str
- The ID of the leased line gateway instance.
- status str
- The status of the resource.
- vpc_id str
- The ID of the VPC instance.
- vpc_owner_ intid 
- The ID of the Alibaba Cloud account to which the VPC belongs.
- allowedPrefixes List<String>
- List of allowed route prefixes.
- associationId String
- The first ID of the resource.
- associationRegion StringId 
- The region to which the VPC or TR belongs.
- createTime String
- The creation time of the resource.
- ecrId String
- The ID of the leased line gateway instance.
- status String
- The status of the resource.
- vpcId String
- The ID of the VPC instance.
- vpcOwner NumberId 
- The ID of the Alibaba Cloud account to which the VPC belongs.
Import
Express Connect Router Express Connect Router Vpc Association can be imported using the id, e.g.
$ pulumi import alicloud:expressconnect/routerVpcAssociation:RouterVpcAssociation example <ecr_id>:<association_id>:<vpc_id>
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 alicloudTerraform Provider.