How do I make pulumi re-generate a random id only ...
# general
b
How do I make pulumi re-generate a random id only if a given resource has changed? I'm using Azure and Azure Functions will take a long time to notice that my function's code has changed if I don't change the blob's file name, but I don't want to upload a new version if nothing in my code has changed.
e
A random ID using the RandomId resource? Or something else? If your using the RandomId resource then it have a look at the
keepers
parameter: https://www.pulumi.com/registry/packages/random/api-docs/randomid/#keepers_nodejs
b
But I would have to change this variable (I'd) manually, right? I don't have a way of doing that. I could use the hash of the archive generated by FileArchive and use that as an id, but I don't think Pulumi allows that.
e
but I don't want to upload a new version if nothing in my code has changed
I'm pretty sure Pulumi will be doing this for you anyway. I don't think you need to be duplicating these checks.
b
Azure is taking a long time to notice that the zip file, which has the same name as before, now has a different content. That's my main issue: Azure Functions take a long time to notice a change if I keep the file name the same.
e
One suggestion to try is setting replaceOnChanges="source" on the blob so it gets recreated when your content changes, that should give it a new name which hopefully triggers the azure function to pick it up faster.