Giter VIP home page Giter VIP logo

terraform-provider-namecheap's People

Contributors

adamdecaf avatar b-m-f avatar b1ff avatar hx-rd avatar ifree92 avatar lukegiuliani avatar ogprogrammer avatar ptous avatar robgmills avatar rolodato avatar stchris avatar stylet avatar trilom avatar vetal2409 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-namecheap's Issues

Better way to handle incorrect IP or bad domain

Terraform Version

0.11.13

Namecheap provider version

latest

Affected Resource(s)

namecheap_record

Terraform Configuration Files

n/a

Debug Output


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.

Panic Output

n/a

Expected Behavior

Terraform errors out and say "Yo, you don't own this domain"

Actual Behavior

Loops forever 0_o

namecheap_record.www-furniturerepairlasvegas-com: Still creating... (31m1s elapsed)

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Put domain you do not own into a namecheap_record
  2. terraform apply

Important Factoids

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.

References

see above

Support for dnssec

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?

Ability to update the domain contact record information

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 Version

Terraform v1.2.4
on linux_amd64

Namecheap provider version

  • provider registry.terraform.io/namecheap/namecheap v2.1.0

Affected Resource(s)

  • namecheap_domain

Possible rate limit or other issue

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 Version

Terraform v0.11.10
Namecheap v1.1.1

Affected Resource(s)

  • namecheap_record
  • namecheap_ns

Debug Output

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.

Expected Behavior

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.

Actual Behavior

Namecheap API seems to bomb out somehow. Getting back this error expected element type <ApiResponse> but have <html>

Steps to Reproduce

If you have a dozen of so records managed by terraform with namecheap. Run:

  1. terraform plan over and over till the API bombs out.

References

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.

Domain name not found with FreeDNS domain

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 Version

Terraform v1.0.9
on linux_amd64

Namecheap provider version

2.0.1

Affected Resource(s)

  • namecheap_domain_records

Terraform Configuration Files

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"
	}
}

Debug Output

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" {
│ 
╵

Panic Output

Expected Behavior

It should run terraform plan successfully.

Actual Behavior

The first run is ok.
But from the second run, the provider fails to run, with the error

Error: Domain name not found (2019166)

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply -auto-approve
  2. terraform plan (without any change to the configuration)

Important Factoids

NOTE: transa.ng is a FreeDNS domain. (I bought it from another DNS provider and control it within Namecheap).

References

Terraform v0.12.0-beta1 compatibility

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?

Provider warning for missing api_key, api_user, and user_name even when using NAMECHEAP_* environment variables

Terraform Version

Terraform v1.4.5
on linux_amd64
+ provider registry.terraform.io/namecheap/namecheap v2.1.0

Namecheap provider version

namecheap/namecheap v2.1.0

Affected Resource(s)

The namecheap Terraform provider.

Terraform Configuration Files

Irrelevant for this report.

Debug Output

Irrelevant for this report.

Expected Behavior

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 {}

Actual Behavior

My IDE warns me that api_key, api_user, and user_name are required and missing:

Screenshot from 2023-04-26 18-58-12

Luckily, this is only a warning, because supplying the appropriate NAMECHEAP_* environment variables works as expected.

Steps to Reproduce

Given a Terraform config:

  1. Add namecheap version 2.1.0 as a required provider
terraform {
  required_providers {
    # Other provider data...
    
    namecheap = {
      source = "namecheap/namecheap"
      version = "2.1.0"
    }
  }
}
  1. Create a namecheap provider with no arguments:
provider namecheap {}
  1. Depending on the capabilities of your IDE, you should have a warning of sorts pop up. For reference, I'm using IntelliJ IDEA Ultimate with the official Terraform plugin.

Important Factoids

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.

If you don't own the domain, state gets jacked up

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.

Terraform Version

0.12

Namecheap provider version

latest tagged release

Affected Resource(s)

Please list the resources as a list, for example:

  • namecheap_record

