zinn-digital/zinn is our official Terraform provider, published on the Terraform Registry with signed releases. It manages DNS records on the domains in your organisation, and it reads your sites, domains, plans and hosting regions as data sources. Sites, mailboxes and plans themselves are not managed by Terraform today — use the dashboard, the API, the SDKs or the Zinnector® CLI for those.
Install
terraform {
required_providers {
zinn = {
source = "zinn-digital/zinn"
}
}
}
# api_key falls back to ZINN_API_KEY.
provider "zinn" {}
Run terraform init. Terraform downloads the provider from the registry and checks its signature.
Create an API key
Open the API keys page of your dashboard (app.zinndigital.com/api-keys) and press Create a key. For managing DNS, tick sites.view and domains.dns.manage under Permissions. Export it before running Terraform:
export ZINN_API_KEY=zdk_live_…
The zinn_regions and zinn_plans data sources need no key.
Manage a DNS record
data "zinn_regions" "all" {}
data "zinn_domains" "all" {}
resource "zinn_dns_record" "www" {
domain_id = one([for d in data.zinn_domains.all.domains : d.id if d.fqdn == "example.com"])
name = "www"
type = "CNAME"
value = "example.com."
ttl = 3600
}
output "regions" { value = [for r in data.zinn_regions.all.regions : r.slug] }
terraform apply creates the record; changing value or ttl updates it in place; removing the block deletes it. name accepts @ for the apex, a relative name such as www, or a full name.
Bring an existing record under Terraform
terraform import zinn_dns_record.www <domain_id>/<record_id>
The domain id comes from data.zinn_domains; the record id is shown by the API's DNS record list.
Read your inventory
data "zinn_sites" "all" {}
data "zinn_plans" "agency" { product_line = "agency" }
output "site_count" { value = length(data.zinn_sites.all.sites) }
output "agency_plans" { value = [for p in data.zinn_plans.agency.plans : p.code] }
Provider settings
api_key — the API key; defaults to ZINN_API_KEY.
api_url — defaults to ZINN_API_URL, then https://api.zinndigital.com.
org — the organisation to act on; defaults to ZINN_ORG. Usually unnecessary, because a key belongs to one organisation.
Where to go next
- The guide on our website: zinndigital.com/developers/terraform
- The provider on the Terraform Registry: registry.terraform.io/providers/zinn-digital/zinn
- Source code: github.com/Zinn-Digital/terraform-provider-zinn