Terraform provider for Hetzner DNS
Terraform Provider for Hetzner DNS (Deprecated)
[!CAUTION]
This provider is deprecated as of 10 Nov 2025.
Please migrate to the official Hetzner Cloud Terraform Provider
which now also supports managing DNS records since version 1.54.0.
You can find resources and data sources documentation there or here.
Requirements
- Terraform > v1.0
Installing and Using this Plugin
You most likely want to download the provider from Terraform Registry. The provider is also published in the OpenTofu Registry.
Migration Guide
If you previously used the timohirt/hetznerdns provider, you can easily replace the provider in your terraform state by following our migration guide in the provider documentation.
Using Provider from Terraform Registry (TF >= 1.0)
This provider is published and available there. If you want to use it, just add the following to your terraform.tf:
terraform {
required_providers {
hetznerdns = {
source = "germanbrew/hetznerdns"
version = "3.0.0" # Replace with latest version
}
}
required_version = ">= 1.0"
}
Then run terraform init to download the provider.
Authentication
Once installed, you have three options to provide the required API token that is used to authenticate at the Hetzner DNS API.
Enter API Token when needed
You can enter it every time you run terraform.
Configure the Provider to take the API Token from a Variable
Add the following to your terraform.tf:
variable "hetznerdns_token" {}
provider "hetznerdns" { apitoken = var.hetznerdnstoken }
Now, assign your API token to hetznerdns_token in terraform.tfvars:
hetznerdns_token = "kkd993i3kkmm4m4m4"
You don't have to enter the API token anymore.
Inject the API Token via the Environment
Assign the API token to HETZNERDNSTOKEN env variable.
export HETZNERDNSTOKEN=<your api token>
The provider uses this token, and you don't have to enter it anymore.
Credits
This project is a continuation of timohirt/terraform-provider-hetznerdns
Development
Requirements
- Go 1.21 (to build the provider plugin)
- golangci-lint (to lint code)
- terraform-plugin-docs (to generate registry documentation)
Install and update development tools
Run the following command
make install-devtools
Makefile Commands
Check the subcommands in our Makefile for useful dev tools and scripts.
Testing the provider locally
To test the provider locally:
- Build the provider binary with
make build - Create a new file
~/.terraform.rcand point the provider to the absolute directory path of the binary file:
provider_installation {
dev_overrides {
"germanbrew/hetznerdns" = "/path/to/your/terraform-provider-hetznerdns/bin/"
}
direct {}
}
- - Set the variable before running terraform commands:
TFCLICONFIG_FILE=~/.terraform.rc terraform plan
- Or set the env variable TFCLICONFIG_FILE and point it to ~/.terraform.rc: e.g.
export TFCLICONFIG_FILE=~/.terraform.rc`
- Now you can just use terraform normally. A warning will appear, that notifies you that you are using an provider override
Warning: Provider development overrides are in effect
...
- Unset the env variable if you don't want to use the local provider anymore:
unset TFCLICONFIG_FILE