n3integration/terraform-provider-godaddy

Add a single record without removing existing records

guysaha1 opened this issue · 8 comments

I have a domain that I purchased from GoDaddy, let's call it "domain.com".

I want to use this plugin to add a dns record that maps my google_compute_instance which has a static google_compute_address to a subdomain, let's call it "subdomain.domain.com".

To do this I added a godaddy_domain_record resource with a single record.

The problem is that I have additional records which are used for "domain.com" and for other subdomains under it.
According to your documentation my configuration will cause Terraform to replace all my existing records with just that one record that I specified in my configuration (unless I misunderstood the documentation).

I don't want to specify all my dns records in my Terraform configuration, I only want to specify the ones that are used by this specific google_compute_instance. I also still want to be able to add dns records manually through the GoDaddy website.

I saw the following 2 closed issues that are related to my problem:
#14 #8
I understand that this behavior is by design, but I'd still like to have support for my use case using this plugin if possible.

@guysaha1 - if I understand the behavior described above, using Terraform's import feature might do the trick. Please let me know if this resolves the issue being described.

Hello, I'd like to use this provider from within Terraform Cloud.
So, having an already populated domain (with MX records for my business email and so on), I'd like to know how to proceed.
Should I first perform an import locally, extracting domain records from the state file?
Thanks in advance.

EDIT I've performed " terraform import godaddy_domain_record.fsimonetti-eu fsimonetti.eu" but I can't find any NS records within the state file.

Attached you can find the output of "host -t ns" for my domain, my starting point main.tf, the command I performed, and an edited representation of the state file.

terraform-state-godaddy-fsimonetti-eu.txt

@n3integration I have come across the same issue as @guysaha1. I would like to simply write a single record into my domain but the plugin will erase all other records on apply. I think the terraform import command would solve this problem for me but based on the documentation seems tedious. Do you have any suggestions on how to import all the records of the domain before writing the new one in?

Same here as guysaha1. Do you have any suggestions on how to import all the records of the domain before writing the new one in?

Hi,

I am facing the same issue. I am trying to add just a single record based on automation every time we create a new server that needs an URL, however, when the record is added it will wipe out all other records.

For example, if you use ACME to add ssl automatically, it will add a new TXT record in godaddy next to the other records, but if I add a record using terraform, it will not append, it will remove the others and keep only this record.

I was thinking if there is a way to have the record as a resource in main.tf, not the domain.com as resource, maybe this will fix so all records are individual rather than domain.com.

Does this make sense ?

To those interested in this ticket: check out https://github.com/anna-kampani/terraform-provider-godaddy. They appear to have forked and solved this problem.

To those interested in this ticket: check out https://github.com/anna-kampani/terraform-provider-godaddy. They appear to have forked and solved this problem.

Facing similar issues, I've decided to re-implement provider from scratch to operate on record level.