1. Packages
  2. Civo Provider
  3. API Docs
  4. getDnsDomainRecord
civo 1.1.5 published on Thursday, Feb 6, 2025 by civo

civo.getDnsDomainRecord

Explore with Pulumi AI

Get information on a DNS record. This data source provides the name, TTL, and zone file as configured on your Civo account.

An error will be raised if the provided domain name or record are not in your Civo account.

Example Usage

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

const domain = civo.getDnsDomainName({
    name: "domain.com",
});
const www = domain.then(domain => civo.getDnsDomainRecord({
    domainId: domain.id,
    name: "www",
}));
export const recordType = www.then(www => www.type);
export const recordTtl = www.then(www => www.ttl);
Copy
import pulumi
import pulumi_civo as civo

domain = civo.get_dns_domain_name(name="domain.com")
www = civo.get_dns_domain_record(domain_id=domain.id,
    name="www")
pulumi.export("recordType", www.type)
pulumi.export("recordTtl", www.ttl)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/civo/civo"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		domain, err := civo.LookupDnsDomainName(ctx, &civo.LookupDnsDomainNameArgs{
			Name: pulumi.StringRef("domain.com"),
		}, nil)
		if err != nil {
			return err
		}
		www, err := civo.LookupDnsDomainRecord(ctx, &civo.LookupDnsDomainRecordArgs{
			DomainId: domain.Id,
			Name:     "www",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("recordType", www.Type)
		ctx.Export("recordTtl", www.Ttl)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Civo = Pulumi.Civo;

return await Deployment.RunAsync(() => 
{
    var domain = Civo.GetDnsDomainName.Invoke(new()
    {
        Name = "domain.com",
    });

    var www = Civo.GetDnsDomainRecord.Invoke(new()
    {
        DomainId = domain.Apply(getDnsDomainNameResult => getDnsDomainNameResult.Id),
        Name = "www",
    });

    return new Dictionary<string, object?>
    {
        ["recordType"] = www.Apply(getDnsDomainRecordResult => getDnsDomainRecordResult.Type),
        ["recordTtl"] = www.Apply(getDnsDomainRecordResult => getDnsDomainRecordResult.Ttl),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.civo.CivoFunctions;
import com.pulumi.civo.inputs.GetDnsDomainNameArgs;
import com.pulumi.civo.inputs.GetDnsDomainRecordArgs;
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 domain = CivoFunctions.getDnsDomainName(GetDnsDomainNameArgs.builder()
            .name("domain.com")
            .build());

        final var www = CivoFunctions.getDnsDomainRecord(GetDnsDomainRecordArgs.builder()
            .domainId(domain.applyValue(getDnsDomainNameResult -> getDnsDomainNameResult.id()))
            .name("www")
            .build());

        ctx.export("recordType", www.applyValue(getDnsDomainRecordResult -> getDnsDomainRecordResult.type()));
        ctx.export("recordTtl", www.applyValue(getDnsDomainRecordResult -> getDnsDomainRecordResult.ttl()));
    }
}
Copy
variables:
  domain:
    fn::invoke:
      function: civo:getDnsDomainName
      arguments:
        name: domain.com
  www:
    fn::invoke:
      function: civo:getDnsDomainRecord
      arguments:
        domainId: ${domain.id}
        name: www
outputs:
  recordType: ${www.type}
  recordTtl: ${www.ttl}
Copy

Using getDnsDomainRecord

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 getDnsDomainRecord(args: GetDnsDomainRecordArgs, opts?: InvokeOptions): Promise<GetDnsDomainRecordResult>
function getDnsDomainRecordOutput(args: GetDnsDomainRecordOutputArgs, opts?: InvokeOptions): Output<GetDnsDomainRecordResult>
Copy
def get_dns_domain_record(domain_id: Optional[str] = None,
                          id: Optional[str] = None,
                          name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetDnsDomainRecordResult
def get_dns_domain_record_output(domain_id: Optional[pulumi.Input[str]] = None,
                          id: Optional[pulumi.Input[str]] = None,
                          name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetDnsDomainRecordResult]
Copy
func LookupDnsDomainRecord(ctx *Context, args *LookupDnsDomainRecordArgs, opts ...InvokeOption) (*LookupDnsDomainRecordResult, error)
func LookupDnsDomainRecordOutput(ctx *Context, args *LookupDnsDomainRecordOutputArgs, opts ...InvokeOption) LookupDnsDomainRecordResultOutput
Copy

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

public static class GetDnsDomainRecord 
{
    public static Task<GetDnsDomainRecordResult> InvokeAsync(GetDnsDomainRecordArgs args, InvokeOptions? opts = null)
    public static Output<GetDnsDomainRecordResult> Invoke(GetDnsDomainRecordInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDnsDomainRecordResult> getDnsDomainRecord(GetDnsDomainRecordArgs args, InvokeOptions options)
public static Output<GetDnsDomainRecordResult> getDnsDomainRecord(GetDnsDomainRecordArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: civo:index/getDnsDomainRecord:getDnsDomainRecord
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DomainId This property is required. string
The ID of the domain
Name This property is required. string
The name of the record
Id string
The ID of this resource.
DomainId This property is required. string
The ID of the domain
Name This property is required. string
The name of the record
Id string
The ID of this resource.
domainId This property is required. String
The ID of the domain
name This property is required. String
The name of the record
id String
The ID of this resource.
domainId This property is required. string
The ID of the domain
name This property is required. string
The name of the record
id string
The ID of this resource.
domain_id This property is required. str
The ID of the domain
name This property is required. str
The name of the record
id str
The ID of this resource.
domainId This property is required. String
The ID of the domain
name This property is required. String
The name of the record
id String
The ID of this resource.

getDnsDomainRecord Result

The following output properties are available:

AccountId string
The ID account of the domain
CreatedAt string
The date when it was created in UTC format
DomainId string
The ID of the domain
Id string
The ID of this resource.
Name string
The name of the record
Priority double
The priority of the record
Ttl double
How long caching DNS servers should cache this record
Type string
The choice of record type from A, CNAME, MX, SRV or TXT
UpdatedAt string
The date when it was updated in UTC format
Value string
The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record
AccountId string
The ID account of the domain
CreatedAt string
The date when it was created in UTC format
DomainId string
The ID of the domain
Id string
The ID of this resource.
Name string
The name of the record
Priority float64
The priority of the record
Ttl float64
How long caching DNS servers should cache this record
Type string
The choice of record type from A, CNAME, MX, SRV or TXT
UpdatedAt string
The date when it was updated in UTC format
Value string
The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record
accountId String
The ID account of the domain
createdAt String
The date when it was created in UTC format
domainId String
The ID of the domain
id String
The ID of this resource.
name String
The name of the record
priority Double
The priority of the record
ttl Double
How long caching DNS servers should cache this record
type String
The choice of record type from A, CNAME, MX, SRV or TXT
updatedAt String
The date when it was updated in UTC format
value String
The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record
accountId string
The ID account of the domain
createdAt string
The date when it was created in UTC format
domainId string
The ID of the domain
id string
The ID of this resource.
name string
The name of the record
priority number
The priority of the record
ttl number
How long caching DNS servers should cache this record
type string
The choice of record type from A, CNAME, MX, SRV or TXT
updatedAt string
The date when it was updated in UTC format
value string
The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record
account_id str
The ID account of the domain
created_at str
The date when it was created in UTC format
domain_id str
The ID of the domain
id str
The ID of this resource.
name str
The name of the record
priority float
The priority of the record
ttl float
How long caching DNS servers should cache this record
type str
The choice of record type from A, CNAME, MX, SRV or TXT
updated_at str
The date when it was updated in UTC format
value str
The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record
accountId String
The ID account of the domain
createdAt String
The date when it was created in UTC format
domainId String
The ID of the domain
id String
The ID of this resource.
name String
The name of the record
priority Number
The priority of the record
ttl Number
How long caching DNS servers should cache this record
type String
The choice of record type from A, CNAME, MX, SRV or TXT
updatedAt String
The date when it was updated in UTC format
value String
The IP address (A or MX), hostname (CNAME or MX) or text value (TXT) to serve for this record

Package Details

Repository
Civo civo/terraform-provider-civo
License
Notes
This Pulumi package is based on the civo Terraform Provider.