A Terraform provider that allows you to manage your Name.com DNS records and domain settings using infrastructure as code.
Special thanks to @mhumeSF for the original name.com provider that served as the foundation for this project.
- ✅ Create and manage DNS records (A, AAAA, ANAME, CNAME, MX, NS, SRV, TXT)
- ✅ Configure nameservers for domains
- ✅ Set up DNSSEC for domains
- ✅ Built-in rate limiting (20 req/sec and 3000 req/hour by default)
⚠️ The Terraform Registry is supported on a best-effort basis only.I strongly recommend migrating to OpenTofu — a drop-in replacement for Terraform with a reliable, community-driven registry.
This provider is available in the OpenTofu Registry. To use it, add the following to your configuration:
terraform {
required_providers {
namedotcom = {
source = "lexfrei/namedotcom"
version = "~> 4.0"
}
}
}The provider is also listed in the Terraform Registry, but it may be outdated or broken. If you encounter issues, please switch to OpenTofu or install from source.
If you prefer to build from source:
- Clone this repository
- Run
go mod tidyto ensure dependencies - Run
go build -o terraform-provider-namedotcom - Move the binary to your Terraform plugins directory
The provider requires API credentials from Name.com:
- Log in to your Name.com account
- Go to API settings
- Generate a token if you don't already have one
Then configure the provider with your credentials:
provider "namedotcom" {
username = var.namedotcom_username
token = var.namedotcom_token
}Recommended: Store your credentials in environment variables or in a secure backend:
provider "namedotcom" {
# These can also be set with NAMEDOTCOM_USERNAME and NAMEDOTCOM_TOKEN environment variables
username = var.namedotcom_username
token = var.namedotcom_token
}A realistic configuration that exercises every resource the provider offers. It manages two domains with different strategies: example.com is hosted directly on Name.com, while example.net is delegated to an external DNS provider and secured with DNSSEC.
provider "namedotcom" {
# Credentials can also come from the NAMEDOTCOM_USERNAME and
# NAMEDOTCOM_TOKEN environment variables.
username = var.namedotcom_username
token = var.namedotcom_token
# Optional: tune the built-in rate limiter (defaults shown).
rate_limit_per_second = 20
rate_limit_per_hour = 3000
}
# --- example.com: DNS hosted on Name.com -------------------------------------
# Apex A record: an empty host targets the bare domain (example.com).
resource "namedotcom_record" "apex" {
domain_name = "example.com"
host = ""
record_type = "A"
answer = "192.0.2.1"
}
# IPv6 address for the apex.
resource "namedotcom_record" "apex_v6" {
domain_name = "example.com"
host = ""
record_type = "AAAA"
answer = "2001:db8::1"
}
# www as a CNAME pointing back to the apex.
resource "namedotcom_record" "www" {
domain_name = "example.com"
host = "www"
record_type = "CNAME"
answer = "example.com"
}
# Mail exchanger. MX records use priority; a lower value is preferred.
resource "namedotcom_record" "mail" {
domain_name = "example.com"
host = ""
record_type = "MX"
answer = "mail.example.com"
priority = 10
}
# SPF policy as a TXT record on the apex.
resource "namedotcom_record" "spf" {
domain_name = "example.com"
host = ""
record_type = "TXT"
answer = "v=spf1 -all"
}
# --- example.net: delegated to an external DNS provider, secured with DNSSEC -
# Point the domain at the external provider's nameservers.
resource "namedotcom_domain_nameservers" "example_net" {
domain_name = "example.net"
nameservers = [
"ns1.dns.example",
"ns2.dns.example",
]
}
# Register the DS record so the delegated zone is validated by the registry.
# These values come from the external DNS provider's key-signing key.
resource "namedotcom_dnssec" "example_net" {
domain_name = "example.net"
key_tag = 12345
algorithm = 13
digest_type = 2
digest = "6B3ED3311DE85004BF6DD325BA82340BC89B40B86D4055780F3BE4390B81B59A"
}Hosting a zone's records on Name.com and delegating that same zone elsewhere are mutually exclusive — once a domain is delegated, its records live with the other provider. See the per-resource docs for the full attribute reference and import syntax.
Detailed documentation for each resource type is available:
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -am 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the BSD 3-Clause License.