Closed hashibot closed 6 years ago
Hi @kian, generally speaking Terraform tends to avoid overwriting any existing records to prevent stamping over another tool or a user, so in case there's an existing record you get 400 and this is intended behaviour.
That said I relabelled this issue as enhancement
because we could add support for import as you rightly mentioned in https://github.com/hashicorp/terraform/issues/13058#issuecomment-291629849
The import functionality won't be trivial to implement in this particular case though, because the DynDNS doesn't seem to provide a way to lookup a record based on ID. https://help.dyn.com/get-a-records-api/
Would https://help.dyn.com/get-all-records-api/ not be enough, with something like terraform import dyn_record.www www.example.com
?
This provider is not very useful as it stands for managing any existing records, which I imagine is often the case.
+1 on this. Spent a not insignificant amount of time migrating DNS records to Terraform only to discover I can't manage existing records and will have to delete/re-create. This might be OK if you only have a few, but I'm guessing the reason people want to manage their DNS with Terraform in the first place is because they have too many to manage manually.
This issue was originally opened by @kian as hashicorp/terraform#13058. It was migrated here as part of the provider split. The original body of the issue is below.
I am running into
400 Bad Request
errors when attempting to manage DNS records using the Dyn provider.The error goes away if I remove the records manually and have TF create them, but as this causes downtime, it is not ideal.
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
This contains sensitive zone data, I can provide it some other way if needed or produce a simplified test case. Given how easily the error reproduces I assume it's not very useful anyway.
Panic Output
N/A
Expected Behavior
I am hoping TF could notice the records already exist, only the TTL is different, and only update the TTL.
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
Seems to work if I first delete the existing records.