Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.21.0 published on Tuesday, Jun 14, 2022 by Pulumi

getRegions

This data source provides Alibaba Cloud regions.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var currentRegionDs = Output.Create(AliCloud.GetRegions.InvokeAsync(new AliCloud.GetRegionsArgs
        {
            Current = true,
        }));
        this.CurrentRegionId = currentRegionDs.Apply(currentRegionDs => currentRegionDs.Regions?[0]?.Id);
    }

    [Output("currentRegionId")]
    public Output<string> CurrentRegionId { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		currentRegionDs, err := alicloud.GetRegions(ctx, &GetRegionsArgs{
			Current: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("currentRegionId", currentRegionDs.Regions[0].Id)
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

current_region_ds = alicloud.get_regions(current=True)
pulumi.export("currentRegionId", current_region_ds.regions[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const currentRegionDs = pulumi.output(alicloud.getRegions({
    current: true,
}));

export const currentRegionId = currentRegionDs.regions[0].id;

Coming soon!

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(current: Optional[bool] = None,
                name: Optional[str] = None,
                output_file: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetRegionsResult
def get_regions_output(current: Optional[pulumi.Input[bool]] = None,
                name: Optional[pulumi.Input[str]] = None,
                output_file: Optional[pulumi.Input[str]] = 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: alicloud:index/getRegions:getRegions
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Current bool

Set to true to match only the region configured in the provider.

Name string

The name of the region to select, such as eu-central-1.

OutputFile string
Current bool

Set to true to match only the region configured in the provider.

Name string

The name of the region to select, such as eu-central-1.

OutputFile string
current Boolean

Set to true to match only the region configured in the provider.

name String

The name of the region to select, such as eu-central-1.

outputFile String
current boolean

Set to true to match only the region configured in the provider.

name string

The name of the region to select, such as eu-central-1.

outputFile string
current bool

Set to true to match only the region configured in the provider.

name str

The name of the region to select, such as eu-central-1.

output_file str
current Boolean

Set to true to match only the region configured in the provider.

name String

The name of the region to select, such as eu-central-1.

outputFile String

getRegions Result

The following output properties are available:

Current bool
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of region IDs.

Name string
Regions List<Pulumi.AliCloud.Outputs.GetRegionsRegion>

A list of regions. Each element contains the following attributes:

OutputFile string
Current bool
Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of region IDs.

Name string
Regions []GetRegionsRegion

A list of regions. Each element contains the following attributes:

OutputFile string
current Boolean
id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of region IDs.

name String
regions List<GetRegionsRegion>

A list of regions. Each element contains the following attributes:

outputFile String
current boolean
id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of region IDs.

name string
regions GetRegionsRegion[]

A list of regions. Each element contains the following attributes:

outputFile string
current bool
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]

A list of region IDs.

name str
regions Sequence[GetRegionsRegion]

A list of regions. Each element contains the following attributes:

output_file str
current Boolean
id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of region IDs.

name String
regions List<Property Map>

A list of regions. Each element contains the following attributes:

outputFile String

Supporting Types

GetRegionsRegion

Id string

ID of the region.

LocalName string

Name of the region in the local language.

RegionId string
Id string

ID of the region.

LocalName string

Name of the region in the local language.

RegionId string
id String

ID of the region.

localName String

Name of the region in the local language.

regionId String
id string

ID of the region.

localName string

Name of the region in the local language.

regionId string
id str

ID of the region.

local_name str

Name of the region in the local language.

region_id str
id String

ID of the region.

localName String

Name of the region in the local language.

regionId String

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.