title: Ansible Deleting AWS Route53 TXT records
body: <p>I'm trying to delete AWS Route53 TXT records using Ansible</p>
  <p>This is a section of my playbook</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: &quot;Retrieve the details for {{ item }}.{{ build_number }}.{{ internal_domain }} TXT Record&quot;
    community.aws.route53:
      state: get
      private_zone: true
      record: &quot;{{ item }}.{{ build_number }}.{{ internal_domain }}&quot;
      type: TXT
      zone: &quot;{{ internal_domain }}&quot;
    register: rec_TXT
  
  - name: display record
    debug: var=rec_TXT
  
  - name: &quot;Delete {{ item }}.{{ build_number }}.{{ internal_domain }} TXT Record&quot;
    community.aws.route53:
      state: absent
      private_zone: true
      record: &quot;{{ rec_TXT.set.record }}&quot;
      ttl: &quot;{{ rec_TXT.set.ttl }}&quot;
      type: &quot;{{ rec_TXT.set.type }}&quot;
      value: &quot;{{ rec_TXT.set.value | string }}&quot;
      zone: &quot;{{ rec_TXT.set.zone }}&quot;
    when: rec_TXT.set | length &gt; 0
  </code></pre>
  <p>this results in the error</p>
  <pre><code>    &quot;msg&quot;: &quot;[Tried to delete resource record set [name='dashboard.uat1tx.test.xyz.internal.', type='TXT'] but the rdata provided is invalid]&quot;
  </code></pre>
  <p>When running the playbook in verbose mode (-vvv)
  the <strong>get</strong> request produces</p>
  <pre><code>ok: [localhost] =&gt; {
      &quot;rec_TXT&quot;: {
          &quot;changed&quot;: false,
          &quot;failed&quot;: false,
          &quot;nameservers&quot;: [
              &quot;ns-1536.awsdns-00.co.uk.&quot;,
              &quot;ns-0.awsdns-00.com.&quot;,
              &quot;ns-1024.awsdns-00.org.&quot;,
              &quot;ns-512.awsdns-00.net.&quot;
          ],
          &quot;set&quot;: {
              &quot;alias&quot;: false,
              &quot;failover&quot;: null,
              &quot;health_check&quot;: null,
              &quot;hosted_zone_id&quot;: &quot;HIAAGVXXXXPM9&quot;,
              &quot;identifier&quot;: null,
              &quot;record&quot;: &quot;dashboard.uat1tx.test.xyz.internal.&quot;,
              &quot;region&quot;: null,
              &quot;ttl&quot;: &quot;300&quot;,
              &quot;type&quot;: &quot;TXT&quot;,
              &quot;value&quot;: &quot;\&quot;heritage=external-dns,external-dns/owner=SST4985-EKSCluster-uat1tx,external-dns/resource=service/default/k8s-dashboard-kubernetes-dashboard\&quot;&quot;,
              &quot;values&quot;: [
                  &quot;\&quot;heritage=external-dns,external-dns/owner=SST4985-EKSCluster-uat1tx,external-dns/resource=service/default/k8s-dashboard-kubernetes-dashboard\&quot;&quot;
              ],
              &quot;weight&quot;: null,
              &quot;zone&quot;: &quot;test.xyz.internal.&quot;
          }
      }
  }
  </code></pre>
  <p>The <strong>absent</strong> play produced</p>
  <pre><code>The full traceback is:
    File &quot;/tmp/ansible_community.aws.route53_payload_xb_ilskb/ansible_community.aws.route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py&quot;, line 687, in main
    File &quot;/tmp/ansible_community.aws.route53_payload_xb_ilskb/ansible_community.aws.route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py&quot;, line 457, in invoke_with_throttling_retries
    File &quot;/tmp/ansible_community.aws.route53_payload_xb_ilskb/ansible_community.aws.route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py&quot;, line 453, in invoke_with_throttling_retries
    File &quot;/tmp/ansible_community.aws.route53_payload_xb_ilskb/ansible_community.aws.route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py&quot;, line 428, in commit
    File &quot;/tmp/ansible_community.aws.route53_payload_xb_ilskb/ansible_community.aws.route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py&quot;, line 422, in commit
    File &quot;/usr/local/lib/python3.8/site-packages/boto/route53/record.py&quot;, line 168, in commit
      return self.connection.change_rrsets(self.hosted_zone_id, self.to_xml())
    File &quot;/usr/local/lib/python3.8/site-packages/boto/route53/connection.py&quot;, line 473, in change_rrsets
      raise exception.DNSServerError(response.status,
  fatal: [localhost]: FAILED! =&gt; {
      &quot;changed&quot;: false,
      &quot;invocation&quot;: {
          &quot;module_args&quot;: {
              &quot;alias&quot;: null,
              &quot;alias_evaluate_target_health&quot;: false,
              &quot;alias_hosted_zone_id&quot;: null,
              &quot;aws_access_key&quot;: null,
              &quot;aws_ca_bundle&quot;: null,
              &quot;aws_config&quot;: null,
              &quot;aws_secret_key&quot;: null,
              &quot;debug_botocore_endpoint_logs&quot;: false,
              &quot;ec2_url&quot;: null,
              &quot;failover&quot;: null,
              &quot;health_check&quot;: null,
              &quot;hosted_zone_id&quot;: null,
              &quot;identifier&quot;: null,
              &quot;overwrite&quot;: null,
              &quot;private_zone&quot;: true,
              &quot;profile&quot;: null,
              &quot;record&quot;: &quot;dashboard.uat1tx.test.xyz.internal.&quot;,
              &quot;region&quot;: null,
              &quot;retry_interval&quot;: 500,
              &quot;security_token&quot;: null,
              &quot;state&quot;: &quot;absent&quot;,
              &quot;ttl&quot;: 300,
              &quot;type&quot;: &quot;TXT&quot;,
              &quot;validate_certs&quot;: true,
              &quot;value&quot;: [
                  &quot;\&quot;\&quot;heritage=external-dns&quot;,
                  &quot;external-dns/owner=SST4985-EKSCluster-uat1tx&quot;,
                  &quot;external-dns/resource=service/default/k8s-dashboard-kubernetes-dashboard\&quot;\&quot;&quot;
              ],
              &quot;vpc_id&quot;: null,
              &quot;wait&quot;: false,
              &quot;wait_timeout&quot;: 300,
              &quot;weight&quot;: null,
              &quot;zone&quot;: &quot;test.xyz.internal.&quot;
          }
      },
      &quot;msg&quot;: &quot;[Tried to delete resource record set [name='dashboard.uat1tx.test.xyz.internal.', type='TXT'] but the rdata provided is invalid]&quot;
  }
  </code></pre>
  <p>The issue is with the commas in the values.</p>
  <p>Someone has raised an issue, but no tips provided. <a href="https://github.com/ansible/ansible/issues/58084" rel="nofollow noreferrer">https://github.com/ansible/ansible/issues/58084</a></p>
  <p>How can I pass the 'literal' sting the the value option?</p>
  <p>Can anyone provide any tips/solutions please?!!!</p>