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

hcloud.getZone

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

    Provides details about a Hetzner Cloud Zone.

    For Internationalized domain names (IDN), see the provider::hcloud::idna function.

    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 byId = hcloud.getZone({
        id: 1234,
    });
    const byName = hcloud.getZone({
        name: "example.com",
    });
    const byLabel = hcloud.getZone({
        withSelector: "key=value",
    });
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    by_id = hcloud.get_zone(id=1234)
    by_name = hcloud.get_zone(name="example.com")
    by_label = hcloud.get_zone(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.LookupZone(ctx, &hcloud.LookupZoneArgs{
    			Id: pulumi.IntRef(1234),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.LookupZone(ctx, &hcloud.LookupZoneArgs{
    			Name: pulumi.StringRef("example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.LookupZone(ctx, &hcloud.LookupZoneArgs{
    			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 byId = HCloud.GetZone.Invoke(new()
        {
            Id = 1234,
        });
    
        var byName = HCloud.GetZone.Invoke(new()
        {
            Name = "example.com",
        });
    
        var byLabel = HCloud.GetZone.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.GetZoneArgs;
    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 byId = HcloudFunctions.getZone(GetZoneArgs.builder()
                .id(1234)
                .build());
    
            final var byName = HcloudFunctions.getZone(GetZoneArgs.builder()
                .name("example.com")
                .build());
    
            final var byLabel = HcloudFunctions.getZone(GetZoneArgs.builder()
                .withSelector("key=value")
                .build());
    
        }
    }
    
    variables:
      byId:
        fn::invoke:
          function: hcloud:getZone
          arguments:
            id: 1234
      byName:
        fn::invoke:
          function: hcloud:getZone
          arguments:
            name: example.com
      byLabel:
        fn::invoke:
          function: hcloud:getZone
          arguments:
            withSelector: key=value
    

    Using getZone

    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 getZone(args: GetZoneArgs, opts?: InvokeOptions): Promise<GetZoneResult>
    function getZoneOutput(args: GetZoneOutputArgs, opts?: InvokeOptions): Output<GetZoneResult>
    def get_zone(id: Optional[int] = None,
                 name: Optional[str] = None,
                 with_selector: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetZoneResult
    def get_zone_output(id: Optional[pulumi.Input[int]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 with_selector: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetZoneResult]
    func LookupZone(ctx *Context, args *LookupZoneArgs, opts ...InvokeOption) (*LookupZoneResult, error)
    func LookupZoneOutput(ctx *Context, args *LookupZoneOutputArgs, opts ...InvokeOption) LookupZoneResultOutput

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

    public static class GetZone 
    {
        public static Task<GetZoneResult> InvokeAsync(GetZoneArgs args, InvokeOptions? opts = null)
        public static Output<GetZoneResult> Invoke(GetZoneInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetZoneResult> getZone(GetZoneArgs args, InvokeOptions options)
    public static Output<GetZoneResult> getZone(GetZoneArgs args, InvokeOptions options)
    
    fn::invoke:
      function: hcloud:index/getZone:getZone
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id int
    ID of the Zone.
    Name string
    Name of the Zone.
    WithSelector string
    Filter results using a Label Selector.
    Id int
    ID of the Zone.
    Name string
    Name of the Zone.
    WithSelector string
    Filter results using a Label Selector.
    id Integer
    ID of the Zone.
    name String
    Name of the Zone.
    withSelector String
    Filter results using a Label Selector.
    id number
    ID of the Zone.
    name string
    Name of the Zone.
    withSelector string
    Filter results using a Label Selector.
    id int
    ID of the Zone.
    name str
    Name of the Zone.
    with_selector str
    Filter results using a Label Selector.
    id Number
    ID of the Zone.
    name String
    Name of the Zone.
    withSelector String
    Filter results using a Label Selector.

    getZone Result

    The following output properties are available:

    AuthoritativeNameservers Pulumi.HCloud.Outputs.GetZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    DeleteProtection bool
    Whether delete protection is enabled.
    Labels Dictionary<string, string>
    User-defined labels (key-value pairs) for the resource.
    Mode string
    Mode of the Zone.
    PrimaryNameservers List<Pulumi.HCloud.Outputs.GetZonePrimaryNameserver>
    Primary nameservers of the Zone.
    Registrar string
    Registrar of the Zone.
    Ttl int
    Default Time To Live (TTL) of the Zone.
    Id int
    ID of the Zone.
    Name string
    Name of the Zone.
    WithSelector string
    Filter results using a Label Selector.
    AuthoritativeNameservers GetZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    DeleteProtection bool
    Whether delete protection is enabled.
    Labels map[string]string
    User-defined labels (key-value pairs) for the resource.
    Mode string
    Mode of the Zone.
    PrimaryNameservers []GetZonePrimaryNameserver
    Primary nameservers of the Zone.
    Registrar string
    Registrar of the Zone.
    Ttl int
    Default Time To Live (TTL) of the Zone.
    Id int
    ID of the Zone.
    Name string
    Name of the Zone.
    WithSelector string
    Filter results using a Label Selector.
    authoritativeNameservers GetZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    deleteProtection Boolean
    Whether delete protection is enabled.
    labels Map<String,String>
    User-defined labels (key-value pairs) for the resource.
    mode String
    Mode of the Zone.
    primaryNameservers List<GetZonePrimaryNameserver>
    Primary nameservers of the Zone.
    registrar String
    Registrar of the Zone.
    ttl Integer
    Default Time To Live (TTL) of the Zone.
    id Integer
    ID of the Zone.
    name String
    Name of the Zone.
    withSelector String
    Filter results using a Label Selector.
    authoritativeNameservers GetZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    deleteProtection boolean
    Whether delete protection is enabled.
    labels {[key: string]: string}
    User-defined labels (key-value pairs) for the resource.
    mode string
    Mode of the Zone.
    primaryNameservers GetZonePrimaryNameserver[]
    Primary nameservers of the Zone.
    registrar string
    Registrar of the Zone.
    ttl number
    Default Time To Live (TTL) of the Zone.
    id number
    ID of the Zone.
    name string
    Name of the Zone.
    withSelector string
    Filter results using a Label Selector.
    authoritative_nameservers GetZoneAuthoritativeNameservers
    Authoritative nameservers of the Zone.
    delete_protection bool
    Whether delete protection is enabled.
    labels Mapping[str, str]
    User-defined labels (key-value pairs) for the resource.
    mode str
    Mode of the Zone.
    primary_nameservers Sequence[GetZonePrimaryNameserver]
    Primary nameservers of the Zone.
    registrar str
    Registrar of the Zone.
    ttl int
    Default Time To Live (TTL) of the Zone.
    id int
    ID of the Zone.
    name str
    Name of the Zone.
    with_selector str
    Filter results using a Label Selector.
    authoritativeNameservers Property Map
    Authoritative nameservers of the Zone.
    deleteProtection Boolean
    Whether delete protection is enabled.
    labels Map<String>
    User-defined labels (key-value pairs) for the resource.
    mode String
    Mode 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.
    id Number
    ID of the Zone.
    name String
    Name of the Zone.
    withSelector String
    Filter results using a Label Selector.

    Supporting Types

    GetZoneAuthoritativeNameservers

    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.

    GetZonePrimaryNameserver

    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