digitalocean.getRegions
Explore with Pulumi AI
Retrieve information about all supported DigitalOcean regions, with the ability to filter and sort the results. If no filters are specified, all regions will be returned.
Note: You can use the digitalocean.getRegion
data source
to obtain metadata about a single region if you already know the slug
to retrieve.
Example Usage
Use the filter
block with a key
string and values
list to filter regions.
For example to find all available regions:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const available = digitalocean.getRegions({
filters: [{
key: "available",
values: ["true"],
}],
});
import pulumi
import pulumi_digitalocean as digitalocean
available = digitalocean.get_regions(filters=[{
"key": "available",
"values": ["true"],
}])
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.GetRegions(ctx, &digitalocean.GetRegionsArgs{
Filters: []digitalocean.GetRegionsFilter{
{
Key: "available",
Values: []string{
"true",
},
},
},
}, 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 available = DigitalOcean.GetRegions.Invoke(new()
{
Filters = new[]
{
new DigitalOcean.Inputs.GetRegionsFilterInputArgs
{
Key = "available",
Values = new[]
{
"true",
},
},
},
});
});
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.GetRegionsArgs;
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 available = DigitaloceanFunctions.getRegions(GetRegionsArgs.builder()
.filters(GetRegionsFilterArgs.builder()
.key("available")
.values("true")
.build())
.build());
}
}
variables:
available:
fn::invoke:
Function: digitalocean:getRegions
Arguments:
filters:
- key: available
values:
- 'true'
You can filter on multiple fields and sort the results as well:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const available = digitalocean.getRegions({
filters: [
{
key: "available",
values: ["true"],
},
{
key: "features",
values: ["private_networking"],
},
],
sorts: [{
key: "name",
direction: "desc",
}],
});
import pulumi
import pulumi_digitalocean as digitalocean
available = digitalocean.get_regions(filters=[
{
"key": "available",
"values": ["true"],
},
{
"key": "features",
"values": ["private_networking"],
},
],
sorts=[{
"key": "name",
"direction": "desc",
}])
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.GetRegions(ctx, &digitalocean.GetRegionsArgs{
Filters: []digitalocean.GetRegionsFilter{
{
Key: "available",
Values: []string{
"true",
},
},
{
Key: "features",
Values: []string{
"private_networking",
},
},
},
Sorts: []digitalocean.GetRegionsSort{
{
Key: "name",
Direction: pulumi.StringRef("desc"),
},
},
}, 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 available = DigitalOcean.GetRegions.Invoke(new()
{
Filters = new[]
{
new DigitalOcean.Inputs.GetRegionsFilterInputArgs
{
Key = "available",
Values = new[]
{
"true",
},
},
new DigitalOcean.Inputs.GetRegionsFilterInputArgs
{
Key = "features",
Values = new[]
{
"private_networking",
},
},
},
Sorts = new[]
{
new DigitalOcean.Inputs.GetRegionsSortInputArgs
{
Key = "name",
Direction = "desc",
},
},
});
});
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.GetRegionsArgs;
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 available = DigitaloceanFunctions.getRegions(GetRegionsArgs.builder()
.filters(
GetRegionsFilterArgs.builder()
.key("available")
.values("true")
.build(),
GetRegionsFilterArgs.builder()
.key("features")
.values("private_networking")
.build())
.sorts(GetRegionsSortArgs.builder()
.key("name")
.direction("desc")
.build())
.build());
}
}
variables:
available:
fn::invoke:
Function: digitalocean:getRegions
Arguments:
filters:
- key: available
values:
- 'true'
- key: features
values:
- private_networking
sorts:
- key: name
direction: desc
Using getRegions
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 getRegions(args: GetRegionsArgs, opts?: InvokeOptions): Promise<GetRegionsResult>
function getRegionsOutput(args: GetRegionsOutputArgs, opts?: InvokeOptions): Output<GetRegionsResult>
def get_regions(filters: Optional[Sequence[GetRegionsFilter]] = None,
sorts: Optional[Sequence[GetRegionsSort]] = None,
opts: Optional[InvokeOptions] = None) -> GetRegionsResult
def get_regions_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetRegionsFilterArgs]]]] = None,
sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetRegionsSortArgs]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRegionsResult]
func GetRegions(ctx *Context, args *GetRegionsArgs, opts ...InvokeOption) (*GetRegionsResult, error)
func GetRegionsOutput(ctx *Context, args *GetRegionsOutputArgs, opts ...InvokeOption) GetRegionsResultOutput
> Note: This function is named GetRegions
in the Go SDK.
public static class GetRegions
{
public static Task<GetRegionsResult> InvokeAsync(GetRegionsArgs args, InvokeOptions? opts = null)
public static Output<GetRegionsResult> Invoke(GetRegionsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRegionsResult> getRegions(GetRegionsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: digitalocean:index/getRegions:getRegions
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Pulumi.
Digital Ocean. Inputs. Get Regions Filter> - Filter the results.
The
filter
block is documented below. - Sorts
List<Pulumi.
Digital Ocean. Inputs. Get Regions Sort> - Sort the results.
The
sort
block is documented below.
- Filters
[]Get
Regions Filter - Filter the results.
The
filter
block is documented below. - Sorts
[]Get
Regions Sort - Sort the results.
The
sort
block is documented below.
- filters
List<Get
Regions Filter> - Filter the results.
The
filter
block is documented below. - sorts
List<Get
Regions Sort> - Sort the results.
The
sort
block is documented below.
- filters
Get
Regions Filter[] - Filter the results.
The
filter
block is documented below. - sorts
Get
Regions Sort[] - Sort the results.
The
sort
block is documented below.
- filters
Sequence[Get
Regions Filter] - Filter the results.
The
filter
block is documented below. - sorts
Sequence[Get
Regions 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.
getRegions Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Regions
List<Pulumi.
Digital Ocean. Outputs. Get Regions Region> - A set of regions satisfying any
filter
andsort
criteria. Each region has the following attributes: - Filters
List<Pulumi.
Digital Ocean. Outputs. Get Regions Filter> - Sorts
List<Pulumi.
Digital Ocean. Outputs. Get Regions Sort>
- Id string
- The provider-assigned unique ID for this managed resource.
- Regions
[]Get
Regions Region - A set of regions satisfying any
filter
andsort
criteria. Each region has the following attributes: - Filters
[]Get
Regions Filter - Sorts
[]Get
Regions Sort
- id String
- The provider-assigned unique ID for this managed resource.
- regions
List<Get
Regions Region> - A set of regions satisfying any
filter
andsort
criteria. Each region has the following attributes: - filters
List<Get
Regions Filter> - sorts
List<Get
Regions Sort>
- id string
- The provider-assigned unique ID for this managed resource.
- regions
Get
Regions Region[] - A set of regions satisfying any
filter
andsort
criteria. Each region has the following attributes: - filters
Get
Regions Filter[] - sorts
Get
Regions Sort[]
- id str
- The provider-assigned unique ID for this managed resource.
- regions
Sequence[Get
Regions Region] - A set of regions satisfying any
filter
andsort
criteria. Each region has the following attributes: - filters
Sequence[Get
Regions Filter] - sorts
Sequence[Get
Regions Sort]
- id String
- The provider-assigned unique ID for this managed resource.
- regions List<Property Map>
- A set of regions satisfying any
filter
andsort
criteria. Each region has the following attributes: - filters List<Property Map>
- sorts List<Property Map>
Supporting Types
GetRegionsFilter
- Key string
- Filter the regions by this key. This may be one of
slug
,name
,available
,features
, orsizes
. - Values List<string>
- A list of values to match against the
key
field. Only retrieves regions 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 regions by this key. This may be one of
slug
,name
,available
,features
, orsizes
. - Values []string
- A list of values to match against the
key
field. Only retrieves regions 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 regions by this key. This may be one of
slug
,name
,available
,features
, orsizes
. - values List<String>
- A list of values to match against the
key
field. Only retrieves regions 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 regions by this key. This may be one of
slug
,name
,available
,features
, orsizes
. - values string[]
- A list of values to match against the
key
field. Only retrieves regions 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 regions by this key. This may be one of
slug
,name
,available
,features
, orsizes
. - values Sequence[str]
- A list of values to match against the
key
field. Only retrieves regions 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 regions by this key. This may be one of
slug
,name
,available
,features
, orsizes
. - values List<String>
- A list of values to match against the
key
field. Only retrieves regions 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.
GetRegionsRegion
- Available bool
- A boolean value that represents whether new Droplets can be created in this region.
- Features List<string>
- A set of features available in this region.
- Name string
- The display name of the region.
- Sizes List<string>
- A set of identifying slugs for the Droplet sizes available in this region.
- Slug string
- A human-readable string that is used as a unique identifier for each region.
- Available bool
- A boolean value that represents whether new Droplets can be created in this region.
- Features []string
- A set of features available in this region.
- Name string
- The display name of the region.
- Sizes []string
- A set of identifying slugs for the Droplet sizes available in this region.
- Slug string
- A human-readable string that is used as a unique identifier for each region.
- available Boolean
- A boolean value that represents whether new Droplets can be created in this region.
- features List<String>
- A set of features available in this region.
- name String
- The display name of the region.
- sizes List<String>
- A set of identifying slugs for the Droplet sizes available in this region.
- slug String
- A human-readable string that is used as a unique identifier for each region.
- available boolean
- A boolean value that represents whether new Droplets can be created in this region.
- features string[]
- A set of features available in this region.
- name string
- The display name of the region.
- sizes string[]
- A set of identifying slugs for the Droplet sizes available in this region.
- slug string
- A human-readable string that is used as a unique identifier for each region.
- available bool
- A boolean value that represents whether new Droplets can be created in this region.
- features Sequence[str]
- A set of features available in this region.
- name str
- The display name of the region.
- sizes Sequence[str]
- A set of identifying slugs for the Droplet sizes available in this region.
- slug str
- A human-readable string that is used as a unique identifier for each region.
- available Boolean
- A boolean value that represents whether new Droplets can be created in this region.
- features List<String>
- A set of features available in this region.
- name String
- The display name of the region.
- sizes List<String>
- A set of identifying slugs for the Droplet sizes available in this region.
- slug String
- A human-readable string that is used as a unique identifier for each region.
GetRegionsSort
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.