1. Packages
  2. Ucloud Provider
  3. API Docs
  4. getZones
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.getZones

Explore with Pulumi AI

ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

This data source provides a list of available zones in the current region.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as ucloud from "@pulumi/ucloud";

const example = ucloud.getZones({});
export const first = example.then(example => example.zones?.[0]?.id);
Copy
import pulumi
import pulumi_ucloud as ucloud

example = ucloud.get_zones()
pulumi.export("first", example.zones[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ucloud.GetZones(ctx, &ucloud.GetZonesArgs{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("first", example.Zones[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;

return await Deployment.RunAsync(() => 
{
    var example = Ucloud.GetZones.Invoke();

    return new Dictionary<string, object?>
    {
        ["first"] = example.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ucloud.UcloudFunctions;
import com.pulumi.ucloud.inputs.GetZonesArgs;
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 example = UcloudFunctions.getZones();

        ctx.export("first", example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ucloud:getZones
      arguments: {}
outputs:
  first: ${example.zones[0].id}
Copy

Using getZones

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 getZones(args: GetZonesArgs, opts?: InvokeOptions): Promise<GetZonesResult>
function getZonesOutput(args: GetZonesOutputArgs, opts?: InvokeOptions): Output<GetZonesResult>
Copy
def get_zones(id: Optional[str] = None,
              output_file: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetZonesResult
def get_zones_output(id: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetZonesResult]
Copy
func GetZones(ctx *Context, args *GetZonesArgs, opts ...InvokeOption) (*GetZonesResult, error)
func GetZonesOutput(ctx *Context, args *GetZonesOutputArgs, opts ...InvokeOption) GetZonesResultOutput
Copy

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

public static class GetZones 
{
    public static Task<GetZonesResult> InvokeAsync(GetZonesArgs args, InvokeOptions? opts = null)
    public static Output<GetZonesResult> Invoke(GetZonesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetZonesResult> getZones(GetZonesArgs args, InvokeOptions options)
public static Output<GetZonesResult> getZones(GetZonesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ucloud:index/getZones:getZones
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Id string
The ID of availability zone.
OutputFile string
File name where to save data source results (after running pulumi preview).
Id string
The ID of availability zone.
OutputFile string
File name where to save data source results (after running pulumi preview).
id String
The ID of availability zone.
outputFile String
File name where to save data source results (after running pulumi preview).
id string
The ID of availability zone.
outputFile string
File name where to save data source results (after running pulumi preview).
id str
The ID of availability zone.
output_file str
File name where to save data source results (after running pulumi preview).
id String
The ID of availability zone.
outputFile String
File name where to save data source results (after running pulumi preview).

getZones Result

The following output properties are available:

Id string
The ID of availability zone.
TotalCount double
Total number of zones that satisfy the condition.
Zones List<GetZonesZone>
It is a nested type which documented below.
OutputFile string
Id string
The ID of availability zone.
TotalCount float64
Total number of zones that satisfy the condition.
Zones []GetZonesZone
It is a nested type which documented below.
OutputFile string
id String
The ID of availability zone.
totalCount Double
Total number of zones that satisfy the condition.
zones List<GetZonesZone>
It is a nested type which documented below.
outputFile String
id string
The ID of availability zone.
totalCount number
Total number of zones that satisfy the condition.
zones GetZonesZone[]
It is a nested type which documented below.
outputFile string
id str
The ID of availability zone.
total_count float
Total number of zones that satisfy the condition.
zones Sequence[GetZonesZone]
It is a nested type which documented below.
output_file str
id String
The ID of availability zone.
totalCount Number
Total number of zones that satisfy the condition.
zones List<Property Map>
It is a nested type which documented below.
outputFile String

Supporting Types

GetZonesZone

Id This property is required. string
The ID of availability zone.
Id This property is required. string
The ID of availability zone.
id This property is required. String
The ID of availability zone.
id This property is required. string
The ID of availability zone.
id This property is required. str
The ID of availability zone.
id This property is required. String
The ID of availability zone.

Package Details

Repository
ucloud ucloud/terraform-provider-ucloud
License
Notes
This Pulumi package is based on the ucloud Terraform Provider.
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud