getDhcpOptionsSets

This data source provides the Vpc Dhcp Options Sets of the current Alibaba Cloud user.

NOTE: Available in v1.134.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.vpc.getDhcpOptionsSets({
ids: ["example_value"],
});
export const vpcDhcpOptionsSetId1 = ids.then(ids => ids.sets?.[0]?.id);
const nameRegex = alicloud.vpc.getDhcpOptionsSets({
nameRegex: "^my-DhcpOptionsSet",
});
export const vpcDhcpOptionsSetId2 = nameRegex.then(nameRegex => nameRegex.sets?.[0]?.id);
const dhcpOptionsSetName = alicloud.vpc.getDhcpOptionsSets({
dhcpOptionsSetName: "my-DhcpOptionsSet",
});
export const vpcDhcpOptionsSetId3 = dhcpOptionsSetName.then(dhcpOptionsSetName => dhcpOptionsSetName.sets?.[0]?.id);
const domainName = alicloud.vpc.getDhcpOptionsSets({
ids: ["example_value"],
domainName: "example.com",
});
export const vpcDhcpOptionsSetId4 = domainName.then(domainName => domainName.sets?.[0]?.id);
const status = alicloud.vpc.getDhcpOptionsSets({
ids: ["example_value"],
status: "Available",
});
export const vpcDhcpOptionsSetId5 = status.then(status => status.sets?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.vpc.get_dhcp_options_sets(ids=["example_value"])
pulumi.export("vpcDhcpOptionsSetId1", ids.sets[0].id)
name_regex = alicloud.vpc.get_dhcp_options_sets(name_regex="^my-DhcpOptionsSet")
pulumi.export("vpcDhcpOptionsSetId2", name_regex.sets[0].id)
dhcp_options_set_name = alicloud.vpc.get_dhcp_options_sets(dhcp_options_set_name="my-DhcpOptionsSet")
pulumi.export("vpcDhcpOptionsSetId3", dhcp_options_set_name.sets[0].id)
domain_name = alicloud.vpc.get_dhcp_options_sets(ids=["example_value"],
domain_name="example.com")
pulumi.export("vpcDhcpOptionsSetId4", domain_name.sets[0].id)
status = alicloud.vpc.get_dhcp_options_sets(ids=["example_value"],
status="Available")
pulumi.export("vpcDhcpOptionsSetId5", status.sets[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Vpc.GetDhcpOptionsSets.Invoke(new()
{
Ids = new[]
{
"example_value",
},
});
var nameRegex = AliCloud.Vpc.GetDhcpOptionsSets.Invoke(new()
{
NameRegex = "^my-DhcpOptionsSet",
});
var dhcpOptionsSetName = AliCloud.Vpc.GetDhcpOptionsSets.Invoke(new()
{
DhcpOptionsSetName = "my-DhcpOptionsSet",
});
var domainName = AliCloud.Vpc.GetDhcpOptionsSets.Invoke(new()
{
Ids = new[]
{
"example_value",
},
DomainName = "example.com",
});
var status = AliCloud.Vpc.GetDhcpOptionsSets.Invoke(new()
{
Ids = new[]
{
"example_value",
},
Status = "Available",
});
return new Dictionary<string, object?>
{
["vpcDhcpOptionsSetId1"] = ids&#46;Apply(getDhcpOptionsSetsResult => getDhcpOptionsSetsResult&#46;Sets[0]?.Id),
["vpcDhcpOptionsSetId2"] = nameRegex&#46;Apply(getDhcpOptionsSetsResult => getDhcpOptionsSetsResult&#46;Sets[0]?.Id),
["vpcDhcpOptionsSetId3"] = dhcpOptionsSetName&#46;Apply(getDhcpOptionsSetsResult => getDhcpOptionsSetsResult&#46;Sets[0]?.Id),
["vpcDhcpOptionsSetId4"] = domainName&#46;Apply(getDhcpOptionsSetsResult => getDhcpOptionsSetsResult&#46;Sets[0]?.Id),
["vpcDhcpOptionsSetId5"] = status&#46;Apply(getDhcpOptionsSetsResult => getDhcpOptionsSetsResult&#46;Sets[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.GetDhcpOptionsSets(ctx, &vpc.GetDhcpOptionsSetsArgs{
Ids: []string{
"example_value",
},
}, nil)
if err != nil {
return err
}
ctx.Export("vpcDhcpOptionsSetId1", ids.Sets[0].Id)
nameRegex, err := vpc.GetDhcpOptionsSets(ctx, &vpc.GetDhcpOptionsSetsArgs{
NameRegex: pulumi.StringRef("^my-DhcpOptionsSet"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcDhcpOptionsSetId2", nameRegex.Sets[0].Id)
dhcpOptionsSetName, err := vpc.GetDhcpOptionsSets(ctx, &vpc.GetDhcpOptionsSetsArgs{
DhcpOptionsSetName: pulumi.StringRef("my-DhcpOptionsSet"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcDhcpOptionsSetId3", dhcpOptionsSetName.Sets[0].Id)
domainName, err := vpc.GetDhcpOptionsSets(ctx, &vpc.GetDhcpOptionsSetsArgs{
Ids: []string{
"example_value",
},
DomainName: pulumi.StringRef("example.com"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcDhcpOptionsSetId4", domainName.Sets[0].Id)
status, err := vpc.GetDhcpOptionsSets(ctx, &vpc.GetDhcpOptionsSetsArgs{
Ids: []string{
"example_value",
},
Status: pulumi.StringRef("Available"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcDhcpOptionsSetId5", status.Sets[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.GetDhcpOptionsSetsArgs;
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.getDhcpOptionsSets(GetDhcpOptionsSetsArgs.builder()
.ids("example_value")
.build());
ctx.export("vpcDhcpOptionsSetId1", ids.applyValue(getDhcpOptionsSetsResult -> getDhcpOptionsSetsResult.sets()[0].id()));
final var nameRegex = VpcFunctions.getDhcpOptionsSets(GetDhcpOptionsSetsArgs.builder()
.nameRegex("^my-DhcpOptionsSet")
.build());
ctx.export("vpcDhcpOptionsSetId2", nameRegex.applyValue(getDhcpOptionsSetsResult -> getDhcpOptionsSetsResult.sets()[0].id()));
final var dhcpOptionsSetName = VpcFunctions.getDhcpOptionsSets(GetDhcpOptionsSetsArgs.builder()
.dhcpOptionsSetName("my-DhcpOptionsSet")
.build());
ctx.export("vpcDhcpOptionsSetId3", dhcpOptionsSetName.applyValue(getDhcpOptionsSetsResult -> getDhcpOptionsSetsResult.sets()[0].id()));
final var domainName = VpcFunctions.getDhcpOptionsSets(GetDhcpOptionsSetsArgs.builder()
.ids("example_value")
.domainName("example.com")
.build());
ctx.export("vpcDhcpOptionsSetId4", domainName.applyValue(getDhcpOptionsSetsResult -> getDhcpOptionsSetsResult.sets()[0].id()));
final var status = VpcFunctions.getDhcpOptionsSets(GetDhcpOptionsSetsArgs.builder()
.ids("example_value")
.status("Available")
.build());
ctx.export("vpcDhcpOptionsSetId5", status.applyValue(getDhcpOptionsSetsResult -> getDhcpOptionsSetsResult.sets()[0].id()));
}
}
variables:
ids:
fn::invoke:
function: alicloud:vpc:getDhcpOptionsSets
arguments:
ids:
- example_value
nameRegex:
fn::invoke:
function: alicloud:vpc:getDhcpOptionsSets
arguments:
nameRegex: ^my-DhcpOptionsSet
dhcpOptionsSetName:
fn::invoke:
function: alicloud:vpc:getDhcpOptionsSets
arguments:
dhcpOptionsSetName: my-DhcpOptionsSet
domainName:
fn::invoke:
function: alicloud:vpc:getDhcpOptionsSets
arguments:
ids:
- example_value
domainName: example.com
status:
fn::invoke:
function: alicloud:vpc:getDhcpOptionsSets
arguments:
ids:
- example_value
status: Available
outputs:
vpcDhcpOptionsSetId1: ${ids.sets[0].id}
vpcDhcpOptionsSetId2: ${nameRegex.sets[0].id}
vpcDhcpOptionsSetId3: ${dhcpOptionsSetName.sets[0].id}
vpcDhcpOptionsSetId4: ${domainName.sets[0].id}
vpcDhcpOptionsSetId5: ${status.sets[0].id}

Return

A collection of values returned by getDhcpOptionsSets.

Parameters

argument

A collection of arguments for invoking getDhcpOptionsSets.


suspend fun getDhcpOptionsSets(dhcpOptionsSetName: String? = null, domainName: String? = null, ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, status: String? = null): GetDhcpOptionsSetsResult

Return

A collection of values returned by getDhcpOptionsSets.

Parameters

dhcpOptionsSetName

The name of the DHCP options set.The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or a Chinese character.

domainName

The root domain, for example, example.com. After a DHCP options set is associated with a Virtual Private Cloud (VPC) network, the root domain in the DHCP options set is automatically synchronized to the ECS instances in the VPC network.

ids

A list of Dhcp Options Set IDs.

nameRegex

A regex string to filter results by Dhcp Options Set name.

outputFile

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

status

The status of the DHCP options set. Valid values: Available, InUse or Pending. Available: The DHCP options set is available for use. InUse: The DHCP options set is in use. Pending: The DHCP options set is being configured.

See also


Return

A collection of values returned by getDhcpOptionsSets.

Parameters

argument

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

See also