Terraform Configuration Files

N/A

Debug Output

See above

Panic Output

See above

Expected Behavior

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?

Actual Behavior

💥

Steps to Reproduce

  • I had an "A" record for a domain "adipdx.com" that I did own.
  • tf apply->success
  • I accidentally changed the domain name to something I didn't own ex. "adipix.com"
  • tf apply->error
  • hash record doesn't exist error.

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.

Important Factoids

I am a computer

References

N/A

Record gets created but terraform apply times out on Creating.

Terraform Version

Terraform v0.11.10
v1.0.0 Release for Namecheap provider on osx

Affected Resource(s)

namecheap_record

Debug Output

None provided after TF_LOG=info defined..

Expected Behavior

Apply completes

Actual Behavior

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.

Output

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)

Steps to Reproduce

  1. terraform apply

FreeDNS subdomain records are all incorrectly going to the root domain

Terraform Version

Terraform v1.3.3
on linux_amd64

Namecheap provider version

+ provider registry.terraform.io/namecheap/namecheap v2.1.0

Affected Resource(s)

  • namecheap_domain_records

Terraform Configuration Files

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."
	}
}

Debug Output

Panic Output

Expected Behavior

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.

Actual Behavior

The records for subdomain sub.example.com are configured to the root domain example.com.

Steps to Reproduce

  1. terraform apply

Important Factoids

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.

References

root is waiting for 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]

Add support for email redirect rules

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.

  • Terraform Version: v1.x
  • Namecheap provider version: v2.1.1

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]"
  }
}

Failed to create namecheap Record: Invalid record type

Terraform Version

Terraform v0.12.25
+ provider.http v1.2.0
+ provider.namecheap (unversioned)

Namecheap provider version

Both built from source and Release v1.5.0

Affected Resource(s)

  • namecheap_record

Terraform Configuration Files

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"
}

Debug Output

https://gist.github.com/cyberbutler/39753094328b7a623a5ebc5004e507ac

Expected Behavior

What should have happened?
Valid Record Type A should have been passed to the Namecheap Go API Successfully

Actual Behavior

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" {

Steps to Reproduce

  1. Configure the above terraform resources
  2. terraform apply

Important Factoids

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?

Unable to create MX records

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
}


}

Provider 2.0.0+ Import?

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
  • I am attempting to use the namecheap provider to import state for an already configured domain.
  • I am not attempting to use the import process to migrate a pre-2.0.0 Terraform configuration - this is a new config started with the 2.0.2 provider.
  • I have working API access and have confirmed that my TF config can modify domains I own (tested with 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!

This provider isn't production ready / this provider has big issues

Terraform Version

Terraform v0.15.4
on linux_amd64

Namecheap provider version

robgmills/namecheap 1.7.0

My goal

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.

Issues

  • Why do I need to give my IP ? Can't the namecheap server figure it out ?!
    Why do I have to create 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 !
  • Why do I need to use robgmills/namecheap ? Isn't the git repo namecheap/terraform-provider-namecheap ?
    Why am I running v1.7.0 when the latest release on namecheap/terraform-provider-namecheap is 1.6.0 ?
  • Knowing how buggy this thing is, why is it at 1.7.0 and not 0.1.7 ? Why isn't there a disclaimer "not ready for production use" ?

[ATTENTION] Complete project refactoring

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.

Current approach & issues

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).

Refactoring proposal

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 🥂

Terraform 0.12 `timeouts` param on resources

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.

Terraform Version


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

Namecheap provider version

1.3.0

Affected Resource(s)

Please list the resources as a list, for example:

  • namecheap_record
  • probably the ns one too

Terraform Configuration Files

# 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.

Debug Output

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

Panic Output

N/A

Expected Behavior

No warning

Actual Behavior

warning message

Steps to Reproduce

Maybe go from 0.11 to 0.12 to see this?

Important Factoids

The earth is not flat

References

https://www.terraform.io/docs/configuration/resources.html#operation-timeouts

Namecheap Provider not using provided API Credentials on initialization in .tf file

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"
  }
}

How do I import an already created/setup domain?

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

tf 0.13

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

Apply for `namecheap_record` does not apply and doesn't time out

Terraform Version

Terraform v0.11.13

Affected Resource(s)

namecheap_record

Terraform Configuration Files

resource "namecheap_record" "subdomain" {
  count   = "${length(var.subdomains)}"
  domain  = "${var.domain}"
  name    = "${element(var.subdomains,count.index)}"
  address = "partners.vacasa.com"
  type    = "CNAME"
}

Debug Output

Still creating... (45m31s elapsed)

Panic Output

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

Expected Behavior

Either it times out or creates the record

Actual Behavior

What actually happened?
I tried to apply one namecheap_record resource, and has been hanging on Still creating... for 45 minutes.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Are there anything atypical about your accounts that we should know?

Using a sandbox account, hesitant to try on production.

References

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

NameCheap Whitelisted IPs

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?

User not found

Terraform Version

Terraform v1.3.4
on darwin_amd64

Namecheap provider version

  • provider registry.terraform.io/namecheap/namecheap v2.1.0

Terraform Configuration Files

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
}

Expected Behavior

I should be able to create a DNS record

Actual Behavior

Error

Error: Username does not exist (1019103)

Steps to Reproduce

terraform apply

OVERWRITE Mode does not warn about removing manual records

Terraform Version

v1.0.4

Namecheap provider version

v2.0.2

Affected Resource(s)

Please list the resources as a list, for example:

  • namecheap_domain_records

Terraform Configuration Files

resource "namecheap_domain_records" "my-domain-com" {
  domain = "some.domain"
  mode = "OVERWRITE"
  email_type = "NONE"

  record {
    hostname = "hostname"
    type = "CNAME"
    address = "some.address"
  }

}

Debug Output

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.

Expected Behavior

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.

Actual Behavior

Only says it is adding a resource, not deleting (outside of terraform, but still under the api call).

Steps to Reproduce

  1. terraform apply

Important Factoids

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.

Error if CAA 'iodef' record defined

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 Version

Terraform v1.4.6

  • provider registry.terraform.io/namecheap/namecheap v2.1.0

Namecheap provider version

What version of terraform-provider-namecheap are you using? 2.1.0

Steps to Reproduce

  1. Create a CAA record such as below in the zone file on Namecheap
CAA Record
@
iodef
"mailto:[email protected]"
  1. Create Namecheap resource block
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
    }
}
  1. Run 'terraform apply'
  2. Output is an error such as below.

Error: Records[10].Address "0 iodef "mailto:[email protected]"" must contain a protocol prefix for CAA iodef record

Whitelist IPs for known CICD providers

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.

Allow IPs for Terraform Cloud

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.

Terraform Version

1.0.11

Namecheap provider version

2.0.2

Expected Behavior

I should be able to use Terraform Cloud as my backend and perform an apply from there.

Actual Behavior

$ 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" {
│ 
╵

Steps to Reproduce

  1. Use Terraform Cloud (the service, not self-hosted) as the backend.
  2. terraform apply

unable to create sample dns record.

Terraform Version

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.

Namecheap provider version

Terraform v1.5.7
on darwin_arm64

  • provider registry.terraform.io/hashicorp/http v3.4.1
  • provider registry.terraform.io/namecheap/namecheap v2.1.2

Affected Resource(s)

Please list the resources as a list, for example:

  • namecheap_domain_records

Terraform Configuration Files

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"
  }
}

Debug Output

https://gist.github.com/madelaney/51953e135fed33cddde6fd7f511fe924

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

I would have expected a new DNS A record to be created.

Actual Behavior

An error was thrown

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform apply

CNAME record error

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.

Nameserver array missing trailing dot

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.