Skip to content

Latest commit

 

History

History
89 lines (64 loc) · 2.19 KB

README.md

File metadata and controls

89 lines (64 loc) · 2.19 KB

NS1 Consul-Terraform-Sync Module

This project is in beta.


This terraform module leverages consul-terraform-sync to create, delete and update DNS records and zones on NS1 managed DNS and Enterprise DDI based on registered services on Consul.

Please find more information about setting up your environment with Consul Network Infrastructure Automation (NIA) within its Documentation Page.

Contents

  1. Requirements
  2. Notes
  3. Config

Requirements

Notes

The DNS zones and records are created based on the registered services on Consul.

The information used by the module are: meta.zone, meta.hostname and address.

The default zone value is in variable.tf and the default hostname is the service id on consul.

Here an example of service data with the required fields.

{
  "Name": "web",
  "Address": "192.168.1.10",
  "Meta": {
    "hostname": "ns1",
    "zone": "niaintegration.com"
  }
}

Config

consul-terraform-sync

## Global Config
log_level = "DEBUG"
port = 8558
syslog {}

buffer_period {
  enabled = true
  min = "5s"
  max = "20s"
}

# Consul Block
consul {
  address = "127.0.0.1:8500"
}

# Driver "terraform" block
driver "terraform" {
  log = false
  persist_log = false
  working_dir = ""
}

# Task Block
task {
 name           = "ns1-task"
 description    = "Create/delete/update DNS zones and records"
 source         = "github.com/ns1-terraform/terraform-ns1-record-sync-nia"
 services       = ["web", "api"]
 variable_files = ["/variable/file/with/api/key/terraform.tfvars"]
}