Comments (18)
Importing isn't supported by the provider (yet), but can be added. The Terraform schema.Resource
struct offers an Importer
field to handle that logic. I can try and add something in the next day or two.
https://www.terraform.io/docs/extend/resources.html#importers
https://godoc.org/github.com/hashicorp/terraform/helper/schema#Resource
from terraform-provider-namecheap.
That would be great. I always just buy them through Namecheap but never actually use their settings, I always just change the NS to something else. I have a few dozen domains there, so it would be super useful to be able to import them all and be able to mass change their records all at once. Huge time saver. Do you know off hand if configuring the "Basic DNS" which only has a few NS records and that is it, is different from configuring the "Advanced DNS" which is just normal dns settings that you would use for NS, A, MX, etc? I am wondering if there might be some sort of flag that needs to be set on the domains own entry. Something like
(This is, of course, just an example because I have no idea how it actually works or is structured)
resource "namecheap_domain" "mydomain" {
domain = "${var.domain}"
type = "BasicDNS"
}
I definitely appreciate the work you have put into this. I only recently started using TF for CloudFlare, so when I came across this one, I was really excited about the amount of time I could save between the two. : D
from terraform-provider-namecheap.
Whenever you happen to have the time to make the update, if you would not mind sending a quick reply here so I know, or just close this, I would be most grateful!
Thanks again,
-MH
from terraform-provider-namecheap.
I think I've got a PR for this. It works on one of my domains (root A record and subdomain), but I'd like others to try it. Can y'all pull that branch down, or would a pre-release binary be easier?
from terraform-provider-namecheap.
I can snag the branch and have a go at it. Is it 11.x or 12.x?
from terraform-provider-namecheap.
from terraform-provider-namecheap.
Never mind, it would be easier if you just made a build, lol. I am not getting import errors on the package saying there is a circular dependency.
from terraform-provider-namecheap.
@MostHated Sure thing, try out 1.4.0-rc1
https://github.com/adamdecaf/terraform-provider-namecheap/releases/tag/1.4.0-rc1
from terraform-provider-namecheap.
I am wondering if there is some sort of necessary differentiation between the different types of DNS. All of my domains use "Basic" / "Custom" DNS, which as seen below simply gives you the option to point the nameservers to another provider, nothing more. I believe you have to change it to a different mode in order to get the normal entries like A, CNAME, MX, etc.
I attempted to run the following setup.
variable "domain" {
default = "mydomain.com"
}
provider "namecheap" {
username = "${var.username}"
api_user = "${var.api-user}"
token = "${var.api-access-token}"
ip = "${var.ip}"
use_sandbox = "${var.use-sandbox}"
}
resource "namecheap_record" "mydomain-ns1" {
domain = "${var.domain}"
name = "ns1"
address = "dave.ns.cloudflare.com"
type = "NS"
}
resource "namecheap_record" "mydomain-ns2" {
domain = "${var.domain}"
name = "ns2"
address = "joan.ns.cloudflare.com"
type = "NS"
}
and then I ran this based on your example.
terraform import -var-file=variables.tfvars namecheap_record.mydomain-ns1 'mydomain.com/NS/dave.ns.cloudflares.com'
but unfortunately I got the error of:
terraform import -var-file=variables.tfvars namecheap_record.mydomain-ns2 'mydomain.com/NS/dave.ns.cloudflares.com'
namecheap_record.mydomain-ns2: Importing from ID "mydomain.com/NS/dave.ns.cloudflares.com"...
namecheap_record.mydomain-ns2: Import complete!
Imported namecheap_record
namecheap_record.mydomain-ns2: Refreshing state... [id=mydomain.com/NS/dave.ns.cloudflares.com]
Error: read: problem finding record for mydomain.com/NS/dave.ns.cloudflares.com: Could not find the record with hash 2978406536
It looks like a state file was created, though not sure if that was just automatic during init or not, but it is currently empty.
Any suggestions?
from terraform-provider-namecheap.
Try cloudflare.com
instead of cloudflares.com
from terraform-provider-namecheap.
I was initially excited that it might have been simply a silly mistake that was keeping it from working, but strangely it still came back with the same error after fixing and trying again. I tried to see what would happen if I just applied it, but it just sat there repeating "Still creating" over and over for quite some time.
from terraform-provider-namecheap.
Is there a terraform.tfstate file from before? You might try renaming that and doing the import again.
from terraform-provider-namecheap.
No, there wasn't one initially. When I started I started fresh with a new folder and 0 files. So it was created during this process of trying it out.
from terraform-provider-namecheap.
Strange.. Can you share the output of an import and re-apply that doesn't complete?
from terraform-provider-namecheap.
from terraform-provider-namecheap.
This is interesting. I was looking through the namecheap api as well as your code and I came across this in your repo.
func resourceNameCheapNSUpdate(d *schema.ResourceData, meta interface{}) error {
return resourceNameCheapNSCreate(d, meta)
}
When I saw that I figured it was worth a try.
resource "namecheap_ns" "mydomain-ns1" {
domain = "${var.domain}"
servers = ["dave.ns.cloudflare.com", "joan.ns.cloudflare.com", "test.ns.namecheap.com"]
}
It didn't let me import it, but when I ran the above, what do you know... it worked!
Looking at the last update of that file, it looks like it has been there for some time?
from terraform-provider-namecheap.
Oh right, namecheap_ns
has been there to set the NS records. I thought you could set the NS records with namecheap_record
, but I suppose not. Does this solve the issue for you?
from terraform-provider-namecheap.
Based on a few tests that I have run, it looks like everything is good. 👍 Now I just have to work with the fella who made the G-Suite provider. 😄
I am pretty close to having things setup just as I wished, I appreciate the assistance.
from terraform-provider-namecheap.
Related Issues (20)
- This provider isn't production ready / this provider has big issues HOT 7
- [ATTENTION] Complete project refactoring HOT 22
- NameCheap Whitelisted IPs HOT 5
- Domain name not found with FreeDNS domain HOT 10
- Allow IPs for Terraform Cloud HOT 10
- Provider 2.0.0+ Import? HOT 4
- OVERWRITE Mode does not warn about removing manual records HOT 1
- Whitelist IPs for known CICD providers HOT 5
- Terraform import record with nameservers incorrectly setting mode to "IMPORT" HOT 2
- Nameserver array missing trailing dot HOT 2
- User not found HOT 1
- FreeDNS subdomain records are all incorrectly going to the root domain HOT 1
- Provider warning for missing api_key, api_user, and user_name even when using NAMECHEAP_* environment variables HOT 1
- Error if CAA 'iodef' record defined HOT 5
- Ability to update the domain contact record information HOT 1
- Namecheap Provider not using provided API Credentials on initialization in .tf file HOT 1
- Feature request: `namecheap_nameserver` resource to register new nameservers HOT 3
- Support for dnssec HOT 5
- Add support for email redirect rules HOT 1
- unable to create sample dns record. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-namecheap.