2

I had been not able to create a new CNAME for a specific managed-zone.

I can see there are examples for A and TXT entries like:

$ gcloud dns record-sets transaction add -z MANAGED_ZONE \
            --name my.domain. --ttl 1234 --type A "1.2.3.4"

$ gcloud dns record-sets transaction add -z MANAGED_ZONE \
            --name my.domain. --ttl 2345 --type TXT "Hello world" "Bye \
            world"

But I keep getting too few arguments error. Currently I'm issuing:

$ gcloud dns record-sets -z=MYZONE transaction add\
            --name="NAME" --type=CNAME --ttl 3600 --rrdatas="DEST"

I guess the issue is related to the rrdatas field but I have been unable to find any documentation.

Lorenzo
  • 21
  • 2

2 Answers2

5

The command does not have a rrdatas flag. You can just put the value you want for rrdatas at the end of the command as a positional argument. Also, note that the -z zone flag should be provided after all the commands. So:

$ gcloud dns record-sets -z=MYZONE transaction add --type=CNAME \
  --name="www.example.com." --ttl 3600 --rrdatas="target.example.com."

should be changed to this:

$ gcloud dns record-sets transaction add -z=MYZONE --type=CNAME \
  --name="www.example.com." --ttl 3600 "target.example.com."
Vilas
  • 1,405
  • 12
  • 15
mimming
  • 13,974
  • 3
  • 45
  • 74
0

According to the record types documented on the API, note that the rrdatas value should point to a valid record or must end with periods (.) in the case of fully-qualified DNS names.