Need some advice on Updating Subdomain IPs and MX Records with Cloudflare

I need some advice on two questions about using Cloudflare for my domain currently managed by Gandi. Any guidance would be greatly appreciated!

  1. Automatically updating IP addresses of non-proxied subdomains

I have a home web server running a few subdomains on my personal domain mydomain.com. I currently use a Python script that automatically updates the IP addresses of these subdomains in Gandi when my home IP changes.

If I move management of mydomain.com to Cloudflare, how can I continue to automatically update the IP addresses of the non-proxied subdomains? Is there a way to do this through the Cloudflare API from my Python script? Is there a better solution?

The goal is to have another subdomain of the primary domain proxied through Cloudflare Tunnel, but the other two subdomains need to remain non-proxied so they resolve to the correct IP address and use the current TLS certificates that I manage myself.

  1. MX and TXT records for email

I have MX and TXT records (provided by Apple) in Gandi so emails to @mydomain.com go to my email provider (which is icloud). If I move DNS management from Gandi to Cloudflare, will it affect these existing email records?

Any guidance on these two questions is appreciated. I need to understand how to automate IP updates and maintain email delivery when moving my domain to Cloudflare.

Thank you!

You should be able to update your script for use with the Cloudflare API.

Two high impact suggestions on DNS migration aside from TTLs, include disabling DNSSEC during the move and manually confirming all of your necessary records, such as MX, DKIM, etc, prior to changing the nameservers at your registrar.

This Community Tutorial has more resources.