Provided object is not valid. Got a InvalidObject error with message Quotation marks should be escaped with backslash.7.x
There are two contributing causes to this issue:
DNS Protocol Constraint:
RFC 1035 specifies that a single character string within a TXT record cannot exceed 255 octets. Records longer than this (such as 2048-bit DKIM keys) must be split into multiple quoted strings within a single record.
CLI/Shell Parsing:
The OpenStack CLI and local shell environments often strip the backslash escape characters (\") needed to define multiple strings inside a JSON payload. This causes the Designate API to receive malformed JSON.
Workaround:
Obtain Authentication Details
Retrieve your current authentication token and the public DNS endpoint URL:
export OS_TOKEN=$(openstack token issue -c id -f value)
export DNS_ENDPOINT=$(openstack endpoint list --service dns --interface public -c URL -f value)
Format the Payload:
Split the long DKIM string into two parts (e.g., ~240 characters and the remainder). Ensure they are wrapped in escaped quotes (\") and separated by a space.
Execute the Request:
Run the following command, replacing <ZONE_ID>, <RECORD_NAME>, and the key segments with your specific values:
curl -X POST "$DNS_ENDPOINT/v2/zones/<ZONE_ID>/recordsets" \ -H "X-Auth-Token: $OS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "<RECORD_NAME>", "type": "TXT", "ttl": 3600, "records": [ "\"v=DKIM1; k=rsa; p=PART_1_OF_KEY...\" \"...PART_2_OF_KEY\"" ] }'
DNS resolvers automatically concatenate multiple strings returned in a single TXT record. The space between the split strings in the JSON payload is necessary for Designate to parse them as separate arguments, but it is ignored by the resolver during concatenation.