terraform-provider-dnsimple
terraform-provider-dnsimple copied to clipboard
Records with underscores in the name cannot be imported
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
Terraform v0.11.1
- provider.aws v1.13.0
- provider.dnsimple v0.1.0
Affected Resource(s)
-
dnsimple_record
- resource import functionality
Terraform Configuration Files
resource "dnssimple_record" "domain" {}
also via cli: terraform import dnsimple_record.domain _mydomain.com_1234
Expected Behavior
The record is imported into the terraform state.
Actual Behavior
Received the following:
Error importing: 1 error(s) occurred:
* dnsimple_record.domain (import id: _mydomain.com_1234): import dnsimple_record.domain (id:_mydomain.com_1234): Error Importing dnsimple_record. Please make sure the record ID is in the form DOMAIN_RECORDID (i.e. example.com_1234
Steps to Reproduce
- Create a DNSimple record with an underscore in it (e.g. my_domain.example.com)
- Create a
dnsimple_record
resource to import into - Run the import step as described in the provider documentation
Important Factoids
The issue is in the resourceDNSimpleRecordImport
func on line 191 of /dnsimple/resource_dnsimple_record.go
. The length check after splitting the input domain on _
expects there to be exactly two parts, when there is the possibility for domains with underscores in them (for instance, AWS ACM certificate validation records begin with an underscore).
Note that this only matters for apex domains with underscores since the ID of the record is [zone]_[id]
. I was able to import a record like foo._domainkey.example.com CNAME …
just fine via terraform import dnsimple_record.foo_dkim example.com_12345678
.