Alibaba Cloud v3.81.0 published on Monday, Jun 23, 2025 by Pulumi
alicloud.pvtz.getZoneRecords
Explore with Pulumi AI
This data source provides the Private Zone Records 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 defaultZoneRecord = new alicloud.pvtz.ZoneRecord("default", {
zoneId: _default.id,
rr: "www",
type: "MX",
value: name,
ttl: 60,
priority: 2,
remark: name,
});
const ids = alicloud.pvtz.getZoneRecordsOutput({
zoneId: defaultZoneRecord.zoneId,
ids: [defaultZoneRecord.recordId],
});
export const pvtzZoneRecordsId0 = ids.apply(ids => ids.records?.[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)
default_zone_record = alicloud.pvtz.ZoneRecord("default",
zone_id=default.id,
rr="www",
type="MX",
value=name,
ttl=60,
priority=2,
remark=name)
ids = alicloud.pvtz.get_zone_records_output(zone_id=default_zone_record.zone_id,
ids=[default_zone_record.record_id])
pulumi.export("pvtzZoneRecordsId0", ids.records[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
}
defaultZoneRecord, err := pvtz.NewZoneRecord(ctx, "default", &pvtz.ZoneRecordArgs{
ZoneId: _default.ID(),
Rr: pulumi.String("www"),
Type: pulumi.String("MX"),
Value: pulumi.String(name),
Ttl: pulumi.Int(60),
Priority: pulumi.Int(2),
Remark: pulumi.String(name),
})
if err != nil {
return err
}
ids := pvtz.GetZoneRecordsOutput(ctx, pvtz.GetZoneRecordsOutputArgs{
ZoneId: defaultZoneRecord.ZoneId,
Ids: pulumi.StringArray{
defaultZoneRecord.RecordId,
},
}, nil)
ctx.Export("pvtzZoneRecordsId0", ids.ApplyT(func(ids pvtz.GetZoneRecordsResult) (*string, error) {
return &ids.Records[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 defaultZoneRecord = new AliCloud.Pvtz.ZoneRecord("default", new()
{
ZoneId = @default.Id,
Rr = "www",
Type = "MX",
Value = name,
Ttl = 60,
Priority = 2,
Remark = name,
});
var ids = AliCloud.Pvtz.GetZoneRecords.Invoke(new()
{
ZoneId = defaultZoneRecord.ZoneId,
Ids = new[]
{
defaultZoneRecord.RecordId,
},
});
return new Dictionary<string, object?>
{
["pvtzZoneRecordsId0"] = ids.Apply(getZoneRecordsResult => getZoneRecordsResult.Records[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.ZoneRecord;
import com.pulumi.alicloud.pvtz.ZoneRecordArgs;
import com.pulumi.alicloud.pvtz.PvtzFunctions;
import com.pulumi.alicloud.pvtz.inputs.GetZoneRecordsArgs;
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());
var defaultZoneRecord = new ZoneRecord("defaultZoneRecord", ZoneRecordArgs.builder()
.zoneId(default_.id())
.rr("www")
.type("MX")
.value(name)
.ttl(60)
.priority(2)
.remark(name)
.build());
final var ids = PvtzFunctions.getZoneRecords(GetZoneRecordsArgs.builder()
.zoneId(defaultZoneRecord.zoneId())
.ids(defaultZoneRecord.recordId())
.build());
ctx.export("pvtzZoneRecordsId0", ids.applyValue(_ids -> _ids.records()[0].id()));
}
}
configuration:
name:
type: string
default: terraform-example.com
resources:
default:
type: alicloud:pvtz:Zone
properties:
zoneName: ${name}
defaultZoneRecord:
type: alicloud:pvtz:ZoneRecord
name: default
properties:
zoneId: ${default.id}
rr: www
type: MX
value: ${name}
ttl: '60'
priority: 2
remark: ${name}
variables:
ids:
fn::invoke:
function: alicloud:pvtz:getZoneRecords
arguments:
zoneId: ${defaultZoneRecord.zoneId}
ids:
- ${defaultZoneRecord.recordId}
outputs:
pvtzZoneRecordsId0: ${ids.records[0].id}
Using getZoneRecords
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 getZoneRecords(args: GetZoneRecordsArgs, opts?: InvokeOptions): Promise<GetZoneRecordsResult>
function getZoneRecordsOutput(args: GetZoneRecordsOutputArgs, opts?: InvokeOptions): Output<GetZoneRecordsResult>
def get_zone_records(ids: Optional[Sequence[str]] = None,
keyword: Optional[str] = None,
lang: Optional[str] = None,
output_file: Optional[str] = None,
search_mode: Optional[str] = None,
status: Optional[str] = None,
tag: Optional[str] = None,
user_client_ip: Optional[str] = None,
zone_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetZoneRecordsResult
def get_zone_records_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
keyword: Optional[pulumi.Input[str]] = None,
lang: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
search_mode: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
tag: Optional[pulumi.Input[str]] = None,
user_client_ip: Optional[pulumi.Input[str]] = None,
zone_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetZoneRecordsResult]
func GetZoneRecords(ctx *Context, args *GetZoneRecordsArgs, opts ...InvokeOption) (*GetZoneRecordsResult, error)
func GetZoneRecordsOutput(ctx *Context, args *GetZoneRecordsOutputArgs, opts ...InvokeOption) GetZoneRecordsResultOutput
> Note: This function is named GetZoneRecords
in the Go SDK.
public static class GetZoneRecords
{
public static Task<GetZoneRecordsResult> InvokeAsync(GetZoneRecordsArgs args, InvokeOptions? opts = null)
public static Output<GetZoneRecordsResult> Invoke(GetZoneRecordsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetZoneRecordsResult> getZoneRecords(GetZoneRecordsArgs args, InvokeOptions options)
public static Output<GetZoneRecordsResult> getZoneRecords(GetZoneRecordsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:pvtz/getZoneRecords:getZoneRecords
arguments:
# arguments dictionary
The following arguments are supported:
- Zone
Id string - The ID of the private zone.
- Ids List<string>
- A list of Private Zone Record IDs.
- Keyword string
- The keyword for record rr and value.
- Lang string
- The language of the response. Default value:
en
. Valid values:en
,zh
. - Output
File string - File name where to save data source results (after running
pulumi preview
). - Search
Mode string - The search mode. Default value:
EXACT
. Valid values:LIKE
: Fuzzy search.EXACT
: Exact search.
- Status string
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- Tag string
- The tag used to search for DNS records.
- User
Client stringIp - The IP address of the client.
- Zone
Id string - The ID of the private zone.
- Ids []string
- A list of Private Zone Record IDs.
- Keyword string
- The keyword for record rr and value.
- Lang string
- The language of the response. Default value:
en
. Valid values:en
,zh
. - Output
File string - File name where to save data source results (after running
pulumi preview
). - Search
Mode string - The search mode. Default value:
EXACT
. Valid values:LIKE
: Fuzzy search.EXACT
: Exact search.
- Status string
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- Tag string
- The tag used to search for DNS records.
- User
Client stringIp - The IP address of the client.
- zone
Id String - The ID of the private zone.
- ids List<String>
- A list of Private Zone Record IDs.
- keyword String
- The keyword for record rr and value.
- lang String
- The language of the response. Default value:
en
. Valid values:en
,zh
. - output
File String - File name where to save data source results (after running
pulumi preview
). - search
Mode String - The search mode. Default value:
EXACT
. Valid values:LIKE
: Fuzzy search.EXACT
: Exact search.
- status String
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- tag String
- The tag used to search for DNS records.
- user
Client StringIp - The IP address of the client.
- zone
Id string - The ID of the private zone.
- ids string[]
- A list of Private Zone Record IDs.
- keyword string
- The keyword for record rr and value.
- lang string
- The language of the response. Default value:
en
. Valid values:en
,zh
. - output
File string - File name where to save data source results (after running
pulumi preview
). - search
Mode string - The search mode. Default value:
EXACT
. Valid values:LIKE
: Fuzzy search.EXACT
: Exact search.
- status string
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- tag string
- The tag used to search for DNS records.
- user
Client stringIp - The IP address of the client.
- zone_
id str - The ID of the private zone.
- ids Sequence[str]
- A list of Private Zone Record IDs.
- keyword str
- The keyword for record rr and value.
- lang str
- The language of the response. Default value:
en
. Valid values:en
,zh
. - output_
file str - File name where to save data source results (after running
pulumi preview
). - search_
mode str - The search mode. Default value:
EXACT
. Valid values:LIKE
: Fuzzy search.EXACT
: Exact search.
- status str
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- tag str
- The tag used to search for DNS records.
- user_
client_ strip - The IP address of the client.
- zone
Id String - The ID of the private zone.
- ids List<String>
- A list of Private Zone Record IDs.
- keyword String
- The keyword for record rr and value.
- lang String
- The language of the response. Default value:
en
. Valid values:en
,zh
. - output
File String - File name where to save data source results (after running
pulumi preview
). - search
Mode String - The search mode. Default value:
EXACT
. Valid values:LIKE
: Fuzzy search.EXACT
: Exact search.
- status String
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- tag String
- The tag used to search for DNS records.
- user
Client StringIp - The IP address of the client.
getZoneRecords Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Records
List<Pulumi.
Ali Cloud. Pvtz. Outputs. Get Zone Records Record> - A list of Zone Record. Each element contains the following attributes:
- Zone
Id string - Keyword string
- Lang string
- Output
File string - Search
Mode string - Status string
- The state of the Private Zone Record.
- Tag string
- User
Client stringIp
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Records
[]Get
Zone Records Record - A list of Zone Record. Each element contains the following attributes:
- Zone
Id string - Keyword string
- Lang string
- Output
File string - Search
Mode string - Status string
- The state of the Private Zone Record.
- Tag string
- User
Client stringIp
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- records
List<Get
Zone Records Record> - A list of Zone Record. Each element contains the following attributes:
- zone
Id String - keyword String
- lang String
- output
File String - search
Mode String - status String
- The state of the Private Zone Record.
- tag String
- user
Client StringIp
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- records
Get
Zone Records Record[] - A list of Zone Record. Each element contains the following attributes:
- zone
Id string - keyword string
- lang string
- output
File string - search
Mode string - status string
- The state of the Private Zone Record.
- tag string
- user
Client stringIp
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- records
Sequence[Get
Zone Records Record] - A list of Zone Record. Each element contains the following attributes:
- zone_
id str - keyword str
- lang str
- output_
file str - search_
mode str - status str
- The state of the Private Zone Record.
- tag str
- user_
client_ strip
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- records List<Property Map>
- A list of Zone Record. Each element contains the following attributes:
- zone
Id String - keyword String
- lang String
- output
File String - search
Mode String - status String
- The state of the Private Zone Record.
- tag String
- user
Client StringIp
Supporting Types
GetZoneRecordsRecord
- Id string
- The ID of the Private Zone Record.
- Priority int
- The priority of the MX record.
- Record
Id string - The ID of the Record.
- Remark string
- The description of the Private Zone Record.
- Resource
Record string - The hostname of the Private Zone Record.
- Rr string
- The hostname of the Private Zone Record.
- Status string
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- Ttl int
- The time to live (TTL) of the Private Zone Record.
- Type string
- The type of the Private Zone Record.
- Value string
- The value of the Private Zone Record.
- Id string
- The ID of the Private Zone Record.
- Priority int
- The priority of the MX record.
- Record
Id string - The ID of the Record.
- Remark string
- The description of the Private Zone Record.
- Resource
Record string - The hostname of the Private Zone Record.
- Rr string
- The hostname of the Private Zone Record.
- Status string
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- Ttl int
- The time to live (TTL) of the Private Zone Record.
- Type string
- The type of the Private Zone Record.
- Value string
- The value of the Private Zone Record.
- id String
- The ID of the Private Zone Record.
- priority Integer
- The priority of the MX record.
- record
Id String - The ID of the Record.
- remark String
- The description of the Private Zone Record.
- resource
Record String - The hostname of the Private Zone Record.
- rr String
- The hostname of the Private Zone Record.
- status String
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- ttl Integer
- The time to live (TTL) of the Private Zone Record.
- type String
- The type of the Private Zone Record.
- value String
- The value of the Private Zone Record.
- id string
- The ID of the Private Zone Record.
- priority number
- The priority of the MX record.
- record
Id string - The ID of the Record.
- remark string
- The description of the Private Zone Record.
- resource
Record string - The hostname of the Private Zone Record.
- rr string
- The hostname of the Private Zone Record.
- status string
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- ttl number
- The time to live (TTL) of the Private Zone Record.
- type string
- The type of the Private Zone Record.
- value string
- The value of the Private Zone Record.
- id str
- The ID of the Private Zone Record.
- priority int
- The priority of the MX record.
- record_
id str - The ID of the Record.
- remark str
- The description of the Private Zone Record.
- resource_
record str - The hostname of the Private Zone Record.
- rr str
- The hostname of the Private Zone Record.
- status str
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- ttl int
- The time to live (TTL) of the Private Zone Record.
- type str
- The type of the Private Zone Record.
- value str
- The value of the Private Zone Record.
- id String
- The ID of the Private Zone Record.
- priority Number
- The priority of the MX record.
- record
Id String - The ID of the Record.
- remark String
- The description of the Private Zone Record.
- resource
Record String - The hostname of the Private Zone Record.
- rr String
- The hostname of the Private Zone Record.
- status String
- The status of the Resolve record. Valid values:
ENABLE
: Enable resolution.DISABLE
: Pause parsing.
- ttl Number
- The time to live (TTL) of the Private Zone Record.
- type String
- The type of the Private Zone Record.
- value String
- The value of the Private Zone Record.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.