1. Packages
  2. Civo Provider
  3. API Docs
  4. getDnsDomainRecord
Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi

civo.getDnsDomainRecord

Explore with Pulumi AI

civo logo
Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi

    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);
    
    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)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-civo/sdk/v2/go/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
    	})
    }
    
    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),
        };
    });
    
    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()));
        }
    }
    
    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}
    

    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>
    def get_dns_domain_record(domain_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,
                              name: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetDnsDomainRecordResult]
    func LookupDnsDomainRecord(ctx *Context, args *LookupDnsDomainRecordArgs, opts ...InvokeOption) (*LookupDnsDomainRecordResult, error)
    func LookupDnsDomainRecordOutput(ctx *Context, args *LookupDnsDomainRecordOutputArgs, opts ...InvokeOption) LookupDnsDomainRecordResultOutput

    > 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)
    }
    public static CompletableFuture<GetDnsDomainRecordResult> getDnsDomainRecord(GetDnsDomainRecordArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: civo:index/getDnsDomainRecord:getDnsDomainRecord
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DomainId string
    The ID of the domain
    Name string
    The name of the record
    DomainId string
    The ID of the domain
    Name string
    The name of the record
    domainId String
    The ID of the domain
    name String
    The name of the record
    domainId string
    The ID of the domain
    name string
    The name of the record
    domain_id str
    The ID of the domain
    name str
    The name of the record
    domainId String
    The ID of the domain
    name String
    The name of the record

    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 provider-assigned unique ID for this managed resource.
    Name string
    The name of the record
    Priority int
    The priority of the record
    Ttl int
    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 provider-assigned unique ID for this managed resource.
    Name string
    The name of the record
    Priority int
    The priority of the record
    Ttl int
    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 provider-assigned unique ID for this managed resource.
    name String
    The name of the record
    priority Integer
    The priority of the record
    ttl Integer
    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 provider-assigned unique ID for this managed 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 provider-assigned unique ID for this managed resource.
    name str
    The name of the record
    priority int
    The priority of the record
    ttl int
    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 provider-assigned unique ID for this managed 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 pulumi/pulumi-civo
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the civo Terraform Provider.
    civo logo
    Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi