All Projects → timohirt → terraform-provider-hetznerdns

timohirt / terraform-provider-hetznerdns

Licence: MPL-2.0 license
Terraform provider for Hetzner DNS

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to terraform-provider-hetznerdns

terraform-provider-ddcloud
Terraform provider for Dimension Data cloud compute.
Stars: ✭ 17 (-78.21%)
Mutual labels:  terraform-provider
terraform-provider-ad
Automates the Active Directory resource creation during Infrastructure build using Terraform Provider.
Stars: ✭ 64 (-17.95%)
Mutual labels:  terraform-provider
terraform-provider-vagrant
A Vagrant provider for terraform.
Stars: ✭ 43 (-44.87%)
Mutual labels:  terraform-provider
hetzner-rescaler
Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending
Stars: ✭ 44 (-43.59%)
Mutual labels:  hetzner
terraform-provider-aci
Terraform Cisco ACI provider
Stars: ✭ 68 (-12.82%)
Mutual labels:  terraform-provider
datadog-to-terraform
Converts Datadog resource JSON into Terraform alarm code.
Stars: ✭ 191 (+144.87%)
Mutual labels:  terraform-provider
terraform-provider-vmc
Terraform provider for VMware Cloud on AWS
Stars: ✭ 16 (-79.49%)
Mutual labels:  terraform-provider
terraform-provider-icinga2
Terraform Icinga2 provider
Stars: ✭ 13 (-83.33%)
Mutual labels:  terraform-provider
terraform-provider-nsx
A Terraform provider for VMware NSX.
Stars: ✭ 20 (-74.36%)
Mutual labels:  terraform-provider
terraform-provider-sumologic
This project is done. It has been integrated into https://github.com/SumoLogic/sumologic-terraform-provider
Stars: ✭ 13 (-83.33%)
Mutual labels:  terraform-provider
terraform-provider-algolia
Terraform Provider for Algolia
Stars: ✭ 27 (-65.38%)
Mutual labels:  terraform-provider
terraform-provider-sonarqube
Terraform provider for managing Sonarqube configuration
Stars: ✭ 26 (-66.67%)
Mutual labels:  terraform-provider
TerraformPluginDotNet
Write Terraform providers in C#.
Stars: ✭ 17 (-78.21%)
Mutual labels:  terraform-provider
terraform-provider-ansiblevault
Read ansible vault from Terraform
Stars: ✭ 70 (-10.26%)
Mutual labels:  terraform-provider
minectl
minectl 🗺 is a cli for creating Minecraft server on different cloud provider.
Stars: ✭ 85 (+8.97%)
Mutual labels:  hetzner
terraform-provider-ncloud
Terraform NaverCloud provider
Stars: ✭ 25 (-67.95%)
Mutual labels:  terraform-provider
terraform-provider-carvel
Carvel Terraform provider with resources for ytt and kapp to template and deploy to Kubernetes
Stars: ✭ 40 (-48.72%)
Mutual labels:  terraform-provider
terraform-provider-nomad
Terraform Nomad provider
Stars: ✭ 91 (+16.67%)
Mutual labels:  terraform-provider
terraform-provider-mssql
Terraform provider for Microsoft SQL Server
Stars: ✭ 18 (-76.92%)
Mutual labels:  terraform-provider
molecule-hetznercloud
Molecule Hetzner Cloud driver 💀
Stars: ✭ 21 (-73.08%)
Mutual labels:  hetzner

Terraform Provider for Hetzner DNS

CI Build GitHub release (latest by date) GitHub

Read about what I learnt while implementing this Terraform Provider.

This provider is on published on the Terraform registry.

You can find resources and data sources documentation there or here.

Requirements

  • Terraform > v1.0
  • Go 1.16 (to build the provider plugin)

Installing and Using this Plugin

You most likely want to download the provider from Terraform Registry. If you want or need to install the provider locally, take a look at INSTALL.

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 = "timohirt/hetznerdns"
      version = "2.1.0"
    }
  }
  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.hetznerdns_token
}

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 HETZNER_DNS_API_TOKEN env variable.

export HETZNER_DNS_API_TOKEN=<your api token>

The provider uses this token and you don't have to enter it anymore.

Example Usage

# Specify a zone for a domain (example.com)
resource "hetznerdns_zone" "example_com" {
  name = "example.com"
  ttl  = 60
}

# Handle root (example.com)
resource "hetznerdns_record" "example_com_root" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "@"
  value   = hcloud_server.server_name.ipv4_address
  type    = "A"
  # You only need to set a TTL if it's different from the zone's TTL above
  ttl     = 300
}

# Handle wildcard subdomain (*.example.com)
resource "hetznerdns_record" "all_example_com" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "*"
  value   = hcloud_server.server_name.ipv4_address
  type    = "A"
}

# Handle specific subdomain (books.example.com)
resource "hetznerdns_record" "books_example_com" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "books"
  value   = hcloud_server.server_name.ipv4_address
  type    = "A"
}

# Handle email (MX record with priority 10)
resource "hetznerdns_record" "example_com_email" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "@"
  value   = "10 mail.example.com"
  type    = "MX"
}

# SPF record
resource "hetznerdns_record" "example_com_spf" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "@"
  # The entire value needs to be enclosed in quotes in the zone file, if it contains a space or a quote. For Terraform, you need to escape these "inner" quotes:
  value   = "\"v=spf1 ip4:1.2.3.4 -all\""
  # Or let `jsonencode()` take care of the escaping:
  value   = jsonencode("v=spf1 ip4:1.2.3.4 -all")
  type    = "TXT"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].