hcloud.Zone
Provides a Hetzner Cloud Zone resource.
This can be used to create, modify, and delete Zones.
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.
Create Zone Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Zone(name: string, args: ZoneArgs, opts?: CustomResourceOptions);@overload
def Zone(resource_name: str,
args: ZoneArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Zone(resource_name: str,
opts: Optional[ResourceOptions] = None,
mode: Optional[str] = None,
delete_protection: Optional[bool] = None,
labels: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
primary_nameservers: Optional[Sequence[ZonePrimaryNameserverArgs]] = None,
ttl: Optional[int] = None)func NewZone(ctx *Context, name string, args ZoneArgs, opts ...ResourceOption) (*Zone, error)public Zone(string name, ZoneArgs args, CustomResourceOptions? opts = null)type: hcloud:Zone
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var zoneResource = new HCloud.Zone("zoneResource", new()
{
Mode = "string",
DeleteProtection = false,
Labels =
{
{ "string", "string" },
},
Name = "string",
PrimaryNameservers = new[]
{
new HCloud.Inputs.ZonePrimaryNameserverArgs
{
Address = "string",
Port = 0,
TsigAlgorithm = "string",
TsigKey = "string",
},
},
Ttl = 0,
});
example, err := hcloud.NewZone(ctx, "zoneResource", &hcloud.ZoneArgs{
Mode: pulumi.String("string"),
DeleteProtection: pulumi.Bool(false),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
PrimaryNameservers: hcloud.ZonePrimaryNameserverArray{
&hcloud.ZonePrimaryNameserverArgs{
Address: pulumi.String("string"),
Port: pulumi.Int(0),
TsigAlgorithm: pulumi.String("string"),
TsigKey: pulumi.String("string"),
},
},
Ttl: pulumi.Int(0),
})
var zoneResource = new Zone("zoneResource", ZoneArgs.builder()
.mode("string")
.deleteProtection(false)
.labels(Map.of("string", "string"))
.name("string")
.primaryNameservers(ZonePrimaryNameserverArgs.builder()
.address("string")
.port(0)
.tsigAlgorithm("string")
.tsigKey("string")
.build())
.ttl(0)
.build());
zone_resource = hcloud.Zone("zoneResource",
mode="string",
delete_protection=False,
labels={
"string": "string",
},
name="string",
primary_nameservers=[{
"address": "string",
"port": 0,
"tsig_algorithm": "string",
"tsig_key": "string",
}],
ttl=0)
const zoneResource = new hcloud.Zone("zoneResource", {
mode: "string",
deleteProtection: false,
labels: {
string: "string",
},
name: "string",
primaryNameservers: [{
address: "string",
port: 0,
tsigAlgorithm: "string",
tsigKey: "string",
}],
ttl: 0,
});
type: hcloud:Zone
properties:
deleteProtection: false
labels:
string: string
mode: string
name: string
primaryNameservers:
- address: string
port: 0
tsigAlgorithm: string
tsigKey: string
ttl: 0
Zone Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Zone resource accepts the following input properties:
- Mode string
- Mode of the Zone.
- Delete
Protection bool - Whether delete protection is enabled.
- Labels Dictionary<string, string>
- User-defined labels (key-value pairs) for the resource.
- Name string
- Name of the Zone.
- Primary
Nameservers List<Pulumi.HCloud. Inputs. Zone Primary Nameserver> - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- Ttl int
- Default Time To Live (TTL) of the Zone.
- Mode string
- Mode of the Zone.
- Delete
Protection bool - Whether delete protection is enabled.
- Labels map[string]string
- User-defined labels (key-value pairs) for the resource.
- Name string
- Name of the Zone.
- Primary
Nameservers []ZonePrimary Nameserver Args - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- Ttl int
- Default Time To Live (TTL) of the Zone.
- mode String
- Mode of the Zone.
- delete
Protection Boolean - Whether delete protection is enabled.
- labels Map<String,String>
- User-defined labels (key-value pairs) for the resource.
- name String
- Name of the Zone.
- primary
Nameservers List<ZonePrimary Nameserver> - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- ttl Integer
- Default Time To Live (TTL) of the Zone.
- mode string
- Mode of the Zone.
- delete
Protection boolean - Whether delete protection is enabled.
- labels {[key: string]: string}
- User-defined labels (key-value pairs) for the resource.
- name string
- Name of the Zone.
- primary
Nameservers ZonePrimary Nameserver[] - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- ttl number
- Default Time To Live (TTL) of the Zone.
- mode str
- Mode of the Zone.
- delete_
protection bool - Whether delete protection is enabled.
- labels Mapping[str, str]
- User-defined labels (key-value pairs) for the resource.
- name str
- Name of the Zone.
- primary_
nameservers Sequence[ZonePrimary Nameserver Args] - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- ttl int
- Default Time To Live (TTL) of the Zone.
- mode String
- Mode of the Zone.
- delete
Protection Boolean - Whether delete protection is enabled.
- labels Map<String>
- User-defined labels (key-value pairs) for the resource.
- name String
- Name of the Zone.
- primary
Nameservers List<Property Map> - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- ttl Number
- Default Time To Live (TTL) of the Zone.
Outputs
All input properties are implicitly available as output properties. Additionally, the Zone resource produces the following output properties:
-
Pulumi.
HCloud. Outputs. Zone Authoritative Nameservers - Authoritative nameservers of the Zone.
- Id string
- The provider-assigned unique ID for this managed resource.
- Registrar string
- Registrar of the Zone.
-
Zone
Authoritative Nameservers - Authoritative nameservers of the Zone.
- Id string
- The provider-assigned unique ID for this managed resource.
- Registrar string
- Registrar of the Zone.
-
Zone
Authoritative Nameservers - Authoritative nameservers of the Zone.
- id String
- The provider-assigned unique ID for this managed resource.
- registrar String
- Registrar of the Zone.
-
Zone
Authoritative Nameservers - Authoritative nameservers of the Zone.
- id string
- The provider-assigned unique ID for this managed resource.
- registrar string
- Registrar of the Zone.
-
Zone
Authoritative Nameservers - Authoritative nameservers of the Zone.
- id str
- The provider-assigned unique ID for this managed resource.
- registrar str
- Registrar of the Zone.
- Property Map
- Authoritative nameservers of the Zone.
- id String
- The provider-assigned unique ID for this managed resource.
- registrar String
- Registrar of the Zone.
Look up Existing Zone Resource
Get an existing Zone resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ZoneState, opts?: CustomResourceOptions): Zone@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
authoritative_nameservers: Optional[ZoneAuthoritativeNameserversArgs] = None,
delete_protection: Optional[bool] = None,
labels: Optional[Mapping[str, str]] = None,
mode: Optional[str] = None,
name: Optional[str] = None,
primary_nameservers: Optional[Sequence[ZonePrimaryNameserverArgs]] = None,
registrar: Optional[str] = None,
ttl: Optional[int] = None) -> Zonefunc GetZone(ctx *Context, name string, id IDInput, state *ZoneState, opts ...ResourceOption) (*Zone, error)public static Zone Get(string name, Input<string> id, ZoneState? state, CustomResourceOptions? opts = null)public static Zone get(String name, Output<String> id, ZoneState state, CustomResourceOptions options)resources: _: type: hcloud:Zone get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
-
Pulumi.
HCloud. Inputs. Zone Authoritative Nameservers - Authoritative nameservers of the Zone.
- Delete
Protection 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.
- Name string
- Name of the Zone.
- Primary
Nameservers List<Pulumi.HCloud. Inputs. Zone Primary Nameserver> - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- Registrar string
- Registrar of the Zone.
- Ttl int
- Default Time To Live (TTL) of the Zone.
-
Zone
Authoritative Nameservers Args - Authoritative nameservers of the Zone.
- Delete
Protection 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.
- Name string
- Name of the Zone.
- Primary
Nameservers []ZonePrimary Nameserver Args - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- Registrar string
- Registrar of the Zone.
- Ttl int
- Default Time To Live (TTL) of the Zone.
-
Zone
Authoritative Nameservers - Authoritative nameservers of the Zone.
- delete
Protection 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.
- name String
- Name of the Zone.
- primary
Nameservers List<ZonePrimary Nameserver> - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- registrar String
- Registrar of the Zone.
- ttl Integer
- Default Time To Live (TTL) of the Zone.
-
Zone
Authoritative Nameservers - Authoritative nameservers of the Zone.
- delete
Protection 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.
- name string
- Name of the Zone.
- primary
Nameservers ZonePrimary Nameserver[] - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- registrar string
- Registrar of the Zone.
- ttl number
- Default Time To Live (TTL) of the Zone.
-
Zone
Authoritative Nameservers Args - 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.
- name str
- Name of the Zone.
- primary_
nameservers Sequence[ZonePrimary Nameserver Args] - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- registrar str
- Registrar of the Zone.
- ttl int
- Default Time To Live (TTL) of the Zone.
- Property Map
- Authoritative nameservers of the Zone.
- delete
Protection Boolean - Whether delete protection is enabled.
- labels Map<String>
- User-defined labels (key-value pairs) for the resource.
- mode String
- Mode of the Zone.
- name String
- Name of the Zone.
- primary
Nameservers List<Property Map> - Primary nameservers of the Zone. Forbidden when mode is primary and required when mode is secondary.
- registrar String
- Registrar of the Zone.
- ttl Number
- Default Time To Live (TTL) of the Zone.
Supporting Types
ZoneAuthoritativeNameservers, ZoneAuthoritativeNameserversArgs
- 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.
ZonePrimaryNameserver, ZonePrimaryNameserverArgs
- Address string
- Public IPv4 or IPv6 address of the primary nameserver.
- Port int
- Port of the primary nameserver.
- Tsig
Algorithm string - Transaction signature (TSIG) algorithm used to generate the TSIG key.
- Tsig
Key string - Transaction signature (TSIG) key
- Address string
- Public IPv4 or IPv6 address of the primary nameserver.
- Port int
- Port of the primary nameserver.
- Tsig
Algorithm string - Transaction signature (TSIG) algorithm used to generate the TSIG key.
- Tsig
Key string - Transaction signature (TSIG) key
- address String
- Public IPv4 or IPv6 address of the primary nameserver.
- port Integer
- Port of the primary nameserver.
- tsig
Algorithm String - Transaction signature (TSIG) algorithm used to generate the TSIG key.
- tsig
Key String - Transaction signature (TSIG) key
- address string
- Public IPv4 or IPv6 address of the primary nameserver.
- port number
- Port of the primary nameserver.
- tsig
Algorithm string - Transaction signature (TSIG) algorithm used to generate the TSIG key.
- tsig
Key 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.
- tsig
Algorithm String - Transaction signature (TSIG) algorithm used to generate the TSIG key.
- tsig
Key String - Transaction signature (TSIG) key
Import
In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:
terraform
import {
to = hcloud_zone.example_primary
id = “$SSH_KEY_ID”
}
The pulumi import command can be used, for example:
$ pulumi import hcloud:index/zone:Zone example "$ZONE_ID_OR_NAME"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.
