alicloud.expressconnect.RouterTrAssociation
Explore with Pulumi AI
Provides a Express Connect Router Express Connect Router Tr Association resource. Leased line gateway and TR binding relationship object.
For information about Express Connect Router Express Connect Router Tr Association and how to use it, see What is Express Connect Router Tr 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 alowprefix1 = config.get("alowprefix1") || "10.0.0.0/24";
const allowprefix2 = config.get("allowprefix2") || "10.0.1.0/24";
const allowprefix3 = config.get("allowprefix3") || "10.0.2.0/24";
const allowprefix4 = config.get("allowprefix4") || "10.0.3.0/24";
const asn = config.get("asn") || "4200001003";
const defaultpX0KlC = new alicloud.expressconnect.RouterExpressConnectRouter("defaultpX0KlC", {alibabaSideAsn: asn});
const default418DC9 = new alicloud.cen.Instance("default418DC9", {cenInstanceName: name});
const defaultRYcjsc = new alicloud.cen.TransitRouter("defaultRYcjsc", {cenId: default418DC9.id});
const current = alicloud.getAccount({});
const _default = new alicloud.expressconnect.RouterTrAssociation("default", {
ecrId: defaultpX0KlC.id,
cenId: default418DC9.id,
transitRouterOwnerId: current.then(current => current.id),
allowedPrefixes: [
alowprefix1,
allowprefix3,
allowprefix2,
],
transitRouterId: defaultRYcjsc.transitRouterId,
associationRegionId: "cn-hangzhou",
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
alowprefix1 = config.get("alowprefix1")
if alowprefix1 is None:
alowprefix1 = "10.0.0.0/24"
allowprefix2 = config.get("allowprefix2")
if allowprefix2 is None:
allowprefix2 = "10.0.1.0/24"
allowprefix3 = config.get("allowprefix3")
if allowprefix3 is None:
allowprefix3 = "10.0.2.0/24"
allowprefix4 = config.get("allowprefix4")
if allowprefix4 is None:
allowprefix4 = "10.0.3.0/24"
asn = config.get("asn")
if asn is None:
asn = "4200001003"
defaultp_x0_kl_c = alicloud.expressconnect.RouterExpressConnectRouter("defaultpX0KlC", alibaba_side_asn=asn)
default418_dc9 = alicloud.cen.Instance("default418DC9", cen_instance_name=name)
default_r_ycjsc = alicloud.cen.TransitRouter("defaultRYcjsc", cen_id=default418_dc9.id)
current = alicloud.get_account()
default = alicloud.expressconnect.RouterTrAssociation("default",
ecr_id=defaultp_x0_kl_c.id,
cen_id=default418_dc9.id,
transit_router_owner_id=current.id,
allowed_prefixes=[
alowprefix1,
allowprefix3,
allowprefix2,
],
transit_router_id=default_r_ycjsc.transit_router_id,
association_region_id="cn-hangzhou")
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/expressconnect"
"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
}
alowprefix1 := "10.0.0.0/24"
if param := cfg.Get("alowprefix1"); param != "" {
alowprefix1 = param
}
allowprefix2 := "10.0.1.0/24"
if param := cfg.Get("allowprefix2"); param != "" {
allowprefix2 = param
}
allowprefix3 := "10.0.2.0/24"
if param := cfg.Get("allowprefix3"); param != "" {
allowprefix3 = param
}
allowprefix4 := "10.0.3.0/24"
if param := cfg.Get("allowprefix4"); param != "" {
allowprefix4 = param
}
asn := "4200001003"
if param := cfg.Get("asn"); param != "" {
asn = param
}
defaultpX0KlC, err := expressconnect.NewRouterExpressConnectRouter(ctx, "defaultpX0KlC", &expressconnect.RouterExpressConnectRouterArgs{
AlibabaSideAsn: pulumi.String(asn),
})
if err != nil {
return err
}
default418DC9, err := cen.NewInstance(ctx, "default418DC9", &cen.InstanceArgs{
CenInstanceName: pulumi.String(name),
})
if err != nil {
return err
}
defaultRYcjsc, err := cen.NewTransitRouter(ctx, "defaultRYcjsc", &cen.TransitRouterArgs{
CenId: default418DC9.ID(),
})
if err != nil {
return err
}
current, err := alicloud.GetAccount(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
_, err = expressconnect.NewRouterTrAssociation(ctx, "default", &expressconnect.RouterTrAssociationArgs{
EcrId: defaultpX0KlC.ID(),
CenId: default418DC9.ID(),
TransitRouterOwnerId: pulumi.String(current.Id),
AllowedPrefixes: pulumi.StringArray{
pulumi.String(alowprefix1),
pulumi.String(allowprefix3),
pulumi.String(allowprefix2),
},
TransitRouterId: defaultRYcjsc.TransitRouterId,
AssociationRegionId: pulumi.String("cn-hangzhou"),
})
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 alowprefix1 = config.Get("alowprefix1") ?? "10.0.0.0/24";
var allowprefix2 = config.Get("allowprefix2") ?? "10.0.1.0/24";
var allowprefix3 = config.Get("allowprefix3") ?? "10.0.2.0/24";
var allowprefix4 = config.Get("allowprefix4") ?? "10.0.3.0/24";
var asn = config.Get("asn") ?? "4200001003";
var defaultpX0KlC = new AliCloud.ExpressConnect.RouterExpressConnectRouter("defaultpX0KlC", new()
{
AlibabaSideAsn = asn,
});
var default418DC9 = new AliCloud.Cen.Instance("default418DC9", new()
{
CenInstanceName = name,
});
var defaultRYcjsc = new AliCloud.Cen.TransitRouter("defaultRYcjsc", new()
{
CenId = default418DC9.Id,
});
var current = AliCloud.GetAccount.Invoke();
var @default = new AliCloud.ExpressConnect.RouterTrAssociation("default", new()
{
EcrId = defaultpX0KlC.Id,
CenId = default418DC9.Id,
TransitRouterOwnerId = current.Apply(getAccountResult => getAccountResult.Id),
AllowedPrefixes = new[]
{
alowprefix1,
allowprefix3,
allowprefix2,
},
TransitRouterId = defaultRYcjsc.TransitRouterId,
AssociationRegionId = "cn-hangzhou",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.expressconnect.RouterExpressConnectRouter;
import com.pulumi.alicloud.expressconnect.RouterExpressConnectRouterArgs;
import com.pulumi.alicloud.cen.Instance;
import com.pulumi.alicloud.cen.InstanceArgs;
import com.pulumi.alicloud.cen.TransitRouter;
import com.pulumi.alicloud.cen.TransitRouterArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.expressconnect.RouterTrAssociation;
import com.pulumi.alicloud.expressconnect.RouterTrAssociationArgs;
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");
final var alowprefix1 = config.get("alowprefix1").orElse("10.0.0.0/24");
final var allowprefix2 = config.get("allowprefix2").orElse("10.0.1.0/24");
final var allowprefix3 = config.get("allowprefix3").orElse("10.0.2.0/24");
final var allowprefix4 = config.get("allowprefix4").orElse("10.0.3.0/24");
final var asn = config.get("asn").orElse("4200001003");
var defaultpX0KlC = new RouterExpressConnectRouter("defaultpX0KlC", RouterExpressConnectRouterArgs.builder()
.alibabaSideAsn(asn)
.build());
var default418DC9 = new Instance("default418DC9", InstanceArgs.builder()
.cenInstanceName(name)
.build());
var defaultRYcjsc = new TransitRouter("defaultRYcjsc", TransitRouterArgs.builder()
.cenId(default418DC9.id())
.build());
final var current = AlicloudFunctions.getAccount();
var default_ = new RouterTrAssociation("default", RouterTrAssociationArgs.builder()
.ecrId(defaultpX0KlC.id())
.cenId(default418DC9.id())
.transitRouterOwnerId(current.applyValue(getAccountResult -> getAccountResult.id()))
.allowedPrefixes(
alowprefix1,
allowprefix3,
allowprefix2)
.transitRouterId(defaultRYcjsc.transitRouterId())
.associationRegionId("cn-hangzhou")
.build());
}
}
configuration:
name:
type: string
default: terraform-example
alowprefix1:
type: string
default: 10.0.0.0/24
allowprefix2:
type: string
default: 10.0.1.0/24
allowprefix3:
type: string
default: 10.0.2.0/24
allowprefix4:
type: string
default: 10.0.3.0/24
asn:
type: string
default: '4200001003'
resources:
defaultpX0KlC:
type: alicloud:expressconnect:RouterExpressConnectRouter
properties:
alibabaSideAsn: ${asn}
default418DC9:
type: alicloud:cen:Instance
properties:
cenInstanceName: ${name}
defaultRYcjsc:
type: alicloud:cen:TransitRouter
properties:
cenId: ${default418DC9.id}
default:
type: alicloud:expressconnect:RouterTrAssociation
properties:
ecrId: ${defaultpX0KlC.id}
cenId: ${default418DC9.id}
transitRouterOwnerId: ${current.id}
allowedPrefixes:
- ${alowprefix1}
- ${allowprefix3}
- ${allowprefix2}
transitRouterId: ${defaultRYcjsc.transitRouterId}
associationRegionId: cn-hangzhou
variables:
current:
fn::invoke:
Function: alicloud:getAccount
Arguments: {}
Create RouterTrAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RouterTrAssociation(name: string, args: RouterTrAssociationArgs, opts?: CustomResourceOptions);
@overload
def RouterTrAssociation(resource_name: str,
args: RouterTrAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RouterTrAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
association_region_id: Optional[str] = None,
ecr_id: Optional[str] = None,
allowed_prefixes: Optional[Sequence[str]] = None,
cen_id: Optional[str] = None,
transit_router_id: Optional[str] = None,
transit_router_owner_id: Optional[int] = None)
func NewRouterTrAssociation(ctx *Context, name string, args RouterTrAssociationArgs, opts ...ResourceOption) (*RouterTrAssociation, error)
public RouterTrAssociation(string name, RouterTrAssociationArgs args, CustomResourceOptions? opts = null)
public RouterTrAssociation(String name, RouterTrAssociationArgs args)
public RouterTrAssociation(String name, RouterTrAssociationArgs args, CustomResourceOptions options)
type: alicloud:expressconnect:RouterTrAssociation
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 RouterTrAssociationArgs
- 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 RouterTrAssociationArgs
- 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 RouterTrAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouterTrAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouterTrAssociationArgs
- 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 routerTrAssociationResource = new AliCloud.ExpressConnect.RouterTrAssociation("routerTrAssociationResource", new()
{
AssociationRegionId = "string",
EcrId = "string",
AllowedPrefixes = new[]
{
"string",
},
CenId = "string",
TransitRouterId = "string",
TransitRouterOwnerId = 0,
});
example, err := expressconnect.NewRouterTrAssociation(ctx, "routerTrAssociationResource", &expressconnect.RouterTrAssociationArgs{
AssociationRegionId: pulumi.String("string"),
EcrId: pulumi.String("string"),
AllowedPrefixes: pulumi.StringArray{
pulumi.String("string"),
},
CenId: pulumi.String("string"),
TransitRouterId: pulumi.String("string"),
TransitRouterOwnerId: pulumi.Int(0),
})
var routerTrAssociationResource = new RouterTrAssociation("routerTrAssociationResource", RouterTrAssociationArgs.builder()
.associationRegionId("string")
.ecrId("string")
.allowedPrefixes("string")
.cenId("string")
.transitRouterId("string")
.transitRouterOwnerId(0)
.build());
router_tr_association_resource = alicloud.expressconnect.RouterTrAssociation("routerTrAssociationResource",
association_region_id="string",
ecr_id="string",
allowed_prefixes=["string"],
cen_id="string",
transit_router_id="string",
transit_router_owner_id=0)
const routerTrAssociationResource = new alicloud.expressconnect.RouterTrAssociation("routerTrAssociationResource", {
associationRegionId: "string",
ecrId: "string",
allowedPrefixes: ["string"],
cenId: "string",
transitRouterId: "string",
transitRouterOwnerId: 0,
});
type: alicloud:expressconnect:RouterTrAssociation
properties:
allowedPrefixes:
- string
associationRegionId: string
cenId: string
ecrId: string
transitRouterId: string
transitRouterOwnerId: 0
RouterTrAssociation 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 RouterTrAssociation resource accepts the following input properties:
- Association
Region stringId - The region to which the VPC or TR belongs.
- Ecr
Id string - The ID of the leased line gateway instance.
- Allowed
Prefixes List<string> - List of allowed route prefixes.
- Cen
Id string - The ID of the CEN instance.
- Transit
Router stringId - The ID of the forwarding router instance.
- Transit
Router intOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- Association
Region stringId - The region to which the VPC or TR belongs.
- Ecr
Id string - The ID of the leased line gateway instance.
- Allowed
Prefixes []string - List of allowed route prefixes.
- Cen
Id string - The ID of the CEN instance.
- Transit
Router stringId - The ID of the forwarding router instance.
- Transit
Router intOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- association
Region StringId - The region to which the VPC or TR belongs.
- ecr
Id String - The ID of the leased line gateway instance.
- allowed
Prefixes List<String> - List of allowed route prefixes.
- cen
Id String - The ID of the CEN instance.
- transit
Router StringId - The ID of the forwarding router instance.
- transit
Router IntegerOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- association
Region stringId - The region to which the VPC or TR belongs.
- ecr
Id string - The ID of the leased line gateway instance.
- allowed
Prefixes string[] - List of allowed route prefixes.
- cen
Id string - The ID of the CEN instance.
- transit
Router stringId - The ID of the forwarding router instance.
- transit
Router numberOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- association_
region_ strid - The region to which the VPC or TR belongs.
- ecr_
id str - The ID of the leased line gateway instance.
- allowed_
prefixes Sequence[str] - List of allowed route prefixes.
- cen_
id str - The ID of the CEN instance.
- transit_
router_ strid - The ID of the forwarding router instance.
- transit_
router_ intowner_ id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- association
Region StringId - The region to which the VPC or TR belongs.
- ecr
Id String - The ID of the leased line gateway instance.
- allowed
Prefixes List<String> - List of allowed route prefixes.
- cen
Id String - The ID of the CEN instance.
- transit
Router StringId - The ID of the forwarding router instance.
- transit
Router NumberOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
Outputs
All input properties are implicitly available as output properties. Additionally, the RouterTrAssociation resource produces the following output properties:
- Association
Id string - The first ID of the resource.
- Create
Time 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 string - The first ID of the resource.
- Create
Time 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 String - The first ID of the resource.
- create
Time 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 string - The first ID of the resource.
- create
Time 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.
- association
Id String - The first ID of the resource.
- create
Time 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 RouterTrAssociation Resource
Get an existing RouterTrAssociation 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?: RouterTrAssociationState, opts?: CustomResourceOptions): RouterTrAssociation
@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,
cen_id: Optional[str] = None,
create_time: Optional[str] = None,
ecr_id: Optional[str] = None,
status: Optional[str] = None,
transit_router_id: Optional[str] = None,
transit_router_owner_id: Optional[int] = None) -> RouterTrAssociation
func GetRouterTrAssociation(ctx *Context, name string, id IDInput, state *RouterTrAssociationState, opts ...ResourceOption) (*RouterTrAssociation, error)
public static RouterTrAssociation Get(string name, Input<string> id, RouterTrAssociationState? state, CustomResourceOptions? opts = null)
public static RouterTrAssociation get(String name, Output<String> id, RouterTrAssociationState 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.
- Allowed
Prefixes List<string> - List of allowed route prefixes.
- Association
Id string - The first ID of the resource.
- Association
Region stringId - The region to which the VPC or TR belongs.
- Cen
Id string - The ID of the CEN instance.
- Create
Time string - The creation time of the resource.
- Ecr
Id string - The ID of the leased line gateway instance.
- Status string
- The status of the resource.
- Transit
Router stringId - The ID of the forwarding router instance.
- Transit
Router intOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- Allowed
Prefixes []string - List of allowed route prefixes.
- Association
Id string - The first ID of the resource.
- Association
Region stringId - The region to which the VPC or TR belongs.
- Cen
Id string - The ID of the CEN instance.
- Create
Time string - The creation time of the resource.
- Ecr
Id string - The ID of the leased line gateway instance.
- Status string
- The status of the resource.
- Transit
Router stringId - The ID of the forwarding router instance.
- Transit
Router intOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- allowed
Prefixes List<String> - List of allowed route prefixes.
- association
Id String - The first ID of the resource.
- association
Region StringId - The region to which the VPC or TR belongs.
- cen
Id String - The ID of the CEN instance.
- create
Time String - The creation time of the resource.
- ecr
Id String - The ID of the leased line gateway instance.
- status String
- The status of the resource.
- transit
Router StringId - The ID of the forwarding router instance.
- transit
Router IntegerOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- allowed
Prefixes string[] - List of allowed route prefixes.
- association
Id string - The first ID of the resource.
- association
Region stringId - The region to which the VPC or TR belongs.
- cen
Id string - The ID of the CEN instance.
- create
Time string - The creation time of the resource.
- ecr
Id string - The ID of the leased line gateway instance.
- status string
- The status of the resource.
- transit
Router stringId - The ID of the forwarding router instance.
- transit
Router numberOwner Id - The ID of the Alibaba Cloud account to which the forwarding router 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.
- cen_
id str - The ID of the CEN instance.
- 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.
- transit_
router_ strid - The ID of the forwarding router instance.
- transit_
router_ intowner_ id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
- allowed
Prefixes List<String> - List of allowed route prefixes.
- association
Id String - The first ID of the resource.
- association
Region StringId - The region to which the VPC or TR belongs.
- cen
Id String - The ID of the CEN instance.
- create
Time String - The creation time of the resource.
- ecr
Id String - The ID of the leased line gateway instance.
- status String
- The status of the resource.
- transit
Router StringId - The ID of the forwarding router instance.
- transit
Router NumberOwner Id - The ID of the Alibaba Cloud account to which the forwarding router belongs.
Import
Express Connect Router Express Connect Router Tr Association can be imported using the id, e.g.
$ pulumi import alicloud:expressconnect/routerTrAssociation:RouterTrAssociation example <ecr_id>:<association_id>:<transit_router_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
alicloud
Terraform Provider.