terraform-provider-cloudns

command module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

README

OpenTofu/Terraform Provider ClouDNS

Requirements

  • Terraform >= 1.1.x (older versions may work but are entirely untested)
  • OpenTofu
  • Go >= 1.22
  • ClouDNS API credentials and a pre-existing DNS zone manageable by the user/sub-user associated with said credentials

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command:
$ go install

Adding Dependencies

This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency github.com/author/dependency to your OpenTofu/Terraform provider:

go get github.com/author/dependency
go mod tidy

Then commit the changes to go.mod and go.sum.

Using the provider

Ensure that you have an API user/sub-user on ClouDNS (requires a paid subscription with reseller access).

Note that using a sub-user which you delegate a specific zone to is a much safer approach and should always be your first choice

Once that is done, you must pre-create the zones you will want to manage on ClouDNS side (technically they are manageable through the API)

Import Records

Records can be imported using:

terraform import ADDR "zone/id"

Example record and its import command:

resource "cloudns_dns_record" "some-record" {
  # ID: 123456789
  # something.cloudns.net 600 in A 1.2.3.4
  name  = ""
  zone  = "something.cloudns.net"
  type  = "A"
  value = "1.2.3.4"
  ttl   = "600"
}
terraform import cloudns_dns_record.some-record "something.cloudns.net/123456789"
Import Zones

Zones can be imported using:

terraform import ADDR "domain"

Example zone and its import command:

resource "cloudns_dns_zone" "some-zone" {
  # example.com
  domain = "example.com"
  type   = "master"
}
terraform import cloudns_dns_zone.some-zone "example.com"
Import Failover

Failover can be imported using:

terraform import ADDR recordId

Example failover and its import command:

resource "cloudns_dns_failover" "testzone-bg-http" {
  #recordId = 123456789
  domain            = cloudns_dns_zone.sub-testzone-bg.domain
  recordid          = cloudns_dns_record.sub-testzone-bg-a["something"].id
  checktype         = "9"
  port              = "90"
  downeventhandler = "0"
  upeventhandler   = "0"
  mainip            = cloudns_dns_record.sub-testzone-bg-a["something"].value
  depends_on = [ cloudns_dns_zone.sub-testzone-bg ]
}
terraform import cloudns_dns_failover.testzone-bg-http 123456789

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL