All Projects → adamdecaf → Terraform Provider Namecheap

adamdecaf / Terraform Provider Namecheap

Licence: mpl-2.0
Terraform provider for Namecheap

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Terraform Provider Namecheap

Terraform Provider Tls
Provides utilities for working with Transport Layer Security keys and certificates. It provides resources that allow private keys, certificates and certficate requests to be created as part of a Terraform deployment.
Stars: ✭ 88 (-12.87%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Secret
Terraform secret provider
Stars: ✭ 55 (-45.54%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Packet
Terraform provider for Equinix Metal (formerly Packet)
Stars: ✭ 33 (-67.33%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Tencentcloud
Terraform TencentCloud Provider
Stars: ✭ 85 (-15.84%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Google
Terraform Google Cloud Platform provider
Stars: ✭ 1,318 (+1204.95%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Kubernetes
Terraform Kubernetes provider
Stars: ✭ 898 (+789.11%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Netlify
Terraform Netlify provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
Stars: ✭ 51 (-49.5%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Aws
Terraform AWS provider
Stars: ✭ 6,624 (+6458.42%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Aiven
Terraform Aiven provider
Stars: ✭ 68 (-32.67%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Fastly
Terraform Fastly provider
Stars: ✭ 65 (-35.64%)
Mutual labels:  terraform, terraform-provider
Namecheap
Go library for Namecheap API
Stars: ✭ 18 (-82.18%)
Mutual labels:  terraform, terraform-provider
Terraform
Terraform - Beginners | Intermediate | Advanced
Stars: ✭ 77 (-23.76%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Libvirt
Terraform provider to provision infrastructure with Linux's KVM using libvirt
Stars: ✭ 894 (+785.15%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Dome9
Terraform Provider for Dome9
Stars: ✭ 33 (-67.33%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Helm
Terraform Helm provider
Stars: ✭ 704 (+597.03%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Zabbix
Stars: ✭ 38 (-62.38%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Vsphere
Terraform VMware vSphere provider
Stars: ✭ 380 (+276.24%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Oci
Terraform Oracle Cloud Infrastructure provider
Stars: ✭ 400 (+296.04%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Sumologic Old
Go to the new provider repo --->
Stars: ✭ 60 (-40.59%)
Mutual labels:  terraform, terraform-provider
Terraform Provider Vcd
Terraform VMware vCloud Director provider
Stars: ✭ 73 (-27.72%)
Mutual labels:  terraform, terraform-provider

Namecheap Terraform Provider

Go Report Card Support via Flattr

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 token, your IP address, and your username to fill into our provider block.

Usage

Then inside a Terraform file within your project (Ex. providers.tf):

Using the provider

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

terraform {
  required_providers {
    namecheap = {
      source  = "robgmills/namecheap"
      version = "1.7.0"
    }
  }
}

provider "namecheap" {
  username = "your_username" # Also set by env variable `NAMECHEAP_USERNAME`
  api_user = "your_username" # Same as username; also set by env variable `NAMECHEAP_API_USER`
  token = "your_token" # Also set by env variable `NAMECHEAP_TOKEN`
  ip = "your.ip.address.here" # Also set by env variable `NAMECHEAP_IP`
  use_sandbox = false # Toggle for testing/sandbox mode; Also set by env variable `NAMECHEAP_USE_SANDBOX`
}

# Create a DNS A Record for a domain you own
resource "namecheap_record" "www-example-com" {
  name = "www"
  domain = "example.com"
  address = "127.0.0.1"
  mx_pref = 10
  type = "A"
}

Setup terraform and view the plan output.

$ terraform init
Terraform has been successfully initialized!

$ terraform plan
Terraform will perform the following actions:

  + namecheap_record.www-example.com
      id:       <computed>
      address:  "127.0.0.1"
      domain:   "example.com"
      hostname: <computed>
      mx_pref:  "10"
      name:     "www"
      ttl:      "60"
      type:     "A"


Plan: 1 to add, 0 to change, 0 to destroy.

$ terraform apply
...
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Building The Provider

$ go get github.com/adamdecaf/terraform-provider-namecheap
$ cd $GOPATH/src/github.com/adamdecaf/terraform-provider-namecheap
$ make build

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.15+ is recommended). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

This project uses Go Modules, added in Go 1.11.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
$ ls $GOPATH/bin/terraform-provider-namecheap
...

In order to test the provider, you can simply run make test.

$ make test

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run. They are also dependent on environment variables to configure the test instance of the provider.

$ make testacc

To contribute changes, please open a PR by forking the repository, adding the fork to your local copy of the git repository, create a branch, commit your changes, and open a PR:

$ git remote add fork [email protected]/youruser/terraform-provider-namechep
$ git checkout -b your-new-feature
$ git add .
$ git commit -m "Add a new feature"
$ git push -u fork your-new-feature
...

Troubleshooting the Provider

Problem: Error: Failed to create namecheap Record: Could not find the record with hash Solution: Double check your IP did not change and make sure it is whitelisted with Namecheaps API. Also ensure the domain names you have in your terraform config are still associated with your account (in cases like where you let one expire). In these rare edge-cases, you may have to delete the bad domain records by running terraform state rm namecheap_record.the_tf_name_of_your_record.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].