You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Thom May 890fa8227f
Merge pull request #37 from tiramiseb/readme-zone-data-source-example
4 years ago
.github/workflows separate release out and run it appropriately 4 years ago
gandi Reorder domain contacts to match variables 4 years ago
scripts Add: script and Makefile like others Terraform providers 5 years ago
.gitignore refactor build jobs 4 years ago
CHANGELOG.md Doc, license, etc, for release v1.0.0 6 years ago
GNUmakefile fmtcheck is not a dependency of build, it is a default 4 years ago
LICENSE Doc, license, etc, for release v1.0.0 6 years ago
README.md further fixes to the data example 4 years ago
go.mod save game 4 years ago
go.sum save game 4 years ago
main.go Update: migrate to Terraform plugin SDK 5 years ago

README.md

Terraform Gandi Provider

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!

Installation

make
mkdir -p ~/.terraform.d/plugins/
install -m 644 terraform-provider-gandi ~/.terraform.d/plugins/

Once installed, run terraform init to enable the Gandi plugin in your terraform environment.

See the Hashicorp Terraform documentation for further details.

Example

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).

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.

Zone data source

If your zone already exists (which is very likely), you may use it as a data source:

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"
  ]
}

Licensing

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.