digitalocean logo
DigitalOcean v4.19.1, Mar 23 23

digitalocean.getDomains

Get information on domains for use in other resources, with the ability to filter and sort the results. If no filters are specified, all domains will be returned.

This data source is useful if the domains in question are not managed by this provider or you need to utilize any of the domains’ data.

Note: You can use the digitalocean.Domain data source to obtain metadata about a single domain if you already know the name.

Example Usage

Use the

using System.Collections.Generic;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var examples = DigitalOcean.GetDomains.Invoke(new()
    {
        Filters = new[]
        {
            new DigitalOcean.Inputs.GetDomainsFilterInputArgs
            {
                Key = "name",
                MatchBy = "re",
                Values = new[]
                {
                    "example\\.com$",
                },
            },
        },
    });

});
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 {
		_, err := digitalocean.GetDomains(ctx, &digitalocean.GetDomainsArgs{
			Filters: []digitalocean.GetDomainsFilter{
				{
					Key:     "name",
					MatchBy: pulumi.StringRef("re"),
					Values: []string{
						"example\\.com$",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
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.GetDomainsArgs;
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 examples = DigitaloceanFunctions.getDomains(GetDomainsArgs.builder()
            .filters(GetDomainsFilterArgs.builder()
                .key("name")
                .matchBy("re")
                .values("example\\.com$")
                .build())
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

examples = digitalocean.get_domains(filters=[digitalocean.GetDomainsFilterArgs(
    key="name",
    match_by="re",
    values=["example\\.com$"],
)])
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const examples = digitalocean.getDomains({
    filters: [{
        key: "name",
        matchBy: "re",
        values: ["example\\.com$"],
    }],
});
variables:
  examples:
    fn::invoke:
      Function: digitalocean:getDomains
      Arguments:
        filters:
          - key: name
            matchBy: re
            values:
              - example\.com$

Using getDomains

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 getDomains(args: GetDomainsArgs, opts?: InvokeOptions): Promise<GetDomainsResult>
function getDomainsOutput(args: GetDomainsOutputArgs, opts?: InvokeOptions): Output<GetDomainsResult>
def get_domains(filters: Optional[Sequence[GetDomainsFilter]] = None,
                sorts: Optional[Sequence[GetDomainsSort]] = None,
                opts: Optional[InvokeOptions] = None) -> GetDomainsResult
def get_domains_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetDomainsFilterArgs]]]] = None,
                sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetDomainsSortArgs]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetDomainsResult]
func GetDomains(ctx *Context, args *GetDomainsArgs, opts ...InvokeOption) (*GetDomainsResult, error)
func GetDomainsOutput(ctx *Context, args *GetDomainsOutputArgs, opts ...InvokeOption) GetDomainsResultOutput

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

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

The following arguments are supported:

Filters List<Pulumi.DigitalOcean.Inputs.GetDomainsFilter>

Filter the results. The filter block is documented below.

Sorts List<Pulumi.DigitalOcean.Inputs.GetDomainsSort>

Sort the results. The sort block is documented below.

Filters []GetDomainsFilter

Filter the results. The filter block is documented below.

Sorts []GetDomainsSort

Sort the results. The sort block is documented below.

filters List<GetDomainsFilter>

Filter the results. The filter block is documented below.

sorts List<GetDomainsSort>

Sort the results. The sort block is documented below.

filters GetDomainsFilter[]

Filter the results. The filter block is documented below.

sorts GetDomainsSort[]

Sort the results. The sort block is documented below.

filters Sequence[GetDomainsFilter]

Filter the results. The filter block is documented below.

sorts Sequence[GetDomainsSort]

Sort the results. The sort block is documented below.

filters List<Property Map>

Filter the results. The filter block is documented below.

sorts List<Property Map>

Sort the results. The sort block is documented below.

getDomains Result

The following output properties are available:

Domains List<Pulumi.DigitalOcean.Outputs.GetDomainsDomain>

A list of domains satisfying any filter and sort criteria. Each domain has the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Filters List<Pulumi.DigitalOcean.Outputs.GetDomainsFilter>
Sorts List<Pulumi.DigitalOcean.Outputs.GetDomainsSort>
Domains []GetDomainsDomain

A list of domains satisfying any filter and sort criteria. Each domain has the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Filters []GetDomainsFilter
Sorts []GetDomainsSort
domains List<GetDomainsDomain>

A list of domains satisfying any filter and sort criteria. Each domain has the following attributes:

id String

The provider-assigned unique ID for this managed resource.

filters List<GetDomainsFilter>
sorts List<GetDomainsSort>
domains GetDomainsDomain[]

A list of domains satisfying any filter and sort criteria. Each domain has the following attributes:

id string

The provider-assigned unique ID for this managed resource.

filters GetDomainsFilter[]
sorts GetDomainsSort[]
domains Sequence[GetDomainsDomain]

A list of domains satisfying any filter and sort criteria. Each domain has the following attributes:

id str

The provider-assigned unique ID for this managed resource.

filters Sequence[GetDomainsFilter]
sorts Sequence[GetDomainsSort]
domains List<Property Map>

A list of domains satisfying any filter and sort criteria. Each domain has the following attributes:

id String

The provider-assigned unique ID for this managed resource.

filters List<Property Map>
sorts List<Property Map>

Supporting Types

GetDomainsDomain

Name string

(Required) The name of the domain.

Ttl int

The TTL of the domain.

Urn string

The uniform resource name of the domain

Name string

(Required) The name of the domain.

Ttl int

The TTL of the domain.

Urn string

The uniform resource name of the domain

name String

(Required) The name of the domain.

ttl Integer

The TTL of the domain.

urn String

The uniform resource name of the domain

name string

(Required) The name of the domain.

ttl number

The TTL of the domain.

urn string

The uniform resource name of the domain

name str

(Required) The name of the domain.

ttl int

The TTL of the domain.

urn str

The uniform resource name of the domain

name String

(Required) The name of the domain.

ttl Number

The TTL of the domain.

urn String

The uniform resource name of the domain

GetDomainsFilter

Key string

Filter the domains by this key. This may be one of name, urn, and ttl.

Values List<string>

A list of values to match against the key field. Only retrieves domains where the key field takes on one or more of the values provided here.

All bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

MatchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

Key string

Filter the domains by this key. This may be one of name, urn, and ttl.

Values []string

A list of values to match against the key field. Only retrieves domains where the key field takes on one or more of the values provided here.

All bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

MatchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key String

Filter the domains by this key. This may be one of name, urn, and ttl.

values List<String>

A list of values to match against the key field. Only retrieves domains where the key field takes on one or more of the values provided here.

all Boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy String

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key string

Filter the domains by this key. This may be one of name, urn, and ttl.

values string[]

A list of values to match against the key field. Only retrieves domains where the key field takes on one or more of the values provided here.

all boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key str

Filter the domains by this key. This may be one of name, urn, and ttl.

values Sequence[str]

A list of values to match against the key field. Only retrieves domains where the key field takes on one or more of the values provided here.

all bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

match_by str

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key String

Filter the domains by this key. This may be one of name, urn, and ttl.

values List<String>

A list of values to match against the key field. Only retrieves domains where the key field takes on one or more of the values provided here.

all Boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy String

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

GetDomainsSort

Key string

Sort the domains by this key. This may be one of name, urn, and ttl.

Direction string

The sort direction. This may be either asc or desc.

Key string

Sort the domains by this key. This may be one of name, urn, and ttl.

Direction string

The sort direction. This may be either asc or desc.

key String

Sort the domains by this key. This may be one of name, urn, and ttl.

direction String

The sort direction. This may be either asc or desc.

key string

Sort the domains by this key. This may be one of name, urn, and ttl.

direction string

The sort direction. This may be either asc or desc.

key str

Sort the domains by this key. This may be one of name, urn, and ttl.

direction str

The sort direction. This may be either asc or desc.

key String

Sort the domains by this key. This may be one of name, urn, and ttl.

direction String

The sort direction. This may be either asc or desc.

Package Details

Repository
DigitalOcean pulumi/pulumi-digitalocean
License
Apache-2.0
Notes

This Pulumi package is based on the digitalocean Terraform Provider.