CLI to read Gandi.net live DNS records and generate corresponding TF files
Project description
Generate Terraform file from Gandi DNS records
This tool aims to simplify managin DNS recods using Terrafom by making the initial import through a single operation. It fetches DNS records from one or multiple domains you own with Gandi.net and generates TF files with the corresponding records' resources.
Install
$ pip install gandi-2-terraform
$ gandi-2tf --help
Configuration
In order to access the DNS records through the API, you have to provide your API key. It uses the same variable name than the Gandi Terraform provider GANDI_KEY
. See Gandi authentication documentation of their API on how to generate one.
Example
$ export GANDI_KEY=A1b2C3d4E5f6
$ gandi-2tf --domain example.com
will generate a file example.com.tf
containing:
locals {
example_com_records = {
apex_a = {
name = "@"
type = "A"
ttl = 10800
values = [
"192.30.252.153",
"192.30.252.154",
]
}
apex_mx = {
name = "@"
type = "MX"
ttl = 10800
values = [
"10 spool.mail.gandi.net.",
"50 fb.mail.gandi.net.",
]
}
apex_txt = {
name = "@"
type = "TXT"
ttl = 10800
values = [
"\"v=spf1 include:_mailcust.gandi.net -all\"",
]
}
imap_cname = {
name = "imap"
type = "CNAME"
ttl = 10800
values = [
"access.mail.gandi.net.",
]
}
smtp_cname = {
name = "smtp"
type = "CNAME"
ttl = 10800
values = [
"relay.mail.gandi.net.",
]
}
webmail_cname = {
name = "webmail"
type = "CNAME"
ttl = 10800
values = [
"webmail.gandi.net.",
]
}
}
}
resource "gandi_livedns_record" "example_com" {
for_each = local.example_com_records
zone = "example.com"
name = each.value.name
ttl = each.value.ttl
type = each.value.type
values = each.value.values
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for gandi-2-terraform-0.2.dev0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f70f6fa6e78f003ea5e609401afc52ad59e5c99433bec078115c33a26493fed |
|
MD5 | 288b9164d756957c7d2cce2fb7d76726 |
|
BLAKE2b-256 | 7b68417150d1f140f12c0476ff4356de2d3abfe5c2d39f147727beff2e6a8ac0 |
Close
Hashes for gandi_2_terraform-0.2.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63a0891d5516fd6cbbada6de60ecd7b5627c6392f58a2ae8cd7d2d4126f586cb |
|
MD5 | 15c34df7d97e14f25eef302d384e8a1a |
|
BLAKE2b-256 | fafb3769c8ced1ae91325c3e7156a9ab2103ccb928eb63d3a3a677ca73e65840 |