This provider supports managing DNS zones and managing the LiveDNS service in Gandi.
This provider currently doesn't support the Email, Organization or Billing APIs. We welcome pull requests to implement more functionality!
- Clone the repository
- Enter the repository directory
- Build the provider:
make
make install
Once installed, run terraform init
to enable the Gandi plugin in your terraform environment.
See the Hashicorp Terraform documentation for further details.
This example partly mimics the steps of the official LiveDNS documentation example, using the parts that have been implemented as Terraform resources. Note: sharing_id is optional. It is used e.g. when the API key is registered to a user, where the domain you want to manage is not registered with that user (but the user does have rights on that zone/organization).
terraform {
required_providers {
gandi = {
versions = ["2.0.0"]
source = "github/go-gandi/gandi"
}
}
}
provider "gandi" {
key = "<the API key>"
sharing_id = "<the sharing_id>"
}
resource "gandi_domain" "example_com" {
name = "example.com"
nameservers = gandi_livedns_domain.example_com.nameservers
}
resource "gandi_livedns_domain" "example_com" {
name = "example.com"
}
resource "gandi_livedns_record" "www_example_com" {
zone = "${gandi_livedns_domain.example_com.id}"
name = "www"
type = "A"
ttl = 3600
values = [
"192.168.0.1"
]
}
This example sums up the available resources.
If your zone already exists (which is very likely), you may use it as a data source:
terraform {
required_providers {
gandi = {
versions = ["2.0.0"]
source = "github/go-gandi/gandi"
}
}
}
provider "gandi" {
key = "<the API key>"
sharing_id = "<the sharing_id>"
}
data "gandi_domain" "example_com" {
name = "example.com"
}
resource "gandi_livedns_record" "www" {
zone = "${data.gandi_domain.example_com.id}"
name = "www"
type = "A"
ttl = 3600
values = [
"192.168.0.1"
]
}
This provider is distributed under the terms of the Mozilla Public License version 2.0. See the LICENSE
file.
Its main author is not affiliated in any way with Gandi - apart from being a happy customer of their services.
If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).
To compile the provider, run make
.
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 Terraform provider:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.