I want to create some scheduled cloud functions using the syntax below to define the schedule within the source code of the function:
exports.scheduledFunction = functions.pubsub.schedule('every 5 minutes').onRun((context) => { console.log('This will be run every 5 minutes!'); return null; }); I know that according to the documentation, this cloud function automatically creates a pub/sub topic to trigger the function according to the defined schedule. The docs warn against manually editing the pub/sub topic in the GCP console, as it could break the scheduling.
What they don't mention is how one goes about removing a pub/sub topic of a function that you want to delete or update.
Do I need to delete the function entirely and re-deploy it with the updated schedule details? Will that automatically delete the associated pub/sub topic as well? What if I just re-deploy the same function with different schedule details?