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)
public static Output<GetRegionsResult> getRegions(GetRegionsArgs args, InvokeOptions options)
fn::invoke:
  function: digitalocean:index/getRegions:getRegions
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<Pulumi.Digital Ocean. Inputs. Get Regions Filter> 
- Filter the results.
The filterblock is documented below.
- Sorts
List<Pulumi.Digital Ocean. Inputs. Get Regions Sort> 
- Sort the results.
The sortblock is documented below.
- Filters
[]GetRegions Filter 
- Filter the results.
The filterblock is documented below.
- Sorts
[]GetRegions Sort 
- Sort the results.
The sortblock is documented below.
- filters
List<GetRegions Filter> 
- Filter the results.
The filterblock is documented below.
- sorts
List<GetRegions Sort> 
- Sort the results.
The sortblock is documented below.
- filters
GetRegions Filter[] 
- Filter the results.
The filterblock is documented below.
- sorts
GetRegions Sort[] 
- Sort the results.
The sortblock is documented below.
- filters
Sequence[GetRegions Filter] 
- Filter the results.
The filterblock is documented below.
- sorts
Sequence[GetRegions Sort] 
- Sort the results.
The sortblock is documented below.
- filters List<Property Map>
- Filter the results.
The filterblock is documented below.
- sorts List<Property Map>
- Sort the results.
The sortblock 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 filterandsortcriteria. 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
[]GetRegions Region 
- A set of regions satisfying any filterandsortcriteria. Each region has the following attributes:
- Filters
[]GetRegions Filter 
- Sorts
[]GetRegions Sort 
- id String
- The provider-assigned unique ID for this managed resource.
- regions
List<GetRegions Region> 
- A set of regions satisfying any filterandsortcriteria. Each region has the following attributes:
- filters
List<GetRegions Filter> 
- sorts
List<GetRegions Sort> 
- id string
- The provider-assigned unique ID for this managed resource.
- regions
GetRegions Region[] 
- A set of regions satisfying any filterandsortcriteria. Each region has the following attributes:
- filters
GetRegions Filter[] 
- sorts
GetRegions Sort[] 
- id str
- The provider-assigned unique ID for this managed resource.
- regions
Sequence[GetRegions Region] 
- A set of regions satisfying any filterandsortcriteria. Each region has the following attributes:
- filters
Sequence[GetRegions Filter] 
- sorts
Sequence[GetRegions Sort] 
- id String
- The provider-assigned unique ID for this managed resource.
- regions List<Property Map>
- A set of regions satisfying any filterandsortcriteria. 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 keyfield. Only retrieves regions where thekeyfield takes on one or more of the values provided here.
- All bool
- Set to trueto require that a field match all of thevaluesinstead 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 thevaluesare present in the list or set.
- MatchBy string
- One of exact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas 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 keyfield. Only retrieves regions where thekeyfield takes on one or more of the values provided here.
- All bool
- Set to trueto require that a field match all of thevaluesinstead 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 thevaluesare present in the list or set.
- MatchBy string
- One of exact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas 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 keyfield. Only retrieves regions where thekeyfield takes on one or more of the values provided here.
- all Boolean
- Set to trueto require that a field match all of thevaluesinstead 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 thevaluesare present in the list or set.
- matchBy String
- One of exact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas 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 keyfield. Only retrieves regions where thekeyfield takes on one or more of the values provided here.
- all boolean
- Set to trueto require that a field match all of thevaluesinstead 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 thevaluesare present in the list or set.
- matchBy string
- One of exact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas 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 keyfield. Only retrieves regions where thekeyfield takes on one or more of the values provided here.
- all bool
- Set to trueto require that a field match all of thevaluesinstead 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 thevaluesare present in the list or set.
- match_by str
- One of exact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas 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 keyfield. Only retrieves regions where thekeyfield takes on one or more of the values provided here.
- all Boolean
- Set to trueto require that a field match all of thevaluesinstead 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 thevaluesare present in the list or set.
- matchBy String
- One of exact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas 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 digitaloceanTerraform Provider.