1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. pvtz
  5. getZones
Alibaba Cloud v3.79.0 published on Friday, May 30, 2025 by Pulumi

alicloud.pvtz.getZones

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.79.0 published on Friday, May 30, 2025 by Pulumi

    This data source provides the Private Zones of the current Alibaba Cloud user.

    NOTE: Available since v1.13.0.

    Example Usage

    Basic 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.com";
    const _default = new alicloud.pvtz.Zone("default", {zoneName: name});
    const ids = alicloud.pvtz.getZonesOutput({
        ids: [_default.id],
    });
    export const pvtzZonesId0 = ids.apply(ids => ids.zones?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example.com"
    default = alicloud.pvtz.Zone("default", zone_name=name)
    ids = alicloud.pvtz.get_zones_output(ids=[default.id])
    pulumi.export("pvtzZonesId0", ids.zones[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/pvtz"
    	"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.com"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := pvtz.NewZone(ctx, "default", &pvtz.ZoneArgs{
    			ZoneName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		ids := pvtz.GetZonesOutput(ctx, pvtz.GetZonesOutputArgs{
    			Ids: pulumi.StringArray{
    				_default.ID(),
    			},
    		}, nil)
    		ctx.Export("pvtzZonesId0", ids.ApplyT(func(ids pvtz.GetZonesResult) (*string, error) {
    			return &ids.Zones[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.com";
        var @default = new AliCloud.Pvtz.Zone("default", new()
        {
            ZoneName = name,
        });
    
        var ids = AliCloud.Pvtz.GetZones.Invoke(new()
        {
            Ids = new[]
            {
                @default.Id,
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["pvtzZonesId0"] = ids.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.pvtz.Zone;
    import com.pulumi.alicloud.pvtz.ZoneArgs;
    import com.pulumi.alicloud.pvtz.PvtzFunctions;
    import com.pulumi.alicloud.pvtz.inputs.GetZonesArgs;
    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.com");
            var default_ = new Zone("default", ZoneArgs.builder()
                .zoneName(name)
                .build());
    
            final var ids = PvtzFunctions.getZones(GetZonesArgs.builder()
                .ids(default_.id())
                .build());
    
            ctx.export("pvtzZonesId0", ids.applyValue(_ids -> _ids.zones()[0].id()));
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example.com
    resources:
      default:
        type: alicloud:pvtz:Zone
        properties:
          zoneName: ${name}
    variables:
      ids:
        fn::invoke:
          function: alicloud:pvtz:getZones
          arguments:
            ids:
              - ${default.id}
    outputs:
      pvtzZonesId0: ${ids.zones[0].id}
    

    Using getZones

    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 getZones(args: GetZonesArgs, opts?: InvokeOptions): Promise<GetZonesResult>
    function getZonesOutput(args: GetZonesOutputArgs, opts?: InvokeOptions): Output<GetZonesResult>
    def get_zones(enable_details: Optional[bool] = None,
                  ids: Optional[Sequence[str]] = None,
                  keyword: Optional[str] = None,
                  lang: Optional[str] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  query_region_id: Optional[str] = None,
                  query_vpc_id: Optional[str] = None,
                  resource_group_id: Optional[str] = None,
                  search_mode: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetZonesResult
    def get_zones_output(enable_details: Optional[pulumi.Input[bool]] = None,
                  ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  keyword: Optional[pulumi.Input[str]] = None,
                  lang: Optional[pulumi.Input[str]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  query_region_id: Optional[pulumi.Input[str]] = None,
                  query_vpc_id: Optional[pulumi.Input[str]] = None,
                  resource_group_id: Optional[pulumi.Input[str]] = None,
                  search_mode: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetZonesResult]
    func GetZones(ctx *Context, args *GetZonesArgs, opts ...InvokeOption) (*GetZonesResult, error)
    func GetZonesOutput(ctx *Context, args *GetZonesOutputArgs, opts ...InvokeOption) GetZonesResultOutput

    > Note: This function is named GetZones in the Go SDK.

    public static class GetZones 
    {
        public static Task<GetZonesResult> InvokeAsync(GetZonesArgs args, InvokeOptions? opts = null)
        public static Output<GetZonesResult> Invoke(GetZonesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetZonesResult> getZones(GetZonesArgs args, InvokeOptions options)
    public static Output<GetZonesResult> getZones(GetZonesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: alicloud:pvtz/getZones:getZones
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableDetails bool
    Whether to query the detailed list of resource attributes. Default value: false.
    Ids List<string>
    A list of Zones IDs.
    Keyword string
    The keyword of the zone name.
    Lang string
    The language of the response. Default value: en. Valid values: en, zh.
    NameRegex string
    A regex string to filter results by Zone name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    QueryRegionId string
    The region ID of the virtual private cloud (VPC) associated with the zone.
    QueryVpcId string
    The ID of the VPC associated with the zone.
    ResourceGroupId string
    The ID of the resource group to which the zone belongs.
    SearchMode string
    The search mode. The value of Keyword is the search scope. Default value: LIKE. Valid values:

    • LIKE: Fuzzy search.
    • EXACT: Exact search.
    EnableDetails bool
    Whether to query the detailed list of resource attributes. Default value: false.
    Ids []string
    A list of Zones IDs.
    Keyword string
    The keyword of the zone name.
    Lang string
    The language of the response. Default value: en. Valid values: en, zh.
    NameRegex string
    A regex string to filter results by Zone name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    QueryRegionId string
    The region ID of the virtual private cloud (VPC) associated with the zone.
    QueryVpcId string
    The ID of the VPC associated with the zone.
    ResourceGroupId string
    The ID of the resource group to which the zone belongs.
    SearchMode string
    The search mode. The value of Keyword is the search scope. Default value: LIKE. Valid values:

    • LIKE: Fuzzy search.
    • EXACT: Exact search.
    enableDetails Boolean
    Whether to query the detailed list of resource attributes. Default value: false.
    ids List<String>
    A list of Zones IDs.
    keyword String
    The keyword of the zone name.
    lang String
    The language of the response. Default value: en. Valid values: en, zh.
    nameRegex String
    A regex string to filter results by Zone name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    queryRegionId String
    The region ID of the virtual private cloud (VPC) associated with the zone.
    queryVpcId String
    The ID of the VPC associated with the zone.
    resourceGroupId String
    The ID of the resource group to which the zone belongs.
    searchMode String
    The search mode. The value of Keyword is the search scope. Default value: LIKE. Valid values:

    • LIKE: Fuzzy search.
    • EXACT: Exact search.
    enableDetails boolean
    Whether to query the detailed list of resource attributes. Default value: false.
    ids string[]
    A list of Zones IDs.
    keyword string
    The keyword of the zone name.
    lang string
    The language of the response. Default value: en. Valid values: en, zh.
    nameRegex string
    A regex string to filter results by Zone name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    queryRegionId string
    The region ID of the virtual private cloud (VPC) associated with the zone.
    queryVpcId string
    The ID of the VPC associated with the zone.
    resourceGroupId string
    The ID of the resource group to which the zone belongs.
    searchMode string
    The search mode. The value of Keyword is the search scope. Default value: LIKE. Valid values:

    • LIKE: Fuzzy search.
    • EXACT: Exact search.
    enable_details bool
    Whether to query the detailed list of resource attributes. Default value: false.
    ids Sequence[str]
    A list of Zones IDs.
    keyword str
    The keyword of the zone name.
    lang str
    The language of the response. Default value: en. Valid values: en, zh.
    name_regex str
    A regex string to filter results by Zone name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    query_region_id str
    The region ID of the virtual private cloud (VPC) associated with the zone.
    query_vpc_id str
    The ID of the VPC associated with the zone.
    resource_group_id str
    The ID of the resource group to which the zone belongs.
    search_mode str
    The search mode. The value of Keyword is the search scope. Default value: LIKE. Valid values:

    • LIKE: Fuzzy search.
    • EXACT: Exact search.
    enableDetails Boolean
    Whether to query the detailed list of resource attributes. Default value: false.
    ids List<String>
    A list of Zones IDs.
    keyword String
    The keyword of the zone name.
    lang String
    The language of the response. Default value: en. Valid values: en, zh.
    nameRegex String
    A regex string to filter results by Zone name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    queryRegionId String
    The region ID of the virtual private cloud (VPC) associated with the zone.
    queryVpcId String
    The ID of the VPC associated with the zone.
    resourceGroupId String
    The ID of the resource group to which the zone belongs.
    searchMode String
    The search mode. The value of Keyword is the search scope. Default value: LIKE. Valid values:

    • LIKE: Fuzzy search.
    • EXACT: Exact search.

    getZones Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    A list of Zone names.
    Zones List<Pulumi.AliCloud.Pvtz.Outputs.GetZonesZone>
    A list of Zone. Each element contains the following attributes:
    EnableDetails bool
    Keyword string
    Lang string
    NameRegex string
    OutputFile string
    QueryRegionId string
    QueryVpcId string
    ResourceGroupId string
    The ID of the resource group to which the zone belongs.
    SearchMode string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    A list of Zone names.
    Zones []GetZonesZone
    A list of Zone. Each element contains the following attributes:
    EnableDetails bool
    Keyword string
    Lang string
    NameRegex string
    OutputFile string
    QueryRegionId string
    QueryVpcId string
    ResourceGroupId string
    The ID of the resource group to which the zone belongs.
    SearchMode string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Zone names.
    zones List<GetZonesZone>
    A list of Zone. Each element contains the following attributes:
    enableDetails Boolean
    keyword String
    lang String
    nameRegex String
    outputFile String
    queryRegionId String
    queryVpcId String
    resourceGroupId String
    The ID of the resource group to which the zone belongs.
    searchMode String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    A list of Zone names.
    zones GetZonesZone[]
    A list of Zone. Each element contains the following attributes:
    enableDetails boolean
    keyword string
    lang string
    nameRegex string
    outputFile string
    queryRegionId string
    queryVpcId string
    resourceGroupId string
    The ID of the resource group to which the zone belongs.
    searchMode string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    A list of Zone names.
    zones Sequence[GetZonesZone]
    A list of Zone. Each element contains the following attributes:
    enable_details bool
    keyword str
    lang str
    name_regex str
    output_file str
    query_region_id str
    query_vpc_id str
    resource_group_id str
    The ID of the resource group to which the zone belongs.
    search_mode str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Zone names.
    zones List<Property Map>
    A list of Zone. Each element contains the following attributes:
    enableDetails Boolean
    keyword String
    lang String
    nameRegex String
    outputFile String
    queryRegionId String
    queryVpcId String
    resourceGroupId String
    The ID of the resource group to which the zone belongs.
    searchMode String

    Supporting Types

    GetZonesZone

    BindVpcs List<Pulumi.AliCloud.Pvtz.Inputs.GetZonesZoneBindVpc>
    The VPCs associated with the zone. Note: bind_vpcs takes effect only if enable_details is set to true.
    CreateTimestamp int
    The time when the zone was created.
    CreationTime string
    Id string
    The ID of the Private Zone.
    IsPtr bool
    Indicates whether the zone is a reverse lookup zone.
    Name string
    The Name of the Zone.
    ProxyPattern string
    Indicates whether the recursive resolution proxy for subdomain names is enabled.
    RecordCount int
    The number of Domain Name System (DNS) records added in the zone.
    Remark string
    The description of the zone.
    ResourceGroupId string
    The ID of the resource group to which the zone belongs.
    SlaveDns bool
    Indicates whether the secondary Domain Name System (DNS) feature is enabled for the zone. Note: slave_dns takes effect only if enable_details is set to true.
    UpdateTime string
    UpdateTimestamp int
    The time when the DNS record was updated.
    ZoneId string
    The ID of the Zone.
    ZoneName string
    The Name of the Private Zone.
    BindVpcs []GetZonesZoneBindVpc
    The VPCs associated with the zone. Note: bind_vpcs takes effect only if enable_details is set to true.
    CreateTimestamp int
    The time when the zone was created.
    CreationTime string
    Id string
    The ID of the Private Zone.
    IsPtr bool
    Indicates whether the zone is a reverse lookup zone.
    Name string
    The Name of the Zone.
    ProxyPattern string
    Indicates whether the recursive resolution proxy for subdomain names is enabled.
    RecordCount int
    The number of Domain Name System (DNS) records added in the zone.
    Remark string
    The description of the zone.
    ResourceGroupId string
    The ID of the resource group to which the zone belongs.
    SlaveDns bool
    Indicates whether the secondary Domain Name System (DNS) feature is enabled for the zone. Note: slave_dns takes effect only if enable_details is set to true.
    UpdateTime string
    UpdateTimestamp int
    The time when the DNS record was updated.
    ZoneId string
    The ID of the Zone.
    ZoneName string
    The Name of the Private Zone.
    bindVpcs List<GetZonesZoneBindVpc>
    The VPCs associated with the zone. Note: bind_vpcs takes effect only if enable_details is set to true.
    createTimestamp Integer
    The time when the zone was created.
    creationTime String
    id String
    The ID of the Private Zone.
    isPtr Boolean
    Indicates whether the zone is a reverse lookup zone.
    name String
    The Name of the Zone.
    proxyPattern String
    Indicates whether the recursive resolution proxy for subdomain names is enabled.
    recordCount Integer
    The number of Domain Name System (DNS) records added in the zone.
    remark String
    The description of the zone.
    resourceGroupId String
    The ID of the resource group to which the zone belongs.
    slaveDns Boolean
    Indicates whether the secondary Domain Name System (DNS) feature is enabled for the zone. Note: slave_dns takes effect only if enable_details is set to true.
    updateTime String
    updateTimestamp Integer
    The time when the DNS record was updated.
    zoneId String
    The ID of the Zone.
    zoneName String
    The Name of the Private Zone.
    bindVpcs GetZonesZoneBindVpc[]
    The VPCs associated with the zone. Note: bind_vpcs takes effect only if enable_details is set to true.
    createTimestamp number
    The time when the zone was created.
    creationTime string
    id string
    The ID of the Private Zone.
    isPtr boolean
    Indicates whether the zone is a reverse lookup zone.
    name string
    The Name of the Zone.
    proxyPattern string
    Indicates whether the recursive resolution proxy for subdomain names is enabled.
    recordCount number
    The number of Domain Name System (DNS) records added in the zone.
    remark string
    The description of the zone.
    resourceGroupId string
    The ID of the resource group to which the zone belongs.
    slaveDns boolean
    Indicates whether the secondary Domain Name System (DNS) feature is enabled for the zone. Note: slave_dns takes effect only if enable_details is set to true.
    updateTime string
    updateTimestamp number
    The time when the DNS record was updated.
    zoneId string
    The ID of the Zone.
    zoneName string
    The Name of the Private Zone.
    bind_vpcs Sequence[GetZonesZoneBindVpc]
    The VPCs associated with the zone. Note: bind_vpcs takes effect only if enable_details is set to true.
    create_timestamp int
    The time when the zone was created.
    creation_time str
    id str
    The ID of the Private Zone.
    is_ptr bool
    Indicates whether the zone is a reverse lookup zone.
    name str
    The Name of the Zone.
    proxy_pattern str
    Indicates whether the recursive resolution proxy for subdomain names is enabled.
    record_count int
    The number of Domain Name System (DNS) records added in the zone.
    remark str
    The description of the zone.
    resource_group_id str
    The ID of the resource group to which the zone belongs.
    slave_dns bool
    Indicates whether the secondary Domain Name System (DNS) feature is enabled for the zone. Note: slave_dns takes effect only if enable_details is set to true.
    update_time str
    update_timestamp int
    The time when the DNS record was updated.
    zone_id str
    The ID of the Zone.
    zone_name str
    The Name of the Private Zone.
    bindVpcs List<Property Map>
    The VPCs associated with the zone. Note: bind_vpcs takes effect only if enable_details is set to true.
    createTimestamp Number
    The time when the zone was created.
    creationTime String
    id String
    The ID of the Private Zone.
    isPtr Boolean
    Indicates whether the zone is a reverse lookup zone.
    name String
    The Name of the Zone.
    proxyPattern String
    Indicates whether the recursive resolution proxy for subdomain names is enabled.
    recordCount Number
    The number of Domain Name System (DNS) records added in the zone.
    remark String
    The description of the zone.
    resourceGroupId String
    The ID of the resource group to which the zone belongs.
    slaveDns Boolean
    Indicates whether the secondary Domain Name System (DNS) feature is enabled for the zone. Note: slave_dns takes effect only if enable_details is set to true.
    updateTime String
    updateTimestamp Number
    The time when the DNS record was updated.
    zoneId String
    The ID of the Zone.
    zoneName String
    The Name of the Private Zone.

    GetZonesZoneBindVpc

    RegionId string
    The region ID of the VPC.
    RegionName string
    The name of the region where the VPC resides.
    VpcId string
    The ID of the VPC.
    VpcName string
    The Name of the VPC.
    RegionId string
    The region ID of the VPC.
    RegionName string
    The name of the region where the VPC resides.
    VpcId string
    The ID of the VPC.
    VpcName string
    The Name of the VPC.
    regionId String
    The region ID of the VPC.
    regionName String
    The name of the region where the VPC resides.
    vpcId String
    The ID of the VPC.
    vpcName String
    The Name of the VPC.
    regionId string
    The region ID of the VPC.
    regionName string
    The name of the region where the VPC resides.
    vpcId string
    The ID of the VPC.
    vpcName string
    The Name of the VPC.
    region_id str
    The region ID of the VPC.
    region_name str
    The name of the region where the VPC resides.
    vpc_id str
    The ID of the VPC.
    vpc_name str
    The Name of the VPC.
    regionId String
    The region ID of the VPC.
    regionName String
    The name of the region where the VPC resides.
    vpcId String
    The ID of the VPC.
    vpcName String
    The Name of the VPC.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.79.0 published on Friday, May 30, 2025 by Pulumi