cloudflared icon indicating copy to clipboard operation
cloudflared copied to clipboard

Automatic DNS record removal option

Open danthegoodman1 opened this issue 4 years ago • 6 comments

When using the single liner like seen here https://developers.cloudflare.com/cloudflare-one/tutorials/single-command it would be really nice if there was an extra flag that could be passed to delete the DNS record on exit. Maybe something like --clean so that when the cloudflared execution ends the DNS record is deleted.

This is useful for when you have relatively or very ephemeral tunnels that have unique subdomains.

danthegoodman1 avatar Jan 19 '22 00:01 danthegoodman1

I'll add that the current solution is to catch SIGTERM and run 2 API calls to delete the record (get record ID from a query, then delete with that ID).

danthegoodman1 avatar Jan 19 '22 02:01 danthegoodman1

I also imagine some CF side thing would be useful so that even if the process crashes, after some time CF realizes the DNS record for that tunnel is no longer being used and cleans it

danthegoodman1 avatar Jan 19 '22 14:01 danthegoodman1

@danthegoodman1 this would be really useful.

Would Quick Tunnels work for your use case?

abelinkinbio avatar Jan 25 '22 16:01 abelinkinbio

@abelinkinbio I don't think so, since we need the subdomains from our DNS and Quick Tunnels does not seem to offer that. It does work in the case that we don't need the subdomains, but we do want the subdomain.

danthegoodman1 avatar Jan 25 '22 17:01 danthegoodman1

For example we have 2 containers running in a pod in k8s, and with quicktunnels I don't see how one container could ask the cloudflare container what the UUID is? Maybe I could have them share access to the file that cloudflared would write to

danthegoodman1 avatar Jan 25 '22 17:01 danthegoodman1

No, you're correct. That would be a fair concern here. Updating our CLI library isn't on the immediate roadmap as mentioned in #461, but when we do this will certainly make the cut.

abelinkinbio avatar Jan 25 '22 20:01 abelinkinbio