digitalocean.getDomains
Explore with Pulumi AI
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 filter
block with a key
string and values
list to filter domains. (This example
also uses the regular expression match_by
mode in order to match domains by suffix.)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const examples = digitalocean.getDomains({
filters: [{
key: "name",
values: ["example\\.com$"],
matchBy: "re",
}],
});
import pulumi
import pulumi_digitalocean as digitalocean
examples = digitalocean.get_domains(filters=[{
"key": "name",
"values": ["example\\.com$"],
"match_by": "re",
}])
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",
Values: []string{
"example\\.com$",
},
MatchBy: pulumi.StringRef("re"),
},
},
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var examples = DigitalOcean.GetDomains.Invoke(new()
{
Filters = new[]
{
new DigitalOcean.Inputs.GetDomainsFilterInputArgs
{
Key = "name",
Values = new[]
{
"example\\.com$",
},
MatchBy = "re",
},
},
});
});
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")
.values("example\\.com$")
.matchBy("re")
.build())
.build());
}
}
variables:
examples:
fn::invoke:
Function: digitalocean:getDomains
Arguments:
filters:
- key: name
values:
- example\.com$
matchBy: re
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.
Digital Ocean. Inputs. Get Domains Filter> - Filter the results.
The
filter
block is documented below. - Sorts
List<Pulumi.
Digital Ocean. Inputs. Get Domains Sort> - Sort the results.
The
sort
block is documented below.
- Filters
[]Get
Domains Filter - Filter the results.
The
filter
block is documented below. - Sorts
[]Get
Domains Sort - Sort the results.
The
sort
block is documented below.
- filters
List<Get
Domains Filter> - Filter the results.
The
filter
block is documented below. - sorts
List<Get
Domains Sort> - Sort the results.
The
sort
block is documented below.
- filters
Get
Domains Filter[] - Filter the results.
The
filter
block is documented below. - sorts
Get
Domains Sort[] - Sort the results.
The
sort
block is documented below.
- filters
Sequence[Get
Domains Filter] - Filter the results.
The
filter
block is documented below. - sorts
Sequence[Get
Domains Sort] - 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.
Digital Ocean. Outputs. Get Domains Domain> - A list of domains satisfying any
filter
andsort
criteria. Each domain has the following attributes: - Id string
- The provider-assigned unique ID for this managed resource.
- Filters
List<Pulumi.
Digital Ocean. Outputs. Get Domains Filter> - Sorts
List<Pulumi.
Digital Ocean. Outputs. Get Domains Sort>
- Domains
[]Get
Domains Domain - A list of domains satisfying any
filter
andsort
criteria. Each domain has the following attributes: - Id string
- The provider-assigned unique ID for this managed resource.
- Filters
[]Get
Domains Filter - Sorts
[]Get
Domains Sort
- domains
List<Get
Domains Domain> - A list of domains satisfying any
filter
andsort
criteria. Each domain has the following attributes: - id String
- The provider-assigned unique ID for this managed resource.
- filters
List<Get
Domains Filter> - sorts
List<Get
Domains Sort>
- domains
Get
Domains Domain[] - A list of domains satisfying any
filter
andsort
criteria. Each domain has the following attributes: - id string
- The provider-assigned unique ID for this managed resource.
- filters
Get
Domains Filter[] - sorts
Get
Domains Sort[]
- domains
Sequence[Get
Domains Domain] - A list of domains satisfying any
filter
andsort
criteria. Each domain has the following attributes: - id str
- The provider-assigned unique ID for this managed resource.
- filters
Sequence[Get
Domains Filter] - sorts
Sequence[Get
Domains Sort]
- domains List<Property Map>
- A list of domains satisfying any
filter
andsort
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
GetDomainsFilter
- Key string
- Filter the domains by this key. This may be one of
name
,urn
, andttl
. - Values List<string>
- A list of values to match against the
key
field. Only retrieves domains where thekey
field takes on one or more of the values provided here. - All bool
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- Key string
- Filter the domains by this key. This may be one of
name
,urn
, andttl
. - Values []string
- A list of values to match against the
key
field. Only retrieves domains where thekey
field takes on one or more of the values provided here. - All bool
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key String
- Filter the domains by this key. This may be one of
name
,urn
, andttl
. - values List<String>
- A list of values to match against the
key
field. Only retrieves domains where thekey
field takes on one or more of the values provided here. - all Boolean
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key string
- Filter the domains by this key. This may be one of
name
,urn
, andttl
. - values string[]
- A list of values to match against the
key
field. Only retrieves domains where thekey
field takes on one or more of the values provided here. - all boolean
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key str
- Filter the domains by this key. This may be one of
name
,urn
, andttl
. - values Sequence[str]
- A list of values to match against the
key
field. Only retrieves domains where thekey
field takes on one or more of the values provided here. - all bool
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match_
by str - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key String
- Filter the domains by this key. This may be one of
name
,urn
, andttl
. - values List<String>
- A list of values to match against the
key
field. Only retrieves domains where thekey
field takes on one or more of the values provided here. - all Boolean
- Set to
true
to require that a field match all of thevalues
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 thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
GetDomainsSort
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.