1. Packages
  2. Unifi
  3. API Docs
  4. dns
  5. getRecord
Viewing docs for Unifi v0.2.0
published on Tuesday, Feb 17, 2026 by Pulumiverse
unifi logo
Viewing docs for Unifi v0.2.0
published on Tuesday, Feb 17, 2026 by Pulumiverse

    Retrieves information about a specific DNS record configured in your UniFi network. This data source allows you to look up DNS records by either their name or record content. It’s particularly useful for validating existing DNS configurations or referencing DNS records in other resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as unifi from "@pulumiverse/unifi";
    
    const byName = unifi.dns.getRecord({
        name: "example.mydomain.com",
    });
    const byRecord = unifi.dns.getRecord({
        value: "192.168.0.1",
    });
    
    import pulumi
    import pulumi_unifi as unifi
    
    by_name = unifi.dns.get_record(name="example.mydomain.com")
    by_record = unifi.dns.get_record(value="192.168.0.1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi/dns"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := dns.LookupRecord(ctx, &dns.LookupRecordArgs{
    			Name: pulumi.StringRef("example.mydomain.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = dns.LookupRecord(ctx, &dns.LookupRecordArgs{
    			Value: pulumi.StringRef("192.168.0.1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Unifi = Pulumiverse.Unifi;
    
    return await Deployment.RunAsync(() => 
    {
        var byName = Unifi.Dns.GetRecord.Invoke(new()
        {
            Name = "example.mydomain.com",
        });
    
        var byRecord = Unifi.Dns.GetRecord.Invoke(new()
        {
            Value = "192.168.0.1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.unifi.dns.DnsFunctions;
    import com.pulumi.unifi.dns.inputs.GetRecordArgs;
    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 byName = DnsFunctions.getRecord(GetRecordArgs.builder()
                .name("example.mydomain.com")
                .build());
    
            final var byRecord = DnsFunctions.getRecord(GetRecordArgs.builder()
                .value("192.168.0.1")
                .build());
    
        }
    }
    
    variables:
      byName:
        fn::invoke:
          function: unifi:dns:getRecord
          arguments:
            name: example.mydomain.com
      byRecord:
        fn::invoke:
          function: unifi:dns:getRecord
          arguments:
            value: 192.168.0.1
    

    Using getRecord

    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 getRecord(args: GetRecordArgs, opts?: InvokeOptions): Promise<GetRecordResult>
    function getRecordOutput(args: GetRecordOutputArgs, opts?: InvokeOptions): Output<GetRecordResult>
    def get_record(name: Optional[str] = None,
                   site: Optional[str] = None,
                   value: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetRecordResult
    def get_record_output(name: Optional[pulumi.Input[str]] = None,
                   site: Optional[pulumi.Input[str]] = None,
                   value: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetRecordResult]
    func LookupRecord(ctx *Context, args *LookupRecordArgs, opts ...InvokeOption) (*LookupRecordResult, error)
    func LookupRecordOutput(ctx *Context, args *LookupRecordOutputArgs, opts ...InvokeOption) LookupRecordResultOutput

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

    public static class GetRecord 
    {
        public static Task<GetRecordResult> InvokeAsync(GetRecordArgs args, InvokeOptions? opts = null)
        public static Output<GetRecordResult> Invoke(GetRecordInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRecordResult> getRecord(GetRecordArgs args, InvokeOptions options)
    public static Output<GetRecordResult> getRecord(GetRecordArgs args, InvokeOptions options)
    
    fn::invoke:
      function: unifi:dns/getRecord:getRecord
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    DNS record name.
    Site string
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    Value string
    DNS record content.
    Name string
    DNS record name.
    Site string
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    Value string
    DNS record content.
    name String
    DNS record name.
    site String
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    value String
    DNS record content.
    name string
    DNS record name.
    site string
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    value string
    DNS record content.
    name str
    DNS record name.
    site str
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    value str
    DNS record content.
    name String
    DNS record name.
    site String
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    value String
    DNS record content.

    getRecord Result

    The following output properties are available:

    Enabled bool
    Whether the DNS record is enabled.
    Id string
    The unique identifier of this resource.
    Name string
    DNS record name.
    Port int
    The port of the DNS record.
    Priority int
    Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
    Site string
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    Ttl int
    Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
    Type string
    The type of the DNS record.
    Value string
    DNS record content.
    Weight int
    A numeric value indicating the relative weight of the record.
    Enabled bool
    Whether the DNS record is enabled.
    Id string
    The unique identifier of this resource.
    Name string
    DNS record name.
    Port int
    The port of the DNS record.
    Priority int
    Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
    Site string
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    Ttl int
    Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
    Type string
    The type of the DNS record.
    Value string
    DNS record content.
    Weight int
    A numeric value indicating the relative weight of the record.
    enabled Boolean
    Whether the DNS record is enabled.
    id String
    The unique identifier of this resource.
    name String
    DNS record name.
    port Integer
    The port of the DNS record.
    priority Integer
    Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
    site String
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    ttl Integer
    Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
    type String
    The type of the DNS record.
    value String
    DNS record content.
    weight Integer
    A numeric value indicating the relative weight of the record.
    enabled boolean
    Whether the DNS record is enabled.
    id string
    The unique identifier of this resource.
    name string
    DNS record name.
    port number
    The port of the DNS record.
    priority number
    Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
    site string
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    ttl number
    Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
    type string
    The type of the DNS record.
    value string
    DNS record content.
    weight number
    A numeric value indicating the relative weight of the record.
    enabled bool
    Whether the DNS record is enabled.
    id str
    The unique identifier of this resource.
    name str
    DNS record name.
    port int
    The port of the DNS record.
    priority int
    Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
    site str
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    ttl int
    Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
    type str
    The type of the DNS record.
    value str
    DNS record content.
    weight int
    A numeric value indicating the relative weight of the record.
    enabled Boolean
    Whether the DNS record is enabled.
    id String
    The unique identifier of this resource.
    name String
    DNS record name.
    port Number
    The port of the DNS record.
    priority Number
    Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
    site String
    The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    ttl Number
    Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
    type String
    The type of the DNS record.
    value String
    DNS record content.
    weight Number
    A numeric value indicating the relative weight of the record.

    Package Details

    Repository
    unifi pulumiverse/pulumi-unifi
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the unifi Terraform Provider.
    unifi logo
    Viewing docs for Unifi v0.2.0
    published on Tuesday, Feb 17, 2026 by Pulumiverse
      Try Pulumi Cloud free. Your team will thank you.