Skip to content

Terraform module to create DNS zones and records on Digital Ocean DNS

License

Notifications You must be signed in to change notification settings

tonejito/terraform-digitalocean-dns

Repository files navigation

terraform-digitalocean-dns

Create DNS zones and records on Digital Ocean DNS.

  • Author: Andrés Hernández (tonejito)
  • Version: 0.2

Module Sources

Include this module in another terraform implementation

module "digitalocean-dns" {
  source = "git::https://github.com/tonejito/terraform-digitalocean-dns.git?ref=main"
}

Authentication

You need to create a Personal Access Token on the Digital Ocean control panel, and provide the token to the digitalocean_token variable.

Required modules

Input variables

Set the variables in the terraform.tfvars file (see the terraform.tfvars.example file for more info)

  • Digital Ocean API authentication token. Default not defined.
digitalocean_token = "dop_v1_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  • List of CSV files with the DNS records. Default [] (empty).
digitalocean_records_csv = [
    "records.csv",
  ]
  • The structure of the records.csv file is the following (see the records.csv.example file for more info)
domain,name,type,ttl,data,priority
example.net,@,A,60,127.0.0.1,0
example.net,@,AAAA,60,::1,0
example.net,www,CNAME,60,example.local.,0
example.net,@,MX,60,example.com.,1
example.net,@,TXT,60,Insert coin,0
  • List of DNS records. Default {} (empty).
digitalocean_records_list = {
  "example.com" = [
    {
      name = "@"
      type = "A"
      data = "127.0.0.1"
      ttl  = 60
    },
    {
      name = "@"
      type = "AAAA"
      data = "::1"
      ttl  = 60
    },
    {
      name = "www"
      type = "CNAME"
      data = "example.com."
      ttl  = 60
    },
    {
      name     = "@"
      type     = "MX"
      data     = "example.com."
      ttl      = 60
      priority = 1
    },
    {
      name = "@"
      type = "TXT"
      data = "Insert coin"
      ttl  = 60
    },
  ],
}

Module outputs


Releases

No releases published

Packages

No packages published

Languages