1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getZones
Hetzner Cloud v1.26.0 published on Wednesday, Nov 5, 2025 by Pulumi

hcloud.getZones

Start a Neo task
Explain and create a hcloud.getZones resource
hcloud logo
Hetzner Cloud v1.26.0 published on Wednesday, Nov 5, 2025 by Pulumi

    Provides a list of Hetzner Cloud Zone.

    See the Zones API documentation for more details.

    Experimental: DNS API is in beta, breaking changes may occur within minor releases. See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as hcloud from "@pulumi/hcloud";
    
    const all = hcloud.getZones({});
    const byLabel = hcloud.getZones({
        withSelector: "key=value",
    });
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    all = hcloud.get_zones()
    by_label = hcloud.get_zones(with_selector="key=value")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := hcloud.GetZones(ctx, &hcloud.GetZonesArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.GetZones(ctx, &hcloud.GetZonesArgs{
    			WithSelector: pulumi.StringRef("key=value"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using HCloud = Pulumi.HCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var all = HCloud.GetZones.Invoke();
    
        var byLabel = HCloud.GetZones.Invoke(new()
        {
            WithSelector = "key=value",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.hcloud.HcloudFunctions;
    import com.pulumi.hcloud.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 all = HcloudFunctions.getZones(GetZonesArgs.builder()
                .build());
    
            final var byLabel = HcloudFunctions.getZones(GetZonesArgs.builder()
                .withSelector("key=value")
                .build());
    
        }
    }
    
    variables:
      all:
        fn::invoke:
          function: hcloud:getZones
          arguments: {}
      byLabel:
        fn::invoke:
          function: hcloud:getZones
          arguments:
            withSelector: key=value
    

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

    > 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)
    }
    public static CompletableFuture<GetZonesResult> getZones(GetZonesArgs args, InvokeOptions options)
    public static Output<GetZonesResult> getZones(GetZonesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: hcloud:index/getZones:getZones
      arguments:
        # arguments dictionary

    The following arguments are supported:

    WithSelector string
    Filter results using a Label Selector
    WithSelector string
    Filter results using a Label Selector
    withSelector String
    Filter results using a Label Selector
    withSelector string
    Filter results using a Label Selector
    with_selector str
    Filter results using a Label Selector
    withSelector String
    Filter results using a Label Selector

    getZones Result

    The following output properties are available:

    Id string
    The ID of this resource.
    Zones List<Pulumi.HCloud.Outputs.GetZonesZone>
    WithSelector string
    Filter results using a Label Selector
    Id string
    The ID of this resource.
    Zones []GetZonesZone
    WithSelector string
    Filter results using a Label Selector
    id String
    The ID of this resource.
    zones List<GetZonesZone>
    withSelector String
    Filter results using a Label Selector
    id string
    The ID of this resource.
    zones GetZonesZone[]
    withSelector string
    Filter results using a Label Selector
    id str
    The ID of this resource.
    zones Sequence[GetZonesZone]
    with_selector str
    Filter results using a Label Selector
    id String
    The ID of this resource.
    zones List<Property Map>
    withSelector String
    Filter results using a Label Selector

    Supporting Types

    GetZonesZone

    AuthoritativeNameservers Pulumi.HCloud.Inputs.GetZonesZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    DeleteProtection bool
    Whether delete protection is enabled.
    Id int
    ID of the Zone.
    Labels Dictionary<string, string>
    User-defined labels (key-value pairs) for the resource.
    Mode string
    Mode of the Zone.
    Name string
    Name of the Zone.
    PrimaryNameservers List<Pulumi.HCloud.Inputs.GetZonesZonePrimaryNameserver>
    Primary nameservers of the Zone.
    Registrar string
    Registrar of the Zone.
    Ttl int
    Default Time To Live (TTL) of the Zone.
    AuthoritativeNameservers GetZonesZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    DeleteProtection bool
    Whether delete protection is enabled.
    Id int
    ID of the Zone.
    Labels map[string]string
    User-defined labels (key-value pairs) for the resource.
    Mode string
    Mode of the Zone.
    Name string
    Name of the Zone.
    PrimaryNameservers []GetZonesZonePrimaryNameserver
    Primary nameservers of the Zone.
    Registrar string
    Registrar of the Zone.
    Ttl int
    Default Time To Live (TTL) of the Zone.
    authoritativeNameservers GetZonesZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    deleteProtection Boolean
    Whether delete protection is enabled.
    id Integer
    ID of the Zone.
    labels Map<String,String>
    User-defined labels (key-value pairs) for the resource.
    mode String
    Mode of the Zone.
    name String
    Name of the Zone.
    primaryNameservers List<GetZonesZonePrimaryNameserver>
    Primary nameservers of the Zone.
    registrar String
    Registrar of the Zone.
    ttl Integer
    Default Time To Live (TTL) of the Zone.
    authoritativeNameservers GetZonesZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    deleteProtection boolean
    Whether delete protection is enabled.
    id number
    ID of the Zone.
    labels {[key: string]: string}
    User-defined labels (key-value pairs) for the resource.
    mode string
    Mode of the Zone.
    name string
    Name of the Zone.
    primaryNameservers GetZonesZonePrimaryNameserver[]
    Primary nameservers of the Zone.
    registrar string
    Registrar of the Zone.
    ttl number
    Default Time To Live (TTL) of the Zone.
    authoritative_nameservers GetZonesZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    delete_protection bool
    Whether delete protection is enabled.
    id int
    ID of the Zone.
    labels Mapping[str, str]
    User-defined labels (key-value pairs) for the resource.
    mode str
    Mode of the Zone.
    name str
    Name of the Zone.
    primary_nameservers Sequence[GetZonesZonePrimaryNameserver]
    Primary nameservers of the Zone.
    registrar str
    Registrar of the Zone.
    ttl int
    Default Time To Live (TTL) of the Zone.
    authoritativeNameservers Property Map
    Authoritative nameservers of the Zone.
    deleteProtection Boolean
    Whether delete protection is enabled.
    id Number
    ID of the Zone.
    labels Map<String>
    User-defined labels (key-value pairs) for the resource.
    mode String
    Mode of the Zone.
    name String
    Name of the Zone.
    primaryNameservers List<Property Map>
    Primary nameservers of the Zone.
    registrar String
    Registrar of the Zone.
    ttl Number
    Default Time To Live (TTL) of the Zone.

    GetZonesZoneAuthoritativeNameservers

    Assigneds List<string>
    Authoritative Hetzner nameservers assigned to the Zone.
    Assigneds []string
    Authoritative Hetzner nameservers assigned to the Zone.
    assigneds List<String>
    Authoritative Hetzner nameservers assigned to the Zone.
    assigneds string[]
    Authoritative Hetzner nameservers assigned to the Zone.
    assigneds Sequence[str]
    Authoritative Hetzner nameservers assigned to the Zone.
    assigneds List<String>
    Authoritative Hetzner nameservers assigned to the Zone.

    GetZonesZonePrimaryNameserver

    Address string
    Public IPv4 or IPv6 address of the primary nameserver.
    Port int
    Port of the primary nameserver.
    TsigAlgorithm string
    Transaction signature (TSIG) algorithm used to generate the TSIG key.
    TsigKey string
    Transaction signature (TSIG) key
    Address string
    Public IPv4 or IPv6 address of the primary nameserver.
    Port int
    Port of the primary nameserver.
    TsigAlgorithm string
    Transaction signature (TSIG) algorithm used to generate the TSIG key.
    TsigKey string
    Transaction signature (TSIG) key
    address String
    Public IPv4 or IPv6 address of the primary nameserver.
    port Integer
    Port of the primary nameserver.
    tsigAlgorithm String
    Transaction signature (TSIG) algorithm used to generate the TSIG key.
    tsigKey String
    Transaction signature (TSIG) key
    address string
    Public IPv4 or IPv6 address of the primary nameserver.
    port number
    Port of the primary nameserver.
    tsigAlgorithm string
    Transaction signature (TSIG) algorithm used to generate the TSIG key.
    tsigKey string
    Transaction signature (TSIG) key
    address str
    Public IPv4 or IPv6 address of the primary nameserver.
    port int
    Port of the primary nameserver.
    tsig_algorithm str
    Transaction signature (TSIG) algorithm used to generate the TSIG key.
    tsig_key str
    Transaction signature (TSIG) key
    address String
    Public IPv4 or IPv6 address of the primary nameserver.
    port Number
    Port of the primary nameserver.
    tsigAlgorithm String
    Transaction signature (TSIG) algorithm used to generate the TSIG key.
    tsigKey String
    Transaction signature (TSIG) key

    Package Details

    Repository
    Hetzner Cloud pulumi/pulumi-hcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the hcloud Terraform Provider.
    hcloud logo
    Hetzner Cloud v1.26.0 published on Wednesday, Nov 5, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate