/terraform-provider-namecheap

Terraform provider for Namecheap

Primary LanguageGoApache License 2.0Apache-2.0

Namecheap Terraform Provider

A Terraform Provider for Namecheap domain DNS configuration.

Prerequisites

First you'll need to apply for API access to Namecheap. You can do that on this API admin page.

Next, find out your IP address and add that IP (or any other IPs accessing this API) to this whitelist admin page on Namecheap.

Once you've done that, make note of the API key, your IP address, and your username to fill into our provider block.

Usage Example

Make sure your API details are correct in the provider block.

Terraform 0.13 and later:

terraform {
  required_providers {
    namecheap = {
      source = "namecheap/namecheap"
      version = ">= 2.0.0"
    }
  }
}

provider "namecheap" {
  user_name = "your_username"
  api_user = "your_username"
  api_key = "your_api_key"
  client_ip = "your.ip.address.here"
  use_sandbox = false
}


resource "namecheap_domain_records" "domain-com" {
  domain = "domain.com"
  mode = "OVERWRITE"

  record {
    hostname = "dev"
    type = "A"
    address = "10.12.14.19"
  }
}

resource "namecheap_domain_records" "domain2-com" {
  domain = "domain2.com"
  mode = "OVERWRITE"

  nameservers = [
    "ns1.random-domain.org",
    "ns2.random-domain.org",
  ]
}

Contributing

To contribute, please read our contributing docs.