A terraform provider for the Hetzner DNS API
Inspired by terraform-provider-hcloud
Get your API Token at https://dns.hetzner.com/settings/api-token
Add the provider configuration to your terraform.tf
terraform {
required_providers {
hdns = {
source = "danielr1996/hdns"
version = "1.0.2"
}
}
}
Add a provider block for hdns and add your token
provider "hdns" {
token = "<api-token>"
}
Add a data block to retrieve the zone id from its name
data "hdns_zone" "zone" {
name = "example.com"
}
Add a resource block for a dns record with the zone_id
from the previous data block
resource "hdns_record" "record" {
zone_id = data.hdns_zone.zone.id
type = "A"
name = "record.example.com"
value = "1.2.3.4"
}
terraform {
required_providers {
hdns = {
source = "danielr1996/hdns"
version = "1.0.2"
}
}
}
provider "hdns" {
token = "<api-token>"
}
data "hdns_zone" "zone" {
name = "example.com"
}
resource "hdns_record" "sample" {
zone_id = data.hdns_zone.zone.id
type = "A"
name = "record.example.com"
value = "1.2.3.4"
}