namecheap / terraform-provider-namecheap

Terraform provider for Namecheap
Apache License 2.0
146 stars 30 forks source link

Terraform import record with nameservers incorrectly setting mode to "IMPORT" #68

Open nquayson opened 2 years ago

nquayson commented 2 years ago

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"

https://github.com/namecheap/terraform-provider-namecheap/blob/master/namecheap/namecheap_domain_record.go#L17

anorborg commented 2 years ago

Just to add more details here, when following the import instructions, described here:

https://github.com/namecheap/terraform-provider-namecheap/blob/master/docs/resources/domain_records.md#import

Then attempting a plan or apply will result in a prompt of a potential change (even though none should be occurring):

Terraform will perform the following actions:

  # namecheap_domain_records.mydomain-com will be updated in-place
  ~ resource "namecheap_domain_records" "mydomain-com" {
        id          = "mydomain.com"
      ~ mode        = "IMPORT" -> "MERGE"
        # (2 unchanged attributes hidden)
    }

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

The import seems to set the mode to IMPORT even though according to the docs (and terraform) this is not a valid option. Perhaps to will not cause any issue, but the expectation would be no changes occurring and it would be preferred to be confident that no changes are occurring for a domain record so you are not worried it might create an unknown issue.

vetal2409 commented 9 months ago

Thanks for reporting! I will keep you updated with the status here.