1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. dns
  5. getRecords
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.dns.getRecords

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides a list of DNS Domain Records in an Alibaba Cloud account according to the specified filters.

NOTE: Available since v1.0.0.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const recordsDs = alicloud.dns.getRecords({
    domainName: "xiaozhu.top",
    isLocked: false,
    type: "A",
    hostRecordRegex: "^@",
    outputFile: "records.txt",
});
export const firstRecordId = recordsDs.then(recordsDs => recordsDs.records?.[0]?.recordId);
Copy
import pulumi
import pulumi_alicloud as alicloud

records_ds = alicloud.dns.get_records(domain_name="xiaozhu.top",
    is_locked=False,
    type="A",
    host_record_regex="^@",
    output_file="records.txt")
pulumi.export("firstRecordId", records_ds.records[0].record_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dns"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		recordsDs, err := dns.GetRecords(ctx, &dns.GetRecordsArgs{
			DomainName:      "xiaozhu.top",
			IsLocked:        pulumi.BoolRef(false),
			Type:            pulumi.StringRef("A"),
			HostRecordRegex: pulumi.StringRef("^@"),
			OutputFile:      pulumi.StringRef("records.txt"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstRecordId", recordsDs.Records[0].RecordId)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var recordsDs = AliCloud.Dns.GetRecords.Invoke(new()
    {
        DomainName = "xiaozhu.top",
        IsLocked = false,
        Type = "A",
        HostRecordRegex = "^@",
        OutputFile = "records.txt",
    });

    return new Dictionary<string, object?>
    {
        ["firstRecordId"] = recordsDs.Apply(getRecordsResult => getRecordsResult.Records[0]?.RecordId),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.dns.DnsFunctions;
import com.pulumi.alicloud.dns.inputs.GetRecordsArgs;
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 recordsDs = DnsFunctions.getRecords(GetRecordsArgs.builder()
            .domainName("xiaozhu.top")
            .isLocked(false)
            .type("A")
            .hostRecordRegex("^@")
            .outputFile("records.txt")
            .build());

        ctx.export("firstRecordId", recordsDs.applyValue(getRecordsResult -> getRecordsResult.records()[0].recordId()));
    }
}
Copy
variables:
  recordsDs:
    fn::invoke:
      function: alicloud:dns:getRecords
      arguments:
        domainName: xiaozhu.top
        isLocked: false
        type: A
        hostRecordRegex: ^@
        outputFile: records.txt
outputs:
  firstRecordId: ${recordsDs.records[0].recordId}
Copy

Using getRecords

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 getRecords(args: GetRecordsArgs, opts?: InvokeOptions): Promise<GetRecordsResult>
function getRecordsOutput(args: GetRecordsOutputArgs, opts?: InvokeOptions): Output<GetRecordsResult>
Copy
def get_records(domain_name: Optional[str] = None,
                host_record_regex: Optional[str] = None,
                ids: Optional[Sequence[str]] = None,
                is_locked: Optional[bool] = None,
                line: Optional[str] = None,
                output_file: Optional[str] = None,
                status: Optional[str] = None,
                type: Optional[str] = None,
                value_regex: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetRecordsResult
def get_records_output(domain_name: Optional[pulumi.Input[str]] = None,
                host_record_regex: Optional[pulumi.Input[str]] = None,
                ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                is_locked: Optional[pulumi.Input[bool]] = None,
                line: Optional[pulumi.Input[str]] = None,
                output_file: Optional[pulumi.Input[str]] = None,
                status: Optional[pulumi.Input[str]] = None,
                type: Optional[pulumi.Input[str]] = None,
                value_regex: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetRecordsResult]
Copy
func GetRecords(ctx *Context, args *GetRecordsArgs, opts ...InvokeOption) (*GetRecordsResult, error)
func GetRecordsOutput(ctx *Context, args *GetRecordsOutputArgs, opts ...InvokeOption) GetRecordsResultOutput
Copy

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

public static class GetRecords 
{
    public static Task<GetRecordsResult> InvokeAsync(GetRecordsArgs args, InvokeOptions? opts = null)
    public static Output<GetRecordsResult> Invoke(GetRecordsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRecordsResult> getRecords(GetRecordsArgs args, InvokeOptions options)
public static Output<GetRecordsResult> getRecords(GetRecordsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:dns/getRecords:getRecords
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DomainName
This property is required.
Changes to this property will trigger replacement.
string
The domain name associated to the records.
HostRecordRegex Changes to this property will trigger replacement. string
Host record regex.
Ids List<string>
A list of record IDs.
IsLocked Changes to this property will trigger replacement. bool
Whether the record is locked or not.
Line Changes to this property will trigger replacement. string
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
Record status. Valid items are ENABLE and DISABLE.
Type Changes to this property will trigger replacement. string
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
ValueRegex Changes to this property will trigger replacement. string
Host record value regex.
DomainName
This property is required.
Changes to this property will trigger replacement.
string
The domain name associated to the records.
HostRecordRegex Changes to this property will trigger replacement. string
Host record regex.
Ids []string
A list of record IDs.
IsLocked Changes to this property will trigger replacement. bool
Whether the record is locked or not.
Line Changes to this property will trigger replacement. string
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
Record status. Valid items are ENABLE and DISABLE.
Type Changes to this property will trigger replacement. string
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
ValueRegex Changes to this property will trigger replacement. string
Host record value regex.
domainName
This property is required.
Changes to this property will trigger replacement.
String
The domain name associated to the records.
hostRecordRegex Changes to this property will trigger replacement. String
Host record regex.
ids List<String>
A list of record IDs.
isLocked Changes to this property will trigger replacement. Boolean
Whether the record is locked or not.
line Changes to this property will trigger replacement. String
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
Record status. Valid items are ENABLE and DISABLE.
type Changes to this property will trigger replacement. String
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
valueRegex Changes to this property will trigger replacement. String
Host record value regex.
domainName
This property is required.
Changes to this property will trigger replacement.
string
The domain name associated to the records.
hostRecordRegex Changes to this property will trigger replacement. string
Host record regex.
ids string[]
A list of record IDs.
isLocked Changes to this property will trigger replacement. boolean
Whether the record is locked or not.
line Changes to this property will trigger replacement. string
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
outputFile string
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. string
Record status. Valid items are ENABLE and DISABLE.
type Changes to this property will trigger replacement. string
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
valueRegex Changes to this property will trigger replacement. string
Host record value regex.
domain_name
This property is required.
Changes to this property will trigger replacement.
str
The domain name associated to the records.
host_record_regex Changes to this property will trigger replacement. str
Host record regex.
ids Sequence[str]
A list of record IDs.
is_locked Changes to this property will trigger replacement. bool
Whether the record is locked or not.
line Changes to this property will trigger replacement. str
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
output_file str
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. str
Record status. Valid items are ENABLE and DISABLE.
type Changes to this property will trigger replacement. str
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
value_regex Changes to this property will trigger replacement. str
Host record value regex.
domainName
This property is required.
Changes to this property will trigger replacement.
String
The domain name associated to the records.
hostRecordRegex Changes to this property will trigger replacement. String
Host record regex.
ids List<String>
A list of record IDs.
isLocked Changes to this property will trigger replacement. Boolean
Whether the record is locked or not.
line Changes to this property will trigger replacement. String
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
Record status. Valid items are ENABLE and DISABLE.
type Changes to this property will trigger replacement. String
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
valueRegex Changes to this property will trigger replacement. String
Host record value regex.

getRecords Result

The following output properties are available:

DomainName string
Name of the domain the record belongs to.
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
A list of record IDs.
Records List<Pulumi.AliCloud.Dns.Outputs.GetRecordsRecord>
A list of records. Each element contains the following attributes:
Urls List<string>
A list of entire URLs. Each item format as <host_record>.<domain_name>.
HostRecordRegex string
IsLocked bool
Line string
ISP line of the record.
OutputFile string
Status string
Status of the record.
Type string
Type of the record.
ValueRegex string
DomainName string
Name of the domain the record belongs to.
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
A list of record IDs.
Records []GetRecordsRecord
A list of records. Each element contains the following attributes:
Urls []string
A list of entire URLs. Each item format as <host_record>.<domain_name>.
HostRecordRegex string
IsLocked bool
Line string
ISP line of the record.
OutputFile string
Status string
Status of the record.
Type string
Type of the record.
ValueRegex string
domainName String
Name of the domain the record belongs to.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of record IDs.
records List<GetRecordsRecord>
A list of records. Each element contains the following attributes:
urls List<String>
A list of entire URLs. Each item format as <host_record>.<domain_name>.
hostRecordRegex String
isLocked Boolean
line String
ISP line of the record.
outputFile String
status String
Status of the record.
type String
Type of the record.
valueRegex String
domainName string
Name of the domain the record belongs to.
id string
The provider-assigned unique ID for this managed resource.
ids string[]
A list of record IDs.
records GetRecordsRecord[]
A list of records. Each element contains the following attributes:
urls string[]
A list of entire URLs. Each item format as <host_record>.<domain_name>.
hostRecordRegex string
isLocked boolean
line string
ISP line of the record.
outputFile string
status string
Status of the record.
type string
Type of the record.
valueRegex string
domain_name str
Name of the domain the record belongs to.
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
A list of record IDs.
records Sequence[GetRecordsRecord]
A list of records. Each element contains the following attributes:
urls Sequence[str]
A list of entire URLs. Each item format as <host_record>.<domain_name>.
host_record_regex str
is_locked bool
line str
ISP line of the record.
output_file str
status str
Status of the record.
type str
Type of the record.
value_regex str
domainName String
Name of the domain the record belongs to.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of record IDs.
records List<Property Map>
A list of records. Each element contains the following attributes:
urls List<String>
A list of entire URLs. Each item format as <host_record>.<domain_name>.
hostRecordRegex String
isLocked Boolean
line String
ISP line of the record.
outputFile String
status String
Status of the record.
type String
Type of the record.
valueRegex String

Supporting Types

GetRecordsRecord

DomainName This property is required. string
The domain name associated to the records.
HostRecord This property is required. string
Host record of the domain.
Line This property is required. string
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
Locked This property is required. bool
Indicates whether the record is locked.
Priority This property is required. int
Priority of the MX record.
RecordId This property is required. string
ID of the record.
Status This property is required. string
Record status. Valid items are ENABLE and DISABLE.
Ttl This property is required. double
TTL of the record.
Type This property is required. string
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
Value This property is required. string
Host record value of the domain.
DomainName This property is required. string
The domain name associated to the records.
HostRecord This property is required. string
Host record of the domain.
Line This property is required. string
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
Locked This property is required. bool
Indicates whether the record is locked.
Priority This property is required. int
Priority of the MX record.
RecordId This property is required. string
ID of the record.
Status This property is required. string
Record status. Valid items are ENABLE and DISABLE.
Ttl This property is required. float64
TTL of the record.
Type This property is required. string
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
Value This property is required. string
Host record value of the domain.
domainName This property is required. String
The domain name associated to the records.
hostRecord This property is required. String
Host record of the domain.
line This property is required. String
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
locked This property is required. Boolean
Indicates whether the record is locked.
priority This property is required. Integer
Priority of the MX record.
recordId This property is required. String
ID of the record.
status This property is required. String
Record status. Valid items are ENABLE and DISABLE.
ttl This property is required. Double
TTL of the record.
type This property is required. String
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
value This property is required. String
Host record value of the domain.
domainName This property is required. string
The domain name associated to the records.
hostRecord This property is required. string
Host record of the domain.
line This property is required. string
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
locked This property is required. boolean
Indicates whether the record is locked.
priority This property is required. number
Priority of the MX record.
recordId This property is required. string
ID of the record.
status This property is required. string
Record status. Valid items are ENABLE and DISABLE.
ttl This property is required. number
TTL of the record.
type This property is required. string
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
value This property is required. string
Host record value of the domain.
domain_name This property is required. str
The domain name associated to the records.
host_record This property is required. str
Host record of the domain.
line This property is required. str
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
locked This property is required. bool
Indicates whether the record is locked.
priority This property is required. int
Priority of the MX record.
record_id This property is required. str
ID of the record.
status This property is required. str
Record status. Valid items are ENABLE and DISABLE.
ttl This property is required. float
TTL of the record.
type This property is required. str
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
value This property is required. str
Host record value of the domain.
domainName This property is required. String
The domain name associated to the records.
hostRecord This property is required. String
Host record of the domain.
line This property is required. String
ISP line. Valid items are default, telecom, unicom, mobile, oversea, edu, drpeng, btvn, .etc. For checking all resolution lines enumeration please visit Alibaba Cloud DNS doc
locked This property is required. Boolean
Indicates whether the record is locked.
priority This property is required. Number
Priority of the MX record.
recordId This property is required. String
ID of the record.
status This property is required. String
Record status. Valid items are ENABLE and DISABLE.
ttl This property is required. Number
TTL of the record.
type This property is required. String
Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
value This property is required. String
Host record value of the domain.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi