1. Packages
  2. DigitalOcean
  3. API Docs
  4. getDomain
DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi

digitalocean.getDomain

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi

    Get information on a domain. This data source provides the name, TTL, and zone file as configured on your DigitalOcean account. This is useful if the domain name in question is not managed by this provider or you need to utilize TTL or zone file data.

    An error is triggered if the provided domain name is not managed with your DigitalOcean account.

    Example Usage

    Get the zone file for a domain:

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const example = digitalocean.getDomain({
        name: "example.com",
    });
    export const domainOutput = example.then(example => example.zoneFile);
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.get_domain(name="example.com")
    pulumi.export("domainOutput", example.zone_file)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := digitalocean.LookupDomain(ctx, &digitalocean.LookupDomainArgs{
    			Name: "example.com",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("domainOutput", example.ZoneFile)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetDomain.Invoke(new()
        {
            Name = "example.com",
        });
    
        return new Dictionary<string, object?>
        {
            ["domainOutput"] = example.Apply(getDomainResult => getDomainResult.ZoneFile),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.inputs.GetDomainArgs;
    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 example = DigitaloceanFunctions.getDomain(GetDomainArgs.builder()
                .name("example.com")
                .build());
    
            ctx.export("domainOutput", example.applyValue(getDomainResult -> getDomainResult.zoneFile()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: digitalocean:getDomain
          Arguments:
            name: example.com
    outputs:
      domainOutput: ${example.zoneFile}
    
    
    data.digitalocean_domain.example: Refreshing state...
    
    Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
    
    Outputs:
    
    domain_output = $ORIGIN example.com.
    $TTL 1800
    example.com. IN SOA ns1.digitalocean.com. hostmaster.example.com. 1516944700 10800 3600 604800 1800
    example.com. 1800 IN NS ns1.digitalocean.com.
    example.com. 1800 IN NS ns2.digitalocean.com.
    example.com. 1800 IN NS ns3.digitalocean.com.
    www.example.com. 3600 IN A 176.107.155.137
    db.example.com. 3600 IN A 179.189.166.115
    jira.example.com. 3600 IN A 207.189.228.15
    

    Using getDomain

    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 getDomain(args: GetDomainArgs, opts?: InvokeOptions): Promise<GetDomainResult>
    function getDomainOutput(args: GetDomainOutputArgs, opts?: InvokeOptions): Output<GetDomainResult>
    def get_domain(name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetDomainResult
    def get_domain_output(name: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetDomainResult]
    func LookupDomain(ctx *Context, args *LookupDomainArgs, opts ...InvokeOption) (*LookupDomainResult, error)
    func LookupDomainOutput(ctx *Context, args *LookupDomainOutputArgs, opts ...InvokeOption) LookupDomainResultOutput

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

    public static class GetDomain 
    {
        public static Task<GetDomainResult> InvokeAsync(GetDomainArgs args, InvokeOptions? opts = null)
        public static Output<GetDomainResult> Invoke(GetDomainInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDomainResult> getDomain(GetDomainArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: digitalocean:index/getDomain:getDomain
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the domain.
    Name string
    The name of the domain.
    name String
    The name of the domain.
    name string
    The name of the domain.
    name str
    The name of the domain.
    name String
    The name of the domain.

    getDomain Result

    The following output properties are available:

    DomainUrn string
    The uniform resource name of the domain
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Ttl int
    The TTL of the domain.
    ZoneFile string
    The zone file of the domain.
    DomainUrn string
    The uniform resource name of the domain
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Ttl int
    The TTL of the domain.
    ZoneFile string
    The zone file of the domain.
    domainUrn String
    The uniform resource name of the domain
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    ttl Integer
    The TTL of the domain.
    zoneFile String
    The zone file of the domain.
    domainUrn string
    The uniform resource name of the domain
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    ttl number
    The TTL of the domain.
    zoneFile string
    The zone file of the domain.
    domain_urn str
    The uniform resource name of the domain
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    ttl int
    The TTL of the domain.
    zone_file str
    The zone file of the domain.
    domainUrn String
    The uniform resource name of the domain
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    ttl Number
    The TTL of the domain.
    zoneFile String
    The zone file of the domain.

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi