Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Latest commit

 

History

History
76 lines (64 loc) · 1.83 KB

README.md

File metadata and controls

76 lines (64 loc) · 1.83 KB

terraform-provider-hdns

Go Reference Go Report Card GitHub tag (latest SemVer) GitHub

A terraform provider for the Hetzner DNS API

Inspired by terraform-provider-hcloud

Usage

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"
}

Full example

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"
}