Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi
alicloud.cen.getTransitRouterVpnAttachments
Start a Neo task
Explain and create an alicloud.cen.getTransitRouterVpnAttachments resource
This data source provides Cen Transit Router Vpn Attachment available to the user.What is Transit Router Vpn Attachment
NOTE: Available since v1.183.0.
Example 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 _default = alicloud.getAccount({});
const defaultInstance = new alicloud.cen.Instance("default", {cenInstanceName: name});
const defaultTransitRouter = new alicloud.cen.TransitRouter("default", {cenId: defaultInstance.id});
const defaultTransitRouterCidr = new alicloud.cen.TransitRouterCidr("default", {
cidr: "192.168.10.0/24",
transitRouterId: defaultTransitRouter.transitRouterId,
publishCidrRoute: true,
});
const defaultCustomerGateway = new alicloud.vpn.CustomerGateway("default", {
ipAddress: "1.1.1.8",
customerGatewayName: name,
}, {
dependsOn: [defaultTransitRouterCidr],
});
const defaultGatewayVpnAttachment = new alicloud.vpn.GatewayVpnAttachment("default", {
networkType: "public",
localSubnet: "0.0.0.0/0",
enableTunnelsBgp: false,
vpnAttachmentName: name,
tunnelOptionsSpecifications: [
{
customerGatewayId: defaultCustomerGateway.id,
enableDpd: true,
enableNatTraversal: true,
tunnelIndex: 1,
tunnelIkeConfig: {
remoteId: "2.2.2.2",
ikeEncAlg: "aes",
ikeMode: "main",
ikeVersion: "ikev1",
localId: "1.1.1.1",
ikeAuthAlg: "md5",
ikeLifetime: 86100,
ikePfs: "group2",
psk: "12345678",
},
tunnelIpsecConfig: {
ipsecAuthAlg: "md5",
ipsecEncAlg: "aes",
ipsecLifetime: 86200,
ipsecPfs: "group5",
},
},
{
enableNatTraversal: true,
tunnelIndex: 2,
tunnelIkeConfig: {
localId: "4.4.4.4",
remoteId: "5.5.5.5",
ikeLifetime: 86400,
ikePfs: "group5",
ikeMode: "main",
ikeVersion: "ikev2",
psk: "32333442",
ikeAuthAlg: "md5",
ikeEncAlg: "aes",
},
tunnelIpsecConfig: {
ipsecEncAlg: "aes",
ipsecLifetime: 86400,
ipsecPfs: "group5",
ipsecAuthAlg: "sha256",
},
customerGatewayId: defaultCustomerGateway.id,
enableDpd: true,
},
],
remoteSubnet: "0.0.0.0/0",
});
const defaultTransitRouterVpnAttachment = new alicloud.cen.TransitRouterVpnAttachment("default", {
autoPublishRouteEnabled: false,
transitRouterAttachmentDescription: name,
transitRouterAttachmentName: name,
cenId: defaultTransitRouter.cenId,
transitRouterId: defaultTransitRouter.transitRouterId,
vpnId: defaultGatewayVpnAttachment.id,
vpnOwnerId: _default.then(_default => _default.id),
chargeType: "POSTPAY",
tags: {
Created: "TF",
For: "VpnAttachment",
},
});
const ids = pulumi.all([defaultTransitRouterVpnAttachment.id, defaultTransitRouterVpnAttachment.cenId, defaultTransitRouterVpnAttachment.transitRouterId]).apply(([id, cenId, transitRouterId]) => alicloud.cen.getTransitRouterVpnAttachmentsOutput({
ids: [id],
cenId: cenId,
transitRouterId: transitRouterId,
}));
export const cenTransitRouterVpnAttachmentId0 = ids.apply(ids => ids.attachments?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.get_account()
default_instance = alicloud.cen.Instance("default", cen_instance_name=name)
default_transit_router = alicloud.cen.TransitRouter("default", cen_id=default_instance.id)
default_transit_router_cidr = alicloud.cen.TransitRouterCidr("default",
cidr="192.168.10.0/24",
transit_router_id=default_transit_router.transit_router_id,
publish_cidr_route=True)
default_customer_gateway = alicloud.vpn.CustomerGateway("default",
ip_address="1.1.1.8",
customer_gateway_name=name,
opts = pulumi.ResourceOptions(depends_on=[default_transit_router_cidr]))
default_gateway_vpn_attachment = alicloud.vpn.GatewayVpnAttachment("default",
network_type="public",
local_subnet="0.0.0.0/0",
enable_tunnels_bgp=False,
vpn_attachment_name=name,
tunnel_options_specifications=[
{
"customer_gateway_id": default_customer_gateway.id,
"enable_dpd": True,
"enable_nat_traversal": True,
"tunnel_index": 1,
"tunnel_ike_config": {
"remote_id": "2.2.2.2",
"ike_enc_alg": "aes",
"ike_mode": "main",
"ike_version": "ikev1",
"local_id": "1.1.1.1",
"ike_auth_alg": "md5",
"ike_lifetime": 86100,
"ike_pfs": "group2",
"psk": "12345678",
},
"tunnel_ipsec_config": {
"ipsec_auth_alg": "md5",
"ipsec_enc_alg": "aes",
"ipsec_lifetime": 86200,
"ipsec_pfs": "group5",
},
},
{
"enable_nat_traversal": True,
"tunnel_index": 2,
"tunnel_ike_config": {
"local_id": "4.4.4.4",
"remote_id": "5.5.5.5",
"ike_lifetime": 86400,
"ike_pfs": "group5",
"ike_mode": "main",
"ike_version": "ikev2",
"psk": "32333442",
"ike_auth_alg": "md5",
"ike_enc_alg": "aes",
},
"tunnel_ipsec_config": {
"ipsec_enc_alg": "aes",
"ipsec_lifetime": 86400,
"ipsec_pfs": "group5",
"ipsec_auth_alg": "sha256",
},
"customer_gateway_id": default_customer_gateway.id,
"enable_dpd": True,
},
],
remote_subnet="0.0.0.0/0")
default_transit_router_vpn_attachment = alicloud.cen.TransitRouterVpnAttachment("default",
auto_publish_route_enabled=False,
transit_router_attachment_description=name,
transit_router_attachment_name=name,
cen_id=default_transit_router.cen_id,
transit_router_id=default_transit_router.transit_router_id,
vpn_id=default_gateway_vpn_attachment.id,
vpn_owner_id=default.id,
charge_type="POSTPAY",
tags={
"Created": "TF",
"For": "VpnAttachment",
})
ids = pulumi.Output.all(
id=default_transit_router_vpn_attachment.id,
cen_id=default_transit_router_vpn_attachment.cen_id,
transit_router_id=default_transit_router_vpn_attachment.transit_router_id
).apply(lambda resolved_outputs: alicloud.cen.get_transit_router_vpn_attachments_output(ids=[resolved_outputs['id']],
cen_id=resolved_outputs['cen_id'],
transit_router_id=resolved_outputs['transit_router_id']))
pulumi.export("cenTransitRouterVpnAttachmentId0", ids.attachments[0].id)
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/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 := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := alicloud.GetAccount(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
defaultInstance, err := cen.NewInstance(ctx, "default", &cen.InstanceArgs{
CenInstanceName: pulumi.String(name),
})
if err != nil {
return err
}
defaultTransitRouter, err := cen.NewTransitRouter(ctx, "default", &cen.TransitRouterArgs{
CenId: defaultInstance.ID(),
})
if err != nil {
return err
}
defaultTransitRouterCidr, err := cen.NewTransitRouterCidr(ctx, "default", &cen.TransitRouterCidrArgs{
Cidr: pulumi.String("192.168.10.0/24"),
TransitRouterId: defaultTransitRouter.TransitRouterId,
PublishCidrRoute: pulumi.Bool(true),
})
if err != nil {
return err
}
defaultCustomerGateway, err := vpn.NewCustomerGateway(ctx, "default", &vpn.CustomerGatewayArgs{
IpAddress: pulumi.String("1.1.1.8"),
CustomerGatewayName: pulumi.String(name),
}, pulumi.DependsOn([]pulumi.Resource{
defaultTransitRouterCidr,
}))
if err != nil {
return err
}
defaultGatewayVpnAttachment, err := vpn.NewGatewayVpnAttachment(ctx, "default", &vpn.GatewayVpnAttachmentArgs{
NetworkType: pulumi.String("public"),
LocalSubnet: pulumi.String("0.0.0.0/0"),
EnableTunnelsBgp: pulumi.Bool(false),
VpnAttachmentName: pulumi.String(name),
TunnelOptionsSpecifications: vpn.GatewayVpnAttachmentTunnelOptionsSpecificationArray{
&vpn.GatewayVpnAttachmentTunnelOptionsSpecificationArgs{
CustomerGatewayId: defaultCustomerGateway.ID(),
EnableDpd: pulumi.Bool(true),
EnableNatTraversal: pulumi.Bool(true),
TunnelIndex: pulumi.Int(1),
TunnelIkeConfig: &vpn.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs{
RemoteId: pulumi.String("2.2.2.2"),
IkeEncAlg: pulumi.String("aes"),
IkeMode: pulumi.String("main"),
IkeVersion: pulumi.String("ikev1"),
LocalId: pulumi.String("1.1.1.1"),
IkeAuthAlg: pulumi.String("md5"),
IkeLifetime: pulumi.Int(86100),
IkePfs: pulumi.String("group2"),
Psk: pulumi.String("12345678"),
},
TunnelIpsecConfig: &vpn.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs{
IpsecAuthAlg: pulumi.String("md5"),
IpsecEncAlg: pulumi.String("aes"),
IpsecLifetime: pulumi.Int(86200),
IpsecPfs: pulumi.String("group5"),
},
},
&vpn.GatewayVpnAttachmentTunnelOptionsSpecificationArgs{
EnableNatTraversal: pulumi.Bool(true),
TunnelIndex: pulumi.Int(2),
TunnelIkeConfig: &vpn.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs{
LocalId: pulumi.String("4.4.4.4"),
RemoteId: pulumi.String("5.5.5.5"),
IkeLifetime: pulumi.Int(86400),
IkePfs: pulumi.String("group5"),
IkeMode: pulumi.String("main"),
IkeVersion: pulumi.String("ikev2"),
Psk: pulumi.String("32333442"),
IkeAuthAlg: pulumi.String("md5"),
IkeEncAlg: pulumi.String("aes"),
},
TunnelIpsecConfig: &vpn.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs{
IpsecEncAlg: pulumi.String("aes"),
IpsecLifetime: pulumi.Int(86400),
IpsecPfs: pulumi.String("group5"),
IpsecAuthAlg: pulumi.String("sha256"),
},
CustomerGatewayId: defaultCustomerGateway.ID(),
EnableDpd: pulumi.Bool(true),
},
},
RemoteSubnet: pulumi.String("0.0.0.0/0"),
})
if err != nil {
return err
}
defaultTransitRouterVpnAttachment, err := cen.NewTransitRouterVpnAttachment(ctx, "default", &cen.TransitRouterVpnAttachmentArgs{
AutoPublishRouteEnabled: pulumi.Bool(false),
TransitRouterAttachmentDescription: pulumi.String(name),
TransitRouterAttachmentName: pulumi.String(name),
CenId: defaultTransitRouter.CenId,
TransitRouterId: defaultTransitRouter.TransitRouterId,
VpnId: defaultGatewayVpnAttachment.ID(),
VpnOwnerId: pulumi.String(_default.Id),
ChargeType: pulumi.String("POSTPAY"),
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
"For": pulumi.String("VpnAttachment"),
},
})
if err != nil {
return err
}
ids := pulumi.All(defaultTransitRouterVpnAttachment.ID(), defaultTransitRouterVpnAttachment.CenId, defaultTransitRouterVpnAttachment.TransitRouterId).ApplyT(func(_args []interface{}) (cen.GetTransitRouterVpnAttachmentsResult, error) {
id := _args[0].(string)
cenId := _args[1].(string)
transitRouterId := _args[2].(*string)
return cen.GetTransitRouterVpnAttachmentsResult(interface{}(cen.GetTransitRouterVpnAttachmentsOutput(ctx, cen.GetTransitRouterVpnAttachmentsOutputArgs{
Ids: []string{
id,
},
CenId: cenId,
TransitRouterId: transitRouterId,
}, nil))), nil
}).(cen.GetTransitRouterVpnAttachmentsResultOutput)
ctx.Export("cenTransitRouterVpnAttachmentId0", ids.ApplyT(func(ids cen.GetTransitRouterVpnAttachmentsResult) (*string, error) {
return &ids.Attachments[0].Id, nil
}).(pulumi.StringPtrOutput))
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 @default = AliCloud.GetAccount.Invoke();
var defaultInstance = new AliCloud.Cen.Instance("default", new()
{
CenInstanceName = name,
});
var defaultTransitRouter = new AliCloud.Cen.TransitRouter("default", new()
{
CenId = defaultInstance.Id,
});
var defaultTransitRouterCidr = new AliCloud.Cen.TransitRouterCidr("default", new()
{
Cidr = "192.168.10.0/24",
TransitRouterId = defaultTransitRouter.TransitRouterId,
PublishCidrRoute = true,
});
var defaultCustomerGateway = new AliCloud.Vpn.CustomerGateway("default", new()
{
IpAddress = "1.1.1.8",
CustomerGatewayName = name,
}, new CustomResourceOptions
{
DependsOn =
{
defaultTransitRouterCidr,
},
});
var defaultGatewayVpnAttachment = new AliCloud.Vpn.GatewayVpnAttachment("default", new()
{
NetworkType = "public",
LocalSubnet = "0.0.0.0/0",
EnableTunnelsBgp = false,
VpnAttachmentName = name,
TunnelOptionsSpecifications = new[]
{
new AliCloud.Vpn.Inputs.GatewayVpnAttachmentTunnelOptionsSpecificationArgs
{
CustomerGatewayId = defaultCustomerGateway.Id,
EnableDpd = true,
EnableNatTraversal = true,
TunnelIndex = 1,
TunnelIkeConfig = new AliCloud.Vpn.Inputs.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs
{
RemoteId = "2.2.2.2",
IkeEncAlg = "aes",
IkeMode = "main",
IkeVersion = "ikev1",
LocalId = "1.1.1.1",
IkeAuthAlg = "md5",
IkeLifetime = 86100,
IkePfs = "group2",
Psk = "12345678",
},
TunnelIpsecConfig = new AliCloud.Vpn.Inputs.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs
{
IpsecAuthAlg = "md5",
IpsecEncAlg = "aes",
IpsecLifetime = 86200,
IpsecPfs = "group5",
},
},
new AliCloud.Vpn.Inputs.GatewayVpnAttachmentTunnelOptionsSpecificationArgs
{
EnableNatTraversal = true,
TunnelIndex = 2,
TunnelIkeConfig = new AliCloud.Vpn.Inputs.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs
{
LocalId = "4.4.4.4",
RemoteId = "5.5.5.5",
IkeLifetime = 86400,
IkePfs = "group5",
IkeMode = "main",
IkeVersion = "ikev2",
Psk = "32333442",
IkeAuthAlg = "md5",
IkeEncAlg = "aes",
},
TunnelIpsecConfig = new AliCloud.Vpn.Inputs.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs
{
IpsecEncAlg = "aes",
IpsecLifetime = 86400,
IpsecPfs = "group5",
IpsecAuthAlg = "sha256",
},
CustomerGatewayId = defaultCustomerGateway.Id,
EnableDpd = true,
},
},
RemoteSubnet = "0.0.0.0/0",
});
var defaultTransitRouterVpnAttachment = new AliCloud.Cen.TransitRouterVpnAttachment("default", new()
{
AutoPublishRouteEnabled = false,
TransitRouterAttachmentDescription = name,
TransitRouterAttachmentName = name,
CenId = defaultTransitRouter.CenId,
TransitRouterId = defaultTransitRouter.TransitRouterId,
VpnId = defaultGatewayVpnAttachment.Id,
VpnOwnerId = @default.Apply(@default => @default.Apply(getAccountResult => getAccountResult.Id)),
ChargeType = "POSTPAY",
Tags =
{
{ "Created", "TF" },
{ "For", "VpnAttachment" },
},
});
var ids = AliCloud.Cen.GetTransitRouterVpnAttachments.Invoke(new()
{
Ids = new[]
{
defaultTransitRouterVpnAttachment.Id,
},
CenId = defaultTransitRouterVpnAttachment.CenId,
TransitRouterId = defaultTransitRouterVpnAttachment.TransitRouterId,
});
return new Dictionary<string, object?>
{
["cenTransitRouterVpnAttachmentId0"] = ids.Apply(getTransitRouterVpnAttachmentsResult => getTransitRouterVpnAttachmentsResult.Attachments[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
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.cen.TransitRouterCidr;
import com.pulumi.alicloud.cen.TransitRouterCidrArgs;
import com.pulumi.alicloud.vpn.CustomerGateway;
import com.pulumi.alicloud.vpn.CustomerGatewayArgs;
import com.pulumi.alicloud.vpn.GatewayVpnAttachment;
import com.pulumi.alicloud.vpn.GatewayVpnAttachmentArgs;
import com.pulumi.alicloud.vpn.inputs.GatewayVpnAttachmentTunnelOptionsSpecificationArgs;
import com.pulumi.alicloud.vpn.inputs.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs;
import com.pulumi.alicloud.vpn.inputs.GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs;
import com.pulumi.alicloud.cen.TransitRouterVpnAttachment;
import com.pulumi.alicloud.cen.TransitRouterVpnAttachmentArgs;
import com.pulumi.alicloud.cen.CenFunctions;
import com.pulumi.alicloud.cen.inputs.GetTransitRouterVpnAttachmentsArgs;
import com.pulumi.resources.CustomResourceOptions;
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 default = AlicloudFunctions.getAccount(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.cenInstanceName(name)
.build());
var defaultTransitRouter = new TransitRouter("defaultTransitRouter", TransitRouterArgs.builder()
.cenId(defaultInstance.id())
.build());
var defaultTransitRouterCidr = new TransitRouterCidr("defaultTransitRouterCidr", TransitRouterCidrArgs.builder()
.cidr("192.168.10.0/24")
.transitRouterId(defaultTransitRouter.transitRouterId())
.publishCidrRoute(true)
.build());
var defaultCustomerGateway = new CustomerGateway("defaultCustomerGateway", CustomerGatewayArgs.builder()
.ipAddress("1.1.1.8")
.customerGatewayName(name)
.build(), CustomResourceOptions.builder()
.dependsOn(defaultTransitRouterCidr)
.build());
var defaultGatewayVpnAttachment = new GatewayVpnAttachment("defaultGatewayVpnAttachment", GatewayVpnAttachmentArgs.builder()
.networkType("public")
.localSubnet("0.0.0.0/0")
.enableTunnelsBgp(false)
.vpnAttachmentName(name)
.tunnelOptionsSpecifications(
GatewayVpnAttachmentTunnelOptionsSpecificationArgs.builder()
.customerGatewayId(defaultCustomerGateway.id())
.enableDpd(true)
.enableNatTraversal(true)
.tunnelIndex(1)
.tunnelIkeConfig(GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs.builder()
.remoteId("2.2.2.2")
.ikeEncAlg("aes")
.ikeMode("main")
.ikeVersion("ikev1")
.localId("1.1.1.1")
.ikeAuthAlg("md5")
.ikeLifetime(86100)
.ikePfs("group2")
.psk("12345678")
.build())
.tunnelIpsecConfig(GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs.builder()
.ipsecAuthAlg("md5")
.ipsecEncAlg("aes")
.ipsecLifetime(86200)
.ipsecPfs("group5")
.build())
.build(),
GatewayVpnAttachmentTunnelOptionsSpecificationArgs.builder()
.enableNatTraversal(true)
.tunnelIndex(2)
.tunnelIkeConfig(GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIkeConfigArgs.builder()
.localId("4.4.4.4")
.remoteId("5.5.5.5")
.ikeLifetime(86400)
.ikePfs("group5")
.ikeMode("main")
.ikeVersion("ikev2")
.psk("32333442")
.ikeAuthAlg("md5")
.ikeEncAlg("aes")
.build())
.tunnelIpsecConfig(GatewayVpnAttachmentTunnelOptionsSpecificationTunnelIpsecConfigArgs.builder()
.ipsecEncAlg("aes")
.ipsecLifetime(86400)
.ipsecPfs("group5")
.ipsecAuthAlg("sha256")
.build())
.customerGatewayId(defaultCustomerGateway.id())
.enableDpd(true)
.build())
.remoteSubnet("0.0.0.0/0")
.build());
var defaultTransitRouterVpnAttachment = new TransitRouterVpnAttachment("defaultTransitRouterVpnAttachment", TransitRouterVpnAttachmentArgs.builder()
.autoPublishRouteEnabled(false)
.transitRouterAttachmentDescription(name)
.transitRouterAttachmentName(name)
.cenId(defaultTransitRouter.cenId())
.transitRouterId(defaultTransitRouter.transitRouterId())
.vpnId(defaultGatewayVpnAttachment.id())
.vpnOwnerId(default_.id())
.chargeType("POSTPAY")
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "VpnAttachment")
))
.build());
final var ids = Output.tuple(defaultTransitRouterVpnAttachment.id(), defaultTransitRouterVpnAttachment.cenId(), defaultTransitRouterVpnAttachment.transitRouterId()).applyValue(values -> {
var id = values.t1;
var cenId = values.t2;
var transitRouterId = values.t3;
return CenFunctions.getTransitRouterVpnAttachments(GetTransitRouterVpnAttachmentsArgs.builder()
.ids(id)
.cenId(cenId)
.transitRouterId(transitRouterId)
.build());
});
ctx.export("cenTransitRouterVpnAttachmentId0", ids.applyValue(_ids -> _ids.attachments()[0].id()));
}
}
configuration:
name:
type: string
default: terraform-example
resources:
defaultInstance:
type: alicloud:cen:Instance
name: default
properties:
cenInstanceName: ${name}
defaultTransitRouter:
type: alicloud:cen:TransitRouter
name: default
properties:
cenId: ${defaultInstance.id}
defaultTransitRouterCidr:
type: alicloud:cen:TransitRouterCidr
name: default
properties:
cidr: 192.168.10.0/24
transitRouterId: ${defaultTransitRouter.transitRouterId}
publishCidrRoute: true
defaultCustomerGateway:
type: alicloud:vpn:CustomerGateway
name: default
properties:
ipAddress: 1.1.1.8
customerGatewayName: ${name}
options:
dependsOn:
- ${defaultTransitRouterCidr}
defaultGatewayVpnAttachment:
type: alicloud:vpn:GatewayVpnAttachment
name: default
properties:
networkType: public
localSubnet: 0.0.0.0/0
enableTunnelsBgp: 'false'
vpnAttachmentName: ${name}
tunnelOptionsSpecifications:
- customerGatewayId: ${defaultCustomerGateway.id}
enableDpd: 'true'
enableNatTraversal: 'true'
tunnelIndex: '1'
tunnelIkeConfig:
remoteId: 2.2.2.2
ikeEncAlg: aes
ikeMode: main
ikeVersion: ikev1
localId: 1.1.1.1
ikeAuthAlg: md5
ikeLifetime: '86100'
ikePfs: group2
psk: '12345678'
tunnelIpsecConfig:
ipsecAuthAlg: md5
ipsecEncAlg: aes
ipsecLifetime: '86200'
ipsecPfs: group5
- enableNatTraversal: 'true'
tunnelIndex: '2'
tunnelIkeConfig:
localId: 4.4.4.4
remoteId: 5.5.5.5
ikeLifetime: '86400'
ikePfs: group5
ikeMode: main
ikeVersion: ikev2
psk: '32333442'
ikeAuthAlg: md5
ikeEncAlg: aes
tunnelIpsecConfig:
ipsecEncAlg: aes
ipsecLifetime: '86400'
ipsecPfs: group5
ipsecAuthAlg: sha256
customerGatewayId: ${defaultCustomerGateway.id}
enableDpd: 'true'
remoteSubnet: 0.0.0.0/0
defaultTransitRouterVpnAttachment:
type: alicloud:cen:TransitRouterVpnAttachment
name: default
properties:
autoPublishRouteEnabled: false
transitRouterAttachmentDescription: ${name}
transitRouterAttachmentName: ${name}
cenId: ${defaultTransitRouter.cenId}
transitRouterId: ${defaultTransitRouter.transitRouterId}
vpnId: ${defaultGatewayVpnAttachment.id}
vpnOwnerId: ${default.id}
chargeType: POSTPAY
tags:
Created: TF
For: VpnAttachment
variables:
default:
fn::invoke:
function: alicloud:getAccount
arguments: {}
ids:
fn::invoke:
function: alicloud:cen:getTransitRouterVpnAttachments
arguments:
ids:
- ${defaultTransitRouterVpnAttachment.id}
cenId: ${defaultTransitRouterVpnAttachment.cenId}
transitRouterId: ${defaultTransitRouterVpnAttachment.transitRouterId}
outputs:
cenTransitRouterVpnAttachmentId0: ${ids.attachments[0].id}
Using getTransitRouterVpnAttachments
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getTransitRouterVpnAttachments(args: GetTransitRouterVpnAttachmentsArgs, opts?: InvokeOptions): Promise<GetTransitRouterVpnAttachmentsResult>
function getTransitRouterVpnAttachmentsOutput(args: GetTransitRouterVpnAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetTransitRouterVpnAttachmentsResult>def get_transit_router_vpn_attachments(cen_id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
transit_router_attachment_id: Optional[str] = None,
transit_router_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetTransitRouterVpnAttachmentsResult
def get_transit_router_vpn_attachments_output(cen_id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
transit_router_attachment_id: Optional[pulumi.Input[str]] = None,
transit_router_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetTransitRouterVpnAttachmentsResult]func GetTransitRouterVpnAttachments(ctx *Context, args *GetTransitRouterVpnAttachmentsArgs, opts ...InvokeOption) (*GetTransitRouterVpnAttachmentsResult, error)
func GetTransitRouterVpnAttachmentsOutput(ctx *Context, args *GetTransitRouterVpnAttachmentsOutputArgs, opts ...InvokeOption) GetTransitRouterVpnAttachmentsResultOutput> Note: This function is named GetTransitRouterVpnAttachments in the Go SDK.
public static class GetTransitRouterVpnAttachments
{
public static Task<GetTransitRouterVpnAttachmentsResult> InvokeAsync(GetTransitRouterVpnAttachmentsArgs args, InvokeOptions? opts = null)
public static Output<GetTransitRouterVpnAttachmentsResult> Invoke(GetTransitRouterVpnAttachmentsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTransitRouterVpnAttachmentsResult> getTransitRouterVpnAttachments(GetTransitRouterVpnAttachmentsArgs args, InvokeOptions options)
public static Output<GetTransitRouterVpnAttachmentsResult> getTransitRouterVpnAttachments(GetTransitRouterVpnAttachmentsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:cen/getTransitRouterVpnAttachments:getTransitRouterVpnAttachments
arguments:
# arguments dictionaryThe following arguments are supported:
- Cen
Id string - The ID of the Cloud Enterprise Network (CEN) instance.
- Ids List<string>
- A list of Transit Router Vpn Attachment IDs.
- Name
Regex string - A regex string to filter results by Transit Router Vpn Attachment name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Status string
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Dictionary<string, string>
- The tag of the resource.
- Transit
Router stringAttachment Id - The ID of the VPN attachment.
- Transit
Router stringId - The ID of the transit router.
- Cen
Id string - The ID of the Cloud Enterprise Network (CEN) instance.
- Ids []string
- A list of Transit Router Vpn Attachment IDs.
- Name
Regex string - A regex string to filter results by Transit Router Vpn Attachment name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Status string
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - map[string]string
- The tag of the resource.
- Transit
Router stringAttachment Id - The ID of the VPN attachment.
- Transit
Router stringId - The ID of the transit router.
- cen
Id String - The ID of the Cloud Enterprise Network (CEN) instance.
- ids List<String>
- A list of Transit Router Vpn Attachment IDs.
- name
Regex String - A regex string to filter results by Transit Router Vpn Attachment name.
- output
File String - File name where to save data source results (after running
pulumi preview). - status String
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Map<String,String>
- The tag of the resource.
- transit
Router StringAttachment Id - The ID of the VPN attachment.
- transit
Router StringId - The ID of the transit router.
- cen
Id string - The ID of the Cloud Enterprise Network (CEN) instance.
- ids string[]
- A list of Transit Router Vpn Attachment IDs.
- name
Regex string - A regex string to filter results by Transit Router Vpn Attachment name.
- output
File string - File name where to save data source results (after running
pulumi preview). - status string
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - {[key: string]: string}
- The tag of the resource.
- transit
Router stringAttachment Id - The ID of the VPN attachment.
- transit
Router stringId - The ID of the transit router.
- cen_
id str - The ID of the Cloud Enterprise Network (CEN) instance.
- ids Sequence[str]
- A list of Transit Router Vpn Attachment IDs.
- name_
regex str - A regex string to filter results by Transit Router Vpn Attachment name.
- output_
file str - File name where to save data source results (after running
pulumi preview). - status str
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Mapping[str, str]
- The tag of the resource.
- transit_
router_ strattachment_ id - The ID of the VPN attachment.
- transit_
router_ strid - The ID of the transit router.
- cen
Id String - The ID of the Cloud Enterprise Network (CEN) instance.
- ids List<String>
- A list of Transit Router Vpn Attachment IDs.
- name
Regex String - A regex string to filter results by Transit Router Vpn Attachment name.
- output
File String - File name where to save data source results (after running
pulumi preview). - status String
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Map<String>
- The tag of the resource.
- transit
Router StringAttachment Id - The ID of the VPN attachment.
- transit
Router StringId - The ID of the transit router.
getTransitRouterVpnAttachments Result
The following output properties are available:
- Attachments
List<Pulumi.
Ali Cloud. Cen. Outputs. Get Transit Router Vpn Attachments Attachment> - A list of Transit Router Vpn Attachment Entries. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- A list of name of Transit Router Vpn Attachments.
- Cen
Id string - (Available since v1.245.0) The ID of the Cloud Enterprise Network (CEN) instance.
- Name
Regex string - Output
File string - Status string
- The status of the VPN connection.
- Dictionary<string, string>
- (Available since v1.245.0) The tag of the resource.
- Transit
Router stringAttachment Id - (Available since v1.245.0) The ID of the VPN attachment.
- Transit
Router stringId - The ID of the transit router.
- Attachments
[]Get
Transit Router Vpn Attachments Attachment - A list of Transit Router Vpn Attachment Entries. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- A list of name of Transit Router Vpn Attachments.
- Cen
Id string - (Available since v1.245.0) The ID of the Cloud Enterprise Network (CEN) instance.
- Name
Regex string - Output
File string - Status string
- The status of the VPN connection.
- map[string]string
- (Available since v1.245.0) The tag of the resource.
- Transit
Router stringAttachment Id - (Available since v1.245.0) The ID of the VPN attachment.
- Transit
Router stringId - The ID of the transit router.
- attachments
List<Get
Transit Router Vpn Attachments Attachment> - A list of Transit Router Vpn Attachment Entries. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of name of Transit Router Vpn Attachments.
- cen
Id String - (Available since v1.245.0) The ID of the Cloud Enterprise Network (CEN) instance.
- name
Regex String - output
File String - status String
- The status of the VPN connection.
- Map<String,String>
- (Available since v1.245.0) The tag of the resource.
- transit
Router StringAttachment Id - (Available since v1.245.0) The ID of the VPN attachment.
- transit
Router StringId - The ID of the transit router.
- attachments
Get
Transit Router Vpn Attachments Attachment[] - A list of Transit Router Vpn Attachment Entries. Each element contains the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- A list of name of Transit Router Vpn Attachments.
- cen
Id string - (Available since v1.245.0) The ID of the Cloud Enterprise Network (CEN) instance.
- name
Regex string - output
File string - status string
- The status of the VPN connection.
- {[key: string]: string}
- (Available since v1.245.0) The tag of the resource.
- transit
Router stringAttachment Id - (Available since v1.245.0) The ID of the VPN attachment.
- transit
Router stringId - The ID of the transit router.
- attachments
Sequence[Get
Transit Router Vpn Attachments Attachment] - A list of Transit Router Vpn Attachment Entries. Each element contains the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- A list of name of Transit Router Vpn Attachments.
- cen_
id str - (Available since v1.245.0) The ID of the Cloud Enterprise Network (CEN) instance.
- name_
regex str - output_
file str - status str
- The status of the VPN connection.
- Mapping[str, str]
- (Available since v1.245.0) The tag of the resource.
- transit_
router_ strattachment_ id - (Available since v1.245.0) The ID of the VPN attachment.
- transit_
router_ strid - The ID of the transit router.
- attachments List<Property Map>
- A list of Transit Router Vpn Attachment Entries. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of name of Transit Router Vpn Attachments.
- cen
Id String - (Available since v1.245.0) The ID of the Cloud Enterprise Network (CEN) instance.
- name
Regex String - output
File String - status String
- The status of the VPN connection.
- Map<String>
- (Available since v1.245.0) The tag of the resource.
- transit
Router StringAttachment Id - (Available since v1.245.0) The ID of the VPN attachment.
- transit
Router StringId - The ID of the transit router.
Supporting Types
GetTransitRouterVpnAttachmentsAttachment
- Auto
Publish boolRoute Enabled - Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment.
- Cen
Id string - The ID of the Cloud Enterprise Network (CEN) instance.
- Charge
Type string - (Available since v1.245.0) The billing method of the VPN attachment.
- Create
Time string - The time when the VPN connection was created.
- Id string
- The ID of the resource supplied above.
- Resource
Type string - The type of resource attached to the transit router.
- Status string
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Dictionary<string, string>
- The tag of the resource.
- Transit
Router stringAttachment Description - The description of the IPsec-VPN connection.
- Transit
Router stringAttachment Id - The ID of the VPN attachment.
- Transit
Router stringAttachment Name - The name of the VPN attachment.
- Transit
Router stringId - The ID of the transit router.
- Vpn
Id string - The ID of the IPsec-VPN attachment.
- Vpn
Owner intId - The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
- Zones
List<Pulumi.
Ali Cloud. Cen. Inputs. Get Transit Router Vpn Attachments Attachment Zone> - The Zone ID in the current region.System will create resources under the Zone that you specify.Left blank if associated IPSec connection is in dual-tunnel mode.
- Auto
Publish boolRoute Enabled - Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment.
- Cen
Id string - The ID of the Cloud Enterprise Network (CEN) instance.
- Charge
Type string - (Available since v1.245.0) The billing method of the VPN attachment.
- Create
Time string - The time when the VPN connection was created.
- Id string
- The ID of the resource supplied above.
- Resource
Type string - The type of resource attached to the transit router.
- Status string
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - map[string]string
- The tag of the resource.
- Transit
Router stringAttachment Description - The description of the IPsec-VPN connection.
- Transit
Router stringAttachment Id - The ID of the VPN attachment.
- Transit
Router stringAttachment Name - The name of the VPN attachment.
- Transit
Router stringId - The ID of the transit router.
- Vpn
Id string - The ID of the IPsec-VPN attachment.
- Vpn
Owner intId - The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
- Zones
[]Get
Transit Router Vpn Attachments Attachment Zone - The Zone ID in the current region.System will create resources under the Zone that you specify.Left blank if associated IPSec connection is in dual-tunnel mode.
- auto
Publish BooleanRoute Enabled - Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment.
- cen
Id String - The ID of the Cloud Enterprise Network (CEN) instance.
- charge
Type String - (Available since v1.245.0) The billing method of the VPN attachment.
- create
Time String - The time when the VPN connection was created.
- id String
- The ID of the resource supplied above.
- resource
Type String - The type of resource attached to the transit router.
- status String
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Map<String,String>
- The tag of the resource.
- transit
Router StringAttachment Description - The description of the IPsec-VPN connection.
- transit
Router StringAttachment Id - The ID of the VPN attachment.
- transit
Router StringAttachment Name - The name of the VPN attachment.
- transit
Router StringId - The ID of the transit router.
- vpn
Id String - The ID of the IPsec-VPN attachment.
- vpn
Owner IntegerId - The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
- zones
List<Get
Transit Router Vpn Attachments Attachment Zone> - The Zone ID in the current region.System will create resources under the Zone that you specify.Left blank if associated IPSec connection is in dual-tunnel mode.
- auto
Publish booleanRoute Enabled - Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment.
- cen
Id string - The ID of the Cloud Enterprise Network (CEN) instance.
- charge
Type string - (Available since v1.245.0) The billing method of the VPN attachment.
- create
Time string - The time when the VPN connection was created.
- id string
- The ID of the resource supplied above.
- resource
Type string - The type of resource attached to the transit router.
- status string
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - {[key: string]: string}
- The tag of the resource.
- transit
Router stringAttachment Description - The description of the IPsec-VPN connection.
- transit
Router stringAttachment Id - The ID of the VPN attachment.
- transit
Router stringAttachment Name - The name of the VPN attachment.
- transit
Router stringId - The ID of the transit router.
- vpn
Id string - The ID of the IPsec-VPN attachment.
- vpn
Owner numberId - The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
- zones
Get
Transit Router Vpn Attachments Attachment Zone[] - The Zone ID in the current region.System will create resources under the Zone that you specify.Left blank if associated IPSec connection is in dual-tunnel mode.
- auto_
publish_ boolroute_ enabled - Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment.
- cen_
id str - The ID of the Cloud Enterprise Network (CEN) instance.
- charge_
type str - (Available since v1.245.0) The billing method of the VPN attachment.
- create_
time str - The time when the VPN connection was created.
- id str
- The ID of the resource supplied above.
- resource_
type str - The type of resource attached to the transit router.
- status str
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Mapping[str, str]
- The tag of the resource.
- transit_
router_ strattachment_ description - The description of the IPsec-VPN connection.
- transit_
router_ strattachment_ id - The ID of the VPN attachment.
- transit_
router_ strattachment_ name - The name of the VPN attachment.
- transit_
router_ strid - The ID of the transit router.
- vpn_
id str - The ID of the IPsec-VPN attachment.
- vpn_
owner_ intid - The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
- zones
Sequence[Get
Transit Router Vpn Attachments Attachment Zone] - The Zone ID in the current region.System will create resources under the Zone that you specify.Left blank if associated IPSec connection is in dual-tunnel mode.
- auto
Publish BooleanRoute Enabled - Specifies whether to allow the transit router to automatically advertise routes to the IPsec-VPN attachment.
- cen
Id String - The ID of the Cloud Enterprise Network (CEN) instance.
- charge
Type String - (Available since v1.245.0) The billing method of the VPN attachment.
- create
Time String - The time when the VPN connection was created.
- id String
- The ID of the resource supplied above.
- resource
Type String - The type of resource attached to the transit router.
- status String
- The Status of Transit Router Vpn Attachment. Valid values:
Attached,Attaching,Detaching. - Map<String>
- The tag of the resource.
- transit
Router StringAttachment Description - The description of the IPsec-VPN connection.
- transit
Router StringAttachment Id - The ID of the VPN attachment.
- transit
Router StringAttachment Name - The name of the VPN attachment.
- transit
Router StringId - The ID of the transit router.
- vpn
Id String - The ID of the IPsec-VPN attachment.
- vpn
Owner NumberId - The ID of the Alibaba Cloud account to which the IPsec-VPN connection belongs.
- zones List<Property Map>
- The Zone ID in the current region.System will create resources under the Zone that you specify.Left blank if associated IPSec connection is in dual-tunnel mode.
GetTransitRouterVpnAttachmentsAttachmentZone
- Zone
Id string - The zone ID of the read-only instance.
- Zone
Id string - The zone ID of the read-only instance.
- zone
Id String - The zone ID of the read-only instance.
- zone
Id string - The zone ID of the read-only instance.
- zone_
id str - The zone ID of the read-only instance.
- zone
Id String - The zone ID of the read-only instance.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
