gcloudgoogle-cloud-dns

How to add long txt recordset to gcloud dns in the terminal?


In gcloud console panel, to add long txt recordset (over 255) need to add dividing the string in multiple string with quotes like this (In the example I split it by word, but you have to split it every 255 chars): original string = "loren inpsum" gcloud format = "loren ""inpsum"

But if I try to add a long txt record via terminal, I get an error if I not split it, and if I split it I get multi rrdata, which I dont want that.

Not spliting example: (error 400 invalid rdata)

gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" --ttl 300 --type TXT --zone {zone} --name

Example spliting: (this error create multiple rdata)

gcloud dns record-sets transaction add mail._domainkey.example.com. "{rdata}" "{rdata1}" --ttl 300 --type TXT --zone {zone} --name

Thanks for any clue

[edit]

google doc: https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/transaction/add examples: this give rdata value error

gcloud dns record-sets transaction add --name mail._domainkey.example.com. "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqThYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB" --ttl 300 --type TXT

this create multi value

gcloud dns record-sets transaction add --name mail._domainkey.example.com. "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqT" "hYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB" --ttl 300 --type TXT

[SOLUTION] I find the solution '"string1""string2""string3"'

like this

gcloud dns record-sets transaction add --name mail._domainkey.example.com. '"v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqT" "hYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB"' --ttl 300 --type TXT

Solution

  • The solution would be two double quotes eg: "string1""string2""string3"' as posted by @Mariano DAngelo

    Actual command:

    gcloud dns record-sets transaction add --name mail._domainkey.example.com. '"v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuStUNDJvpZcJpS4awOyD/I4H910zxR1JbrW4DhvHLcIr+ry5TkRvHp+H66LnYyOZVsU8G8S0u8Sftv1kK633M+HJLc0GBaFEFYEpyEwAUvs20S7FoPThz0ZFfxEDTPyww00BWv5BSIUA0HPPpKLHDlDtFr2r/rt9S7IGOLQ0oMm5bDgHZR1UXPbAsFSpcWAkLf5i8SDD0UPVqauqT" "hYKWk0CsVcdF3L7OGQIVK21eVlHVb23e7FBfwO6tDZJQnpaV3LdLSzWPYSB2VeaQAIpZfaKMzmJJW/v0pnQZ2UD9WWaj3X4a+1VVLfx97CqiQigqMpbcrzrnhHGz6pwjEPwowIDAQAB"' --ttl 300 --type TXT