getGatewayVpnAttachments

This data source provides the Vpn Gateway Vpn Attachments of the current Alibaba Cloud user.

NOTE: Available in v1.181.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.vpn.getGatewayVpnAttachments({});
export const vpnGatewayVpnAttachmentId1 = ids.then(ids => ids.attachments?.[0]?.id);
const nameRegex = alicloud.vpn.getGatewayVpnAttachments({
nameRegex: "^my-VpnAttachment",
});
export const vpnGatewayVpnAttachmentId2 = nameRegex.then(nameRegex => nameRegex.attachments?.[0]?.id);
export const localId = vpnAttachments.attachments[0].ikeConfig[0].localId;
export const internetIp = vpnAttachments.attachments[0].internetIp;
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.vpn.get_gateway_vpn_attachments()
pulumi.export("vpnGatewayVpnAttachmentId1", ids.attachments[0].id)
name_regex = alicloud.vpn.get_gateway_vpn_attachments(name_regex="^my-VpnAttachment")
pulumi.export("vpnGatewayVpnAttachmentId2", name_regex.attachments[0].id)
pulumi.export("localId", vpn_attachments["attachments"][0]["ikeConfig"][0]["localId"])
pulumi.export("internetIp", vpn_attachments["attachments"][0]["internetIp"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Vpn.GetGatewayVpnAttachments.Invoke();
var nameRegex = AliCloud.Vpn.GetGatewayVpnAttachments.Invoke(new()
{
NameRegex = "^my-VpnAttachment",
});
return new Dictionary<string, object?>
{
["vpnGatewayVpnAttachmentId1"] = ids&#46;Apply(getGatewayVpnAttachmentsResult => getGatewayVpnAttachmentsResult&#46;Attachments[0]?.Id),
["vpnGatewayVpnAttachmentId2"] = nameRegex&#46;Apply(getGatewayVpnAttachmentsResult => getGatewayVpnAttachmentsResult&#46;Attachments[0]?.Id),
["localId"] = vpnAttachments&#46;Attachments[0]&#46;IkeConfig[0].LocalId,
["internetIp"] = vpnAttachments&#46;Attachments[0].InternetIp,
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpn"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := vpn.GetGatewayVpnAttachments(ctx, nil, nil)
if err != nil {
return err
}
ctx.Export("vpnGatewayVpnAttachmentId1", ids.Attachments[0].Id)
nameRegex, err := vpn.GetGatewayVpnAttachments(ctx, &vpn.GetGatewayVpnAttachmentsArgs{
NameRegex: pulumi.StringRef("^my-VpnAttachment"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpnGatewayVpnAttachmentId2", nameRegex.Attachments[0].Id)
ctx.Export("localId", vpnAttachments.Attachments[0]&#46;IkeConfig[0].LocalId)
ctx.Export("internetIp", vpnAttachments.Attachments[0].InternetIp)
return nil
})
}
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.GetGatewayVpnAttachmentsArgs;
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 ids = VpnFunctions.getGatewayVpnAttachments();
ctx.export("vpnGatewayVpnAttachmentId1", ids.applyValue(getGatewayVpnAttachmentsResult -> getGatewayVpnAttachmentsResult.attachments()[0].id()));
final var nameRegex = VpnFunctions.getGatewayVpnAttachments(GetGatewayVpnAttachmentsArgs.builder()
.nameRegex("^my-VpnAttachment")
.build());
ctx.export("vpnGatewayVpnAttachmentId2", nameRegex.applyValue(getGatewayVpnAttachmentsResult -> getGatewayVpnAttachmentsResult.attachments()[0].id()));
ctx.export("localId", vpnAttachments.attachments()[0]&#46;ikeConfig()[0].localId());
ctx.export("internetIp", vpnAttachments.attachments()[0].internetIp());
}
}
variables:
ids:
fn::invoke:
Function: alicloud:vpn:getGatewayVpnAttachments
Arguments: {}
nameRegex:
fn::invoke:
Function: alicloud:vpn:getGatewayVpnAttachments
Arguments:
nameRegex: ^my-VpnAttachment
outputs:
vpnGatewayVpnAttachmentId1: ${ids.attachments[0].id}
vpnGatewayVpnAttachmentId2: ${nameRegex.attachments[0].id}
localId: ${vpnAttachments.attachments[0]&#46;ikeConfig[0].localId}
internetIp: ${vpnAttachments.attachments[0].internetIp}

Return

A collection of values returned by getGatewayVpnAttachments.

Parameters

argument

A collection of arguments for invoking getGatewayVpnAttachments.


suspend fun getGatewayVpnAttachments(ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, pageNumber: Int? = null, pageSize: Int? = null, status: String? = null, vpnGatewayId: String? = null): GetGatewayVpnAttachmentsResult

Return

A collection of values returned by getGatewayVpnAttachments.

Parameters

ids

A list of Vpn Attachment IDs.

nameRegex

A regex string to filter results by Vpn Attachment name.

outputFile

File name where to save data source results (after running pulumi preview).

pageNumber
pageSize
status

The status of the resource. Valid values: init, active, attaching, attached, detaching, financialLocked, provisioning, updating, upgrading, deleted.

vpnGatewayId

The parameter 'vpn_gateway_id' has been deprecated from 1.194.0.

See also


Return

A collection of values returned by getGatewayVpnAttachments.

Parameters

argument

Builder for com.pulumi.alicloud.vpn.kotlin.inputs.GetGatewayVpnAttachmentsPlainArgs.

See also