getIpsecServers

This data source provides the Vpn Ipsec Servers of the current Alibaba Cloud user.

NOTE: Available in v1.161.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.vpc.getIpsecServers({
ids: ["example_id"],
});
export const vpnIpsecServerId1 = ids.then(ids => ids.servers?.[0]?.id);
const nameRegex = alicloud.vpc.getIpsecServers({
nameRegex: "^my-IpsecServer",
});
export const vpnIpsecServerId2 = nameRegex.then(nameRegex => nameRegex.servers?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.vpc.get_ipsec_servers(ids=["example_id"])
pulumi.export("vpnIpsecServerId1", ids.servers[0].id)
name_regex = alicloud.vpc.get_ipsec_servers(name_regex="^my-IpsecServer")
pulumi.export("vpnIpsecServerId2", name_regex.servers[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Vpc.GetIpsecServers.Invoke(new()
{
Ids = new[]
{
"example_id",
},
});
var nameRegex = AliCloud.Vpc.GetIpsecServers.Invoke(new()
{
NameRegex = "^my-IpsecServer",
});
return new Dictionary<string, object?>
{
["vpnIpsecServerId1"] = ids&#46;Apply(getIpsecServersResult => getIpsecServersResult&#46;Servers[0]?.Id),
["vpnIpsecServerId2"] = nameRegex&#46;Apply(getIpsecServersResult => getIpsecServersResult&#46;Servers[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := vpc.GetIpsecServers(ctx, &vpc.GetIpsecServersArgs{
Ids: []string{
"example_id",
},
}, nil)
if err != nil {
return err
}
ctx.Export("vpnIpsecServerId1", ids.Servers[0].Id)
nameRegex, err := vpc.GetIpsecServers(ctx, &vpc.GetIpsecServersArgs{
NameRegex: pulumi.StringRef("^my-IpsecServer"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpnIpsecServerId2", nameRegex.Servers[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetIpsecServersArgs;
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 = VpcFunctions.getIpsecServers(GetIpsecServersArgs.builder()
.ids("example_id")
.build());
ctx.export("vpnIpsecServerId1", ids.applyValue(getIpsecServersResult -> getIpsecServersResult.servers()[0].id()));
final var nameRegex = VpcFunctions.getIpsecServers(GetIpsecServersArgs.builder()
.nameRegex("^my-IpsecServer")
.build());
ctx.export("vpnIpsecServerId2", nameRegex.applyValue(getIpsecServersResult -> getIpsecServersResult.servers()[0].id()));
}
}
variables:
ids:
fn::invoke:
Function: alicloud:vpc:getIpsecServers
Arguments:
ids:
- example_id
nameRegex:
fn::invoke:
Function: alicloud:vpc:getIpsecServers
Arguments:
nameRegex: ^my-IpsecServer
outputs:
vpnIpsecServerId1: ${ids.servers[0].id}
vpnIpsecServerId2: ${nameRegex.servers[0].id}

Return

A collection of values returned by getIpsecServers.

Parameters

argument

A collection of arguments for invoking getIpsecServers.


suspend fun getIpsecServers(ids: List<String>? = null, ipsecServerName: String? = null, nameRegex: String? = null, outputFile: String? = null, vpnGatewayId: String? = null): GetIpsecServersResult

Return

A collection of values returned by getIpsecServers.

See also

Parameters

ids

A list of Ipsec Server IDs.

ipsecServerName

The name of the IPsec server.

nameRegex

A regex string to filter results by Ipsec Server name.

outputFile

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

vpnGatewayId

The ID of the VPN gateway.


Return

A collection of values returned by getIpsecServers.

See also

Parameters

argument

Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetIpsecServersPlainArgs.