1
Fork 0
satellite/scripts/dns/delete-all-records.sh

15 lines
538 B
Bash
Raw Permalink Normal View History

2024-05-09 04:12:28 +02:00
zoneid=$1
bearer=$2
2024-08-27 13:54:32 +02:00
2024-05-09 04:12:28 +02:00
# Taken from https://developers.cloudflare.com/dns/zone-setups/troubleshooting/delete-all-records/
curl --silent "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records?per_page=50000" \
--header "Authorization: Bearer $bearer" \
| jq --raw-output '.result[].id' | while read id
do
2024-08-27 13:54:32 +02:00
echo "🧹 Deleting '$id' record in zone '$zoneid'"
2024-05-09 04:12:28 +02:00
curl --silent --request DELETE "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records/$id" \
--header "Authorization: Bearer $bearer"
done
2024-08-27 13:54:32 +02:00
echo "🚀 All done!"