get Ipsec Servers
This data source provides the Vpn Ipsec Servers of the current Alibaba Cloud user.
NOTE: Available since 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);
Content copied to clipboard
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)
Content copied to clipboard
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.Apply(getIpsecServersResult => getIpsecServersResult.Servers[0]?.Id),
["vpnIpsecServerId2"] = nameRegex.Apply(getIpsecServersResult => getIpsecServersResult.Servers[0]?.Id),
};
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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.servers()[0].id());
final var nameRegex = VpcFunctions.getIpsecServers(GetIpsecServersArgs.builder()
.nameRegex("^my-IpsecServer")
.build());
ctx.export("vpnIpsecServerId2", nameRegex.servers()[0].id());
}
}
Content copied to clipboard
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}
Content copied to clipboard
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.
Parameters
ids
A list of Ipsec Server IDs.
ipsec Server Name
The name of the IPsec server.
name Regex
A regex string to filter results by Ipsec Server name.
output File
File name where to save data source results (after running pulumi preview
).
vpn Gateway Id
The ID of the VPN gateway.
See also
suspend fun getIpsecServers(argument: suspend GetIpsecServersPlainArgsBuilder.() -> Unit): GetIpsecServersResult
Return
A collection of values returned by getIpsecServers.
Parameters
argument
Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetIpsecServersPlainArgs.