namecheap / terraform-provider-namecheap Goto Github PK
View Code? Open in Web Editor NEWTerraform provider for Namecheap
License: Apache License 2.0
Terraform provider for Namecheap
License: Apache License 2.0
Terraform v1.3.4
on darwin_amd64
provider "namecheap" {
api_key = var.namecheap-api-key
api_user = "username as what is shown in my account menu on the website"
user_name = "a user name"
use_sandbox = false
}
I should be able to create a DNS record
Error
Error: Username does not exist (1019103)
terraform apply
You should be able to update the contact information for a domain using the terraform provider. Currently only domain_records
can be managed, not a domain
Terraform v1.2.4
on linux_amd64
Error: expected mode to be one of [MERGE OVERWRITE], got IMPORT
How to recreate:
Import a namecheap record with nameservers
. The import mode
is set to "IMPORT"
Terraform v0.12.25
+ provider.http v1.2.0
+ provider.namecheap (unversioned)
Both built from source and Release v1.5.0
variable nc_username {
type = string
default = ""
}
variable nc_token {
type = string
default = ""
}
data http "myip" {
url = "https://ipinfo.io/ip"
}
provider namecheap {
use_sandbox = false
username = var.nc_username
api_user = var.nc_username
token = var.nc_token
ip = data.http.myip.body
}
resource namecheap_record "record" {
type = "A"
name = "test"
domain = "example.com"
address = "127.0.0.1"
}
https://gist.github.com/cyberbutler/39753094328b7a623a5ebc5004e507ac
What should have happened?
Valid Record Type A
should have been passed to the Namecheap Go API Successfully
What actually happened?
Error: Failed to create namecheap Record: Invalid record type, allowed types="A, AAAA, ALIAS, CAA, CNAME, MX, MXE, TXT, URL, URL301, FRAME"
on namecheap.tf line 1, in resource "namecheap_record" "record":
1: resource namecheap_record "record" {
terraform apply
Attempted to run from MacOS and Debian systems, both results in the same error.
I've also run with both the released provider and built the provider from the master
branch here. Same results.
I tracked down the provided error here. I also added some janky fmt.Printf
"debug" code into the local build of the provider to see what was held in RecordType
before it was passed to the namecheap.client
but it didn't seem to be wrong in anyway. Perhaps there is a user error here somewhere?
0.11.13
latest
namecheap_record
n/a
2019/04/11 14:16:25 [DEBUG] apply: namecheap_record.www-furniturerepairlasvegas-com: executing Apply
2019-04-11T14:16:26.220-0700 [DEBUG] plugin.terraform-provider-namecheap: 2019/04/11 14:16:26 [INFO] Err: Number: 2019166 Message: The domain (furniturerepairlasvegas.com) doesn't seem to be associated with your account.
n/a
Terraform errors out and say "Yo, you don't own this domain"
Loops forever 0_o
namecheap_record.www-furniturerepairlasvegas-com: Still creating... (31m1s elapsed)
Please list the steps required to reproduce the issue, for example:
terraform apply
I am recording this issue because without TRACE output, you pretty much have no clue what is wrong. I also notivced if you do this from an IP that isn't whitelisted also loops forever.
Maybe we can catch these cases and blow up quickly.
see above
Hi there! I see that Go library for Namecheap API was updated and now includes the support of ALIAS records. Could you please be so kind to release new version of provider for that?
Thanks in advance
When setting up the Namecheap Provider, the following options are provided to set the API user and API key: api_user
, api_key
. Yet, they do not seem to be used in the actual configuration of the provider per this error:
╷
│ Error: error configuring plugin: rpc error: code = Unknown desc = error initializing provider: namecheap: some credentials information are missing: NAMECHEAP_API_USER,NAMECHEAP_API_KEY
│
│ with acme_certificate.cert,
│ on main.tf line 107, in resource "acme_certificate" "cert":
│ 107: resource "acme_certificate" "cert" {
│
╵
Following example config:
provider "namecheap" {
user_name = "myUser"
api_user = "myUser"
api_key = "myKey"
client_ip = "1.1.1.1"
use_sandbox = false
}
...
resource "acme_certificate" "cert" {
account_key_pem = acme_registration.reg.account_key_pem
common_name = "domain.com"
certificate_p12_password = random_password.cert.result
dns_challenge {
provider = "namecheap"
}
}
Been trying to terraform apply it but i keep getting an error.
Any ideas ?
Versions:
Terraform v0.12.20
Namcheap v1.4.0
Here is the error
2020/03/04 09:56:34 [TRACE] dag/walk: vertex "root" is waiting for "provider.namecheap (close)"
2020/03/04 09:56:34 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "module.domainOne-com.module.domainOne-com-ns-two.namecheap_record.record"
2020/03/04 09:56:34 [TRACE] dag/walk: vertex "provider.namecheap (close)" is waiting for "module.domainTwo-com.module.domainTwo-com-a-two.namecheap_record.record"
2020/03/04 09:56:39 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "module.domainOne-com.module.domainOne-com-ns-two.namecheap_record.record"
2020/03/04 09:56:39 [TRACE] dag/walk: vertex "provider.namecheap (close)" is waiting for "module.domainTwo-com.module.domainTwo-com-a-two.namecheap_record.record"
2020/03/04 09:56:39 [TRACE] dag/walk: vertex "root" is waiting for "provider.namecheap (close)"
module.domainTwo-com.module.domainTwo-com-txt-one.namecheap_record.record: Still creating... [30s elapsed]
module.domainOne-com.module.domainOne-com-ns-one.namecheap_record.record: Still creating... [30s elapsed]
module.domainTwo-com.module.domainTwo-com-cname-ne.namecheap_record.record: Still creating... [30s elapsed]
module.domainTwo-com.module.domainTwo-com-a-three.namecheap_record.record: Still creating... [30s elapsed]
module.domainOne-com.module.domainOne-com-ns-four.namecheap_record.record: Still creating... [30s elapsed]
module.domainThree-com.module.domainThree-com-url-one.namecheap_record.record: Still creating... [30s elapsed]
module.domainTwo-com.module.domainTwo-com-a-one.namecheap_record.record: Still creating... [30s elapsed]
module.domainTwo-com.module.domainTwo-com-mx-two.namecheap_record.record: Still creating... [30s elapsed]
module.domainTwo-com.module.domainTwo-com-mx-one.namecheap_record.record: Still creating... [30s elapsed]
module.domainTwo-com.module.domainTwo-com-mx-three.namecheap_record.record: Still creating... [30s elapsed]
I'd like to also manage custom nameservers w/ terraform, i.e. use the following API: https://www.namecheap.com/support/api/methods/domains-ns/create/.
However, this provider does not yet support this. Are there any plans to add this?
Per the docs, it's currently only possible to automate DNS management. It would be great to be able to provision and manage VPSes:
I did not find an option to enable or disable dnssec using this terraform provider.
Did I miss something or are there any plans to offer this configuration option in the future?
Terraform v1.3.3
on linux_amd64
+ provider registry.terraform.io/namecheap/namecheap v2.1.0
namecheap_domain_records
resource "namecheap_domain_records" "sub" {
domain = "sub.example.com"
email_type = "MX"
mode = "MERGE"
record {
hostname = "@"
type = "A"
address = "1.2.3.4"
}
record {
hostname = "mail"
type = "MX"
address = "mx.sub.example.com."
mx_pref = 10
}
record {
hostname = "mx"
type = "A"
address = "1.2.3.4"
}
}
resource "namecheap_domain_records" "main" {
domain = "example.com"
mode = "MERGE"
email_type = "FWD"
record {
hostname = "sub"
type = "NS"
address = "freedns1.registrar-servers.com."
}
record {
hostname = "sub"
type = "NS"
address = "freedns2.registrar-servers.com."
}
record {
hostname = "sub"
type = "NS"
address = "freedns3.registrar-servers.com."
}
record {
hostname = "sub"
type = "NS"
address = "freedns4.registrar-servers.com."
}
record {
hostname = "sub"
type = "NS"
address = "freedns5.registrar-servers.com."
}
}
The records for subdomain sub.example.com
, including mail setting, are configured to the associated FreeDNS domain sub.example.com
.
In case that two configs are conflicting, separating the two records in 2 projects and try apply the project with main
record first, then apply the project with sub
record.
The records for subdomain sub.example.com
are configured to the root domain example.com
.
terraform apply
I own the root domain example.com
and manage it on namecheap.
I also create a FreeDNS domain to manage sub.example.com
.
Rationale: I want to customize MX on the subdomain while using email forwarding on the root domain.
Error: Failed to install provider
Error while installing hashicorp/namecheap: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/namecheap
Hi
I have a feature request. I'd like to be able to set the email redirect rules via Terraform, without having to log into the control panel to do it manually.
Example
resource "namecheap_domain_records" "my-domain-com" {
# ...
email_type = "FWD"
email_redirect {
alias = "*" # this would be the catch-all
to = "[email protected]"
}
email_redirect {
alias = "[email protected]"
to = "[email protected]"
}
}
Thank you for making a namecheap provider! I was wondering if it's on the radar to make a version that is compatible with the new v0.12.0-beta1 version?
If you run terraform plan
back-to-back, it seems Namecheap will throttle your requests. I get the following error (in summary) from terraform:
expected element type <ApiResponse> but have <html>
Terraform v0.11.10
Namecheap v1.1.1
Terraform trace output towards the end of a terraform apply
I executed back to back a few times:
2018/12/09 12:30:04 [TRACE] [walkRefresh] Exiting eval tree: namecheap_record.copelander-com
2018/12/09 12:30:05 [ERROR] root: eval: *terraform.EvalRefresh, err: namecheap_record.www-copelander-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
2018/12/09 12:30:05 [ERROR] root: eval: *terraform.EvalSequence, err: namecheap_record.www-copelander-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
2018/12/09 12:30:05 [TRACE] [walkRefresh] Exiting eval tree: namecheap_record.www-copelander-com
2018/12/09 12:30:05 [ERROR] root: eval: *terraform.EvalRefresh, err: namecheap_record.www-remotedevforce-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
2018/12/09 12:30:05 [ERROR] root: eval: *terraform.EvalSequence, err: namecheap_record.www-remotedevforce-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
2018/12/09 12:30:05 [TRACE] [walkRefresh] Exiting eval tree: namecheap_record.www-remotedevforce-com
2018/12/09 12:30:05 [TRACE] dag/walk: upstream errored, not walking "provider.namecheap (close)"
2018/12/09 12:30:05 [TRACE] dag/walk: upstream errored, not walking "root"
2018/12/09 12:30:05 [DEBUG] plugin: waiting for all plugin processes to complete...
Error: Error refreshing state: 3 error(s) occurred:
* namecheap_record.copelander-com: 1 error(s) occurred:
2018-12-09T12:30:05.199-0800 [DEBUG] plugin.terraform-provider-namecheap: 2018/12/09 12:30:05 [ERR] plugin: plugin server: accept unix /var/folders/03/blcr90b52jb9d_4qphynlz680000gn/T/plugin407438253: use of closed network connection
2018-12-09T12:30:05.199-0800 [DEBUG] plugin.terraform-provider-google_v1.19.1_x4: 2018/12/09 12:30:05 [ERR] plugin: plugin server: accept unix /var/folders/03/blcr90b52jb9d_4qphynlz680000gn/T/plugin922996050: use of closed network connection
* namecheap_record.copelander-com: namecheap_record.copelander-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
* namecheap_record.www-copelander-com: 1 error(s) occurred:
* namecheap_record.www-copelander-com: namecheap_record.www-copelander-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
* namecheap_record.www-remotedevforce-com: 1 error(s) occurred:
* namecheap_record.www-remotedevforce-com: namecheap_record.www-remotedevforce-com: Couldn't find namecheap record: expected element type <ApiResponse> but have <html>
2018-12-09T12:30:05.202-0800 [DEBUG] plugin: plugin process exited: path=/Users/me/my_project/.terraform/plugins/darwin_amd64/terraform-provider-google_v1.19.1_x4
2018-12-09T12:30:05.203-0800 [DEBUG] plugin: plugin process exited: path=/Users/me/.terraform.d/plugins/terraform-provider-namecheap
Error: terraform apply failed.
I know when AWS hits rate limits, terraform will exponentially back-off from hitting the API too much. I'd expect if we hit any rate limits with namecheap, we would back-off, and retry. Unfortunately they are not returning anything in their headers I can see for rate limiting which I know some APIs do.
Namecheap API seems to bomb out somehow. Getting back this error expected element type <ApiResponse> but have <html>
If you have a dozen of so records managed by terraform with namecheap. Run:
terraform plan
over and over till the API bombs out.Maybe it has something to do with rate limiting? Still don't know why it says "html" though. A capped out response from namecheap looks like this for me hitting getList dns over and over with my browser.
<ApiResponse Status="ERROR">
<Errors>
<Error Number="500000">Too many requests</Error>
</Errors>
<Server/>
<GMTTimeDifference/>
<ExecutionTime>0</ExecutionTime>
</ApiResponse>
Maybe there is a way to account for this (if this is the issue I guess, I'm still assuming this has to do with rate limiting since the first few terraform plan
jobs will work fine until it bombs out) and "backoff of the API" then retry like AWS and other providers do?
Thanks again for these great go libraries.
Terraform v0.15.4
on linux_amd64
robgmills/namecheap 1.7.0
The goal is not to be mean, but to make the maintainers realise (if they don't already) how bad this provider is, from the perspective of a user.
Also, this does not look like some sort of open source project with maintainers that work for free, this is direct from the namecheap github org, so I expect much better than this.
terraform.sh
:
NAMECHEAP_IP="$(curl -s ifconfig.me)" terraform $@
Could not find the record with hash 123456789
happens all the time ! I can't trust this thing to run unsupervised, it's faster to use the web app because at least I know it won't crash !robgmills/namecheap
? Isn't the git repo namecheap/terraform-provider-namecheap
?namecheap/terraform-provider-namecheap
is 1.6.0 ?1.7.0
and not 0.1.7
? Why isn't there a disclaimer "not ready for production use" ?Hi there,
I am just wondering how I go about configuring an already existing domain? I purchase them through Namecheap often so it already exists there, but I wanted to use Terraform to set the name servers to different things using just the "basic DNS" which provides nameservers only and I point those to Cloudflare, GCP, AWS, DigitalOcean, etc depending on various things. I tried to use namecheap_domain so I could try to import, but it said that didn't exist. Any suggestions on what I do in this situation?
Thanks,
-MH
Have issues running this module through CI/CD solution, im using Azure Devops and the problem im having is that the client ips of the managed service constantly changes. Is there anyway I can whitelist a CIDR instead of a specific IP?
Terraform Cloud must be allowed API access. Currently, I have to manually allow each IP address so that applying via Terraform Cloud succeeds. From experimentation, it seems that different IPs are used for different runs, so I have to add a new one after each failure.
A related issue is #59 - if there is a public CIDR for cloud-apply that could also work here. Note that the IP Range API does not return the cloud-apply ranges so I can't predict ahead of time what to use.
1.0.11
2.0.2
I should be able to use Terraform Cloud as my backend and perform an apply from there.
$ terraform apply
╷
│ Error: Invalid request IP: 3.145.98.94 (1011150)
│
│ with namecheap_domain_records.MY_DOMAIN,
│ on domain.tf line 3, in resource "namecheap_domain_records" "MY_DOMAIN":
│ 3: resource "namecheap_domain_records" "MY_DOMAIN" {
│
╵
terraform apply
Terraform v0.11.10
v1.0.0 Release for Namecheap provider on osx
namecheap_record
None provided after TF_LOG=info defined..
Apply completes
Keeps trying to create the record even though it creates the record. It is like it doesn't get back a response that the apply was successful.
namecheap_record.remotedevforce-com-mx2: Still creating... (20s elapsed)
namecheap_record.remotedevforce-com-mx1: Still creating... (20s elapsed)
namecheap_record.remotedevforce-com-dkim: Still creating... (20s elapsed)
...
namecheap_record.remotedevforce-com-mx2: Still creating... (30m30s elapsed)
namecheap_record.remotedevforce-com-mx1: Still creating... (30m30s elapsed)
namecheap_record.remotedevforce-com-dkim: Still creating... (30m30s elapsed)
terraform apply
Edge case where you change a domain name from something you did own, to something you don't. Things get "stuck" in a broken state.
0.12
latest tagged release
Please list the resources as a list, for example:
N/A
See above
See above
What should have happened?
I'm not exactly sure haha, maybe it can see there was an ownership error with the domain name and prevent writing it to the state file?
💥
Error: Failed to create namecheap Record: Could not find the record with hash 2759530686
Now only way to fix this is to manually edit the terraform.tfstate file and remove the offending hash record or fix the domain name manually.
I am a computer
N/A
Terraform v0.11.13
namecheap_record
resource "namecheap_record" "subdomain" {
count = "${length(var.subdomains)}"
domain = "${var.domain}"
name = "${element(var.subdomains,count.index)}"
address = "partners.vacasa.com"
type = "CNAME"
}
Still creating... (45m31s elapsed)
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log
.
No panic, attempting to create for 45 minutes
Either it times out or creates the record
What actually happened?
I tried to apply one namecheap_record
resource, and has been hanging on Still creating...
for 45 minutes.
Please list the steps required to reproduce the issue, for example:
terraform apply
Are there anything atypical about your accounts that we should know?
Using a sandbox account, hesitant to try on production.
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Unsure if this is related-
#13
Hi, there. As this is a "pure" usage / documentation question and not about a failure (yet!), I'm going to start with only a little of the usual requested debug log info. If you need me to produce any debug output to answer my question though, I will gladly do so.
In short: is it possible to use the modern provider to perform a terraform import
of an existing domain configuration? If it is possible, what is the correct input for the domain "id" to provide the terraform import
command?
I did check the documentation, but there is no reference to an import command, which seems unusual. I am not sure whether I should infer from this that import
is not viable. If not, the documentation should probably say this explicitly.
Background:
$ terraform -version
Terraform v1.1.0
on linux_amd64
+ provider registry.terraform.io/namecheap/namecheap v2.0.2
mode = "MERGE"
). I also performed a negative test and confirmed that if I intentionally mangle my credentials in my provider config I receive sensible error messages to that effect.Example import
commands I have tried:
terraform import -no-color namecheap_domain_records.some_domain example.com
terraform import -no-color namecheap_domain_records.some_domain 1234567
In all cases, I receive this message:
Error: invalid domain: incorrect format
In the examples above I of course supplied real domain names and ID numbers. The numeric value used in the 2nd example was the internal "ID" field of the domain, as returned via curl
against the API. I am fairly sure using the numeric ID was wrong, since the id
field's value ends up the same as the domain
field's, as viewed in terraform state show
after using terraform apply
on another domain. Given that, though, the response that the string domain name is in the "incorrect format" is baffling.
Thanks and best regards!
Run terraform -v
to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.
Terraform v1.5.7
on darwin_arm64
Please list the resources as a list, for example:
terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = ">= 2.0.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.4.0"
}
}
}
provider "namecheap" {
user_name = "...."
api_user = "...."
api_key = "...."
client_ip = data.http.public_ip.response_body
use_sandbox = false
}
data "http" "public_ip" {
url = "https://ifconfig.co/json"
request_headers = {
Accept = "application/json"
}
}
resource "namecheap_domain_records" "domain_io" {
domain = "domain.io"
mode = "MERGE"
record {
hostname = "dev"
type = "A"
address = "10.12.14.19"
}
}
https://gist.github.com/madelaney/51953e135fed33cddde6fd7f511fe924
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log
.
I would have expected a new DNS A record to be created.
An error was thrown
Please list the steps required to reproduce the issue, for example:
terraform init
terraform apply
v1.0.4
v2.0.2
Please list the resources as a list, for example:
resource "namecheap_domain_records" "my-domain-com" {
domain = "some.domain"
mode = "OVERWRITE"
email_type = "NONE"
record {
hostname = "hostname"
type = "CNAME"
address = "some.address"
}
}
Terraform will perform the following actions:
# namecheap_domain_records.my-domain-com will be created
+ resource "namecheap_domain_records" "my-domain-com" {
+ domain = "some.domain"
+ email_type = "NONE"
+ id = (known after apply)
+ mode = "OVERWRITE"
+ record {
+ address = "some.address"
+ hostname = "hostname"
+ mx_pref = 10
+ ttl = 1799
+ type = "CNAME"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Should warn about removing existing resources that are created manually. Even thou the manual records are not in the TFState, if the API connection has already been made, and the OVERWRITE flag it true, some warning should be made.
Only says it is adding a resource, not deleting (outside of terraform, but still under the api call).
terraform apply
Because of this mistake, I accidentally deleted all production records and had to contact Namecheap support to restore them. It's unclear from the docs that the terraform will manage anything that was not created first by it, as intuitively this is terraform's use case. If mass-deletion was required, it would be better not to provide it using this provider as it can create confusion. If it's necessary, a warning should be made on the docs wherever Overwrite is written.
Hi,
I get error when trying to add CNAME record:
1 error(s) occurred:
* module.dns_records_namecheap.namecheap_record.namecheap_record_0: 1 error(s) occurred:
* namecheap_record.namecheap_record_0: Couldn't find namecheap record: Could not find the record
12:05 $ terraform -v
Terraform v0.11.8
+ provider.aws v1.24.0
+ provider.namecheap (unversioned)
+ provider.template v1.0.0
With A record all working fine.
Not sure if this is related to my 0.12 upgrade nightmare or a legit minor issue.
I've noticed some of my other resources complaining that timeouts
is empty so not sure if we just need to add something to support this.
2019/05/29 14:48:11 [INFO] Go runtime version: go1.12.5
2019/05/29 14:48:11 [INFO] CLI args: []string{"/usr/local/bin/terraform", "version"}
2019/05/29 14:48:11 [DEBUG] Attempting to open CLI config file: /Users/joshuacopeland/.terraformrc
2019/05/29 14:48:11 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/05/29 14:48:11 [INFO] CLI command args: []string{"version"}
Terraform v0.12.0
2019/05/29 14:48:11 [DEBUG] checking for provider in "."
2019/05/29 14:48:11 [DEBUG] checking for provider in "/usr/local/bin"
2019/05/29 14:48:11 [DEBUG] checking for provider in ".terraform/plugins/darwin_amd64"
2019/05/29 14:48:11 [DEBUG] found provider "terraform-provider-google_v2.7.0_x4"
2019/05/29 14:48:11 [DEBUG] found provider "terraform-provider-random_v2.1.2_x4"
2019/05/29 14:48:11 [DEBUG] checking for provider in "/Users/joshuacopeland/.terraform.d/plugins"
2019/05/29 14:48:11 [WARN] found legacy provider "terraform-provider-namecheap"
2019/05/29 14:48:11 [DEBUG] found valid plugin: "google", "2.7.0", "/Users/joshuacopeland/Workspace/RemoteDevForce/tf-gcp-rdf-infrastructure/.terraform/plugins/darwin_amd64/terraform-provider-google_v2.7.0_x4"
2019/05/29 14:48:11 [DEBUG] found valid plugin: "random", "2.1.2", "/Users/joshuacopeland/Workspace/RemoteDevForce/tf-gcp-rdf-infrastructure/.terraform/plugins/darwin_amd64/terraform-provider-random_v2.1.2_x4"
2019/05/29 14:48:11 [DEBUG] found valid plugin: "namecheap", "0.0.0", "/Users/joshuacopeland/.terraform.d/plugins/terraform-provider-namecheap"
+ provider.google v2.7.0
+ provider.namecheap (unversioned)
+ provider.random v2.1.2
1.3.0
Please list the resources as a list, for example:
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
2019/05/29 14:43:46 [WARN] Provider "namecheap" produced an invalid plan for namecheap_record.db01-remotedevforce-com, but we are tolerating it because it is using the legacy plugin SDK.
The following problems may be the cause of any confusing errors from downstream operations:
- .timeouts: planned for existence but config wants absense
N/A
No warning
warning message
Maybe go from 0.11 to 0.12 to see this?
The earth is not flat
https://www.terraform.io/docs/configuration/resources.html#operation-timeouts
Hi, how could I update a domains nameservers using this provider?
Lets say I would like to switch managing DNS to a different third party DNS provider?
Thanks
Hi,
It seems if a zone in Namecheap contains a CAA 'iodef' record, the Namecheap Terraform provider fails to create DNS records. If the CAA record is removed, the creation succeeds. I've tested with A and CNAME records, using Terraform 1.4.0 and 1.4.6, with Namecheap provider 2.1.0.
Terraform v1.4.6
What version of terraform-provider-namecheap are you using? 2.1.0
CAA Record
@
iodef
"mailto:[email protected]"
resource "namecheap_domain_records" "create-record" {
domain = "domain.com"
mode = "MERGE"
# ACM Certificate Validation Record
record {
hostname = "test"
type = "A"
address = "1.1.1.1"
ttl = 1800
}
}
Error: Records[10].Address "0 iodef "mailto:[email protected]"" must contain a protocol prefix for CAA iodef record
Hi there,
thank you for the provider, it really helped coming up with this repo: https://github.com/ams0/namecheap-azure-terraform where I use Azure DNS and Namecheap. My only issue is that every time I run tf plan
, the run will force new values for the name servers:
~ nameservers = [
- "ns1-38.azure-dns.com",
+ "ns1-38.azure-dns.com.",
- "ns2-38.azure-dns.net",
+ "ns2-38.azure-dns.net.",
- "ns3-38.azure-dns.org",
+ "ns3-38.azure-dns.org.",
- "ns4-38.azure-dns.info",
+ "ns4-38.azure-dns.info.",
]
because the array coming from the output of azurerm_dns_zone.zone[each.key].name_servers
is an array with dots at the end, but internally, namecheaps seems to store the name server without the dot, forcing a change every time. I have no solutions to the problem, I trie the trim
TF function but it works on strings, not arrays, so I don't know how to strip the dot from each element of an array. It's more annoying than anything, but if someone knows a solution, I'd be very grateful.
I understand the namecheap API has this limitation. Are there any plans for whitelisting IPs of known CICD providers: Terraform Cloud, Github Actions, Azure DevOPS, AWS CodePipeline etc.
Hi there,
We want to update our community about the further development of the project.
Short history: about a month before we have transferred the project under our support at @namecheap from @adamdecaf.
Really thanks to the author and all contributors for your time and efforts, much appreciated. Now we will do our best to get it stable asap :)
Upon our learning and debugging of the existing codebase, we have faced a few critical issues that require the following complete refactoring. Before going through we want to receive some feedback from our community.
Example:
resource "namecheap_record" "www-example-com" {
name = "www"
domain = "example.com"
address = "127.0.0.1"
type = "A"
}
resource "namecheap_record" "www-example2-com" {
name = "www"
domain = "example2.com"
address = "127.0.0.1"
type = "A"
}
resource "namecheap_ns" "www-mydomain-com" {
domain = "mydomain.com"
servers = ["ns1.domain.com", "ns2.domain.com"]
}
Currently, we have the approach where each resource item reflects a record for a specific domain (including nameserver record). Our API "setHosts" requires to send back all existing records with(out) amended/created/removed one. This compels to use a mutex to prevent racing, decreases general performance, and probably might be a part of bug #31. One more issue #37 related to requirements of "setHosts" API to provide the EmailType
mode with possible values NONE/FWD/MXE/MX/OX that will allow to set up email behavior. In case we will create MX record, we might face an infinity loop (probably one more reason for #31 when we have added an MX record, we're sending a request to create, then upon reading record still doesn't exist and here we have the problem).
Example:
resource "namecheap_domain_records" "www-example-com" {
domain = "example.com"
email_type = "MX"
record {
hostname = "host1"
type = "A"
address = "10.11.12.13"
ttl = 1800
}
record {
hostname = "host2"
type = "A"
address = "11.12.13.14"
}
record {
hostname = "mail"
type = "MX"
address = "mail.domain.com"
mx_pref = 10
ttl = 1800
}
}
resource "namecheap_domain_records" "www-example2-com" {
domain = "example2.com"
nameservers = ["ns1.domain.com", "ns2.domain.com"]
}
Since terraform provider is processing all resources in parallel, so we can get rid of mutexes and approaches to handle records synchronously, the provider will work much faster and we will have less complexity from a technical perspective to get it very stable (most likely we won't face #31)
email_type
will solve the issue when we need to set up some specific email behavior (most likely we will solve #37).
All nuances will be reflected in the detailed documentation later.
Most likely, we will face a challenge to develop a correct migration process. Even though we will provide detailed instructions about how to migrate the existing resource syntax so after apply the requests will be made but nothing will be changed in fact.
One more controversial question is about "resource writing mode". I mean, when you have set up some records in the Domain Control Panel, upon applying new records, should we completely rewrite existing records or create new records despite existing records added manually? (except default parking records).
We decided to go through in "merge" mode. So that might be a default behavior where we're creating new records without completely removing manually added ones. If this question is reasonable, we might add an additional optional mode
parameter:
resource "namecheap_domain_records" "www-example2-com" {
domain = "example2.com"
mode = "overwrite"
...
}
First of all, I'm requesting the comments from the author @adamdecaf (please tag someone else if we have missed someone).
We will do our best to provide a convenient solution.
Cheers 🥂
I am migrating to namecheap provider v2.0.
The v2.0 has a problem with FreeDNS domains and it is currently blocking me.
Please have a look at this.
Thank you.
Terraform v1.0.9
on linux_amd64
2.0.1
namecheap_domain_records
NOTE: transa.ng
is a FreeDNS domain. (I bought it from another DNS provider and control it within namecheap)
resource namecheap_domain_records "main" {
domain = "transa.ng"
mode = "OVERWRITE" # or "MERGE", whichever won't work
record {
hostname = "@"
type = "A"
address = "1.2.3.4"
}
}
The debug output includes too much sensitive information. I only include the related portion here. It is short, so I paste it directly.
namecheap_domain_records.main: Refreshing state... [id=transa.ng]
2021-10-26T10:36:22.178+0900 [TRACE] GRPCProvider: ReadResource
2021-10-26T10:36:22.895+0900 [TRACE] vertex "namecheap_domain_records.main": visit complete
2021-10-26T10:36:22.895+0900 [TRACE] vertex "namecheap_domain_records.main": dynamic subgraph encountered errors: Domain name not found (2019166)
2021-10-26T10:36:22.896+0900 [TRACE] vertex "namecheap_domain_records.main": visit complete
2021-10-26T10:36:22.896+0900 [TRACE] vertex "namecheap_domain_records.main (expand)": dynamic subgraph encountered errors: Domain name not found (2019166)
2021-10-26T10:36:22.896+0900 [TRACE] vertex "namecheap_domain_records.main (expand)": visit complete
2021-10-26T10:36:22.896+0900 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/namecheap/namecheap\"] (close)" errored, so skipping
2021-10-26T10:36:22.896+0900 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2021-10-26T10:36:22.896+0900 [TRACE] dag/walk: upstream of "root" errored, so skipping
╷
│ Error: Domain name not found (2019166)
│
│ with namecheap_domain_records.main,
│ on main.tf line 1, in resource "namecheap_domain_records" "main":
│ 1: resource namecheap_domain_records "main" {
│
╵
It should run terraform plan
successfully.
The first run is ok.
But from the second run, the provider fails to run, with the error
Error: Domain name not found (2019166)
Please list the steps required to reproduce the issue, for example:
terraform apply -auto-approve
terraform plan
(without any change to the configuration)NOTE: transa.ng
is a FreeDNS domain. (I bought it from another DNS provider and control it within Namecheap).
Terraform v1.4.5
on linux_amd64
+ provider registry.terraform.io/namecheap/namecheap v2.1.0
namecheap/namecheap v2.1.0
The namecheap Terraform provider.
Irrelevant for this report.
Irrelevant for this report.
The documentation, under Argument Reference, mentions that the provider arguments can be set via environment variables. This is, in fact, preferred as you shouldn't hard-code sensitive data in your Terraform configuration.
Thus, I expected to be able to declare an empty namecheap
provider without any warnings:
provider namecheap {}
My IDE warns me that api_key
, api_user
, and user_name
are required and missing:
Luckily, this is only a warning, because supplying the appropriate NAMECHEAP_*
environment variables works as expected.
Given a Terraform config:
namecheap
version 2.1.0
as a required providerterraform {
required_providers {
# Other provider data...
namecheap = {
source = "namecheap/namecheap"
version = "2.1.0"
}
}
}
namecheap
provider with no arguments:provider namecheap {}
Looking at the provider source, the properties that are logically required are also programmatically flagged with Required: true
, while also having a DefaultFunc
pointing to the respective environment variable.
If a property has a default, why should it be required? Or if it is required, then what is the purpose of a default value?
I would recommend Replacing the Required: true
with Optional: true
because that is what these properties are. For inspiration, the AWS provider does the same. They don't use DefaultFunc
but rather a configure
function to ensure that the configuration is always complete, however the end result is the same.
I seem to be unable to create MX records. Below is a redacted, abbreviated version of my terraform files. I've tried both with appended '.' and no '.' and it does not seem to make a difference. Some of these variables are not relevant to MX records, would omitting them help? I'd like to use the same generic module for record creation but can make a separate one if that is required.
terraform {
[...]
#Add MX Record
module "namecheap_MX_record" {
source = "./tf_modules/namecheap/create-record"
type = "MX"
name = "mail.${var.domain}."
domain = var.domain
address = "mail.${var.domain}."
mx_pref = "10"
ttl = "3600"
[...]
#Specifies namecheap credentials
provider "namecheap" {
username = var.namecheap_username
api_user = var.namecheap_api_user
token = var.namecheap_api_token
ip = var.namecheap_ip_address
}
#Create record
resource "namecheap_record" "record" {
name = var.name
domain = var.domain
type = var.type
address = var.address
mx_pref = var.mx_pref
ttl = var.ttl
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.