CompositionalIT / farmer

Repeatable Azure deployments with ARM templates - made easy!
https://compositionalit.github.io/farmer
MIT License
514 stars 156 forks source link

Deploying a function app overwrites the WEBSITE_CONTENTSHARE value #1090

Open duncanworthy opened 5 months ago

duncanworthy commented 5 months ago

I'm attempting to use the add_slot and zip_deploy_slot on the functions builder, but when I deploy, the value of WEBSITE_CONTENTSHARE is being set to the function app name without any suffix.

Once the staging slot is swapped to production and another deployment to staging takes place, both slots have the same WEBSITE_CONTENTSHARE value, which means that the deployment supposedly to staging has actually overwritten the files running on the production slot, completely defeating the purpose of having a staging slot.

The behaviour regading the WEBSITE_CONTENTSHARE value should follow Azure's defaults which is to use the function app name suffixed with a hyphen and then a series of 8 or 12 random alphanumeric characters to ensure uniqueness between slots. Furthermore, the value should be set on resource creation and then never modified on subsequent deployment, otherwise it could cause new fileshares to be created in the storage account each time if the suffix value changed.

ninjarobot commented 5 months ago

@duncanworthy do you have a working example or a template that shows the issue and the expected behavior / template instead?

I believe the issue is here since it's not giving the share name any randomness.