Reputation: 123
I have the following DNS zone configured in Google Cloud DNS:
Zone: test1
Record:
abc.test1.com. CNAME 300 xyz.test1.com.
Using gcloud on the command line I can list and obtain information just fine.
However, for some reason (and I had this working some time ago) I can no longer remove (delete) a zone record using these commands:
gcloud dns record-sets transaction start --zone=test1
gcloud dns record-sets transaction remove "abc.test1.com." --zone=test1 --name="xyz.test1.com." --type=CNAME --ttl=300
...at this point it fails with an error (so I cannot execute the transaction):
ERROR: (gcloud.dns.record-sets.transaction.remove) Record to be removed does not exist
Yet I know the record is there, which I can confirm with:
gcloud dns record-sets list -z test1
which displays:
abc.test1.com. CNAME 300 xyz.test1.com.
I'd appreciate any pointers.
Thanks
Upvotes: 0
Views: 3033
Reputation: 91
It looks to me you are getting confused between DNS record name and DNS record value. For the example that you have put up in your question, your CNAME record name is "abc.test1.com." and record value is "xyz.test1.com.". So in order to delete this record using gcloud, your command should be
gcloud dns record-sets transaction start --zone=test1
gcloud dns record-sets transaction remove "xyz.test1.com." --zone=test1 --name="abc.test1.com." --type=CNAME --ttl=300
gcloud dns record-sets transaction execute --zone=test1
Try it. This should work. Hope it helps!
Upvotes: 3