Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

staticSites API is not idempotent -- requires isForced query parameter for redeployment #7500

Open
itpropro opened this issue Jul 6, 2022 · 5 comments

Comments

@itpropro
Copy link
Contributor

itpropro commented Jul 6, 2022

Is your feature request related to a problem? Please describe.

There is a nearly 1 year old implementation issue in the Static Web Apps (staticSites) provider that blocks idempotent deployments when user defined function apps are used (Azure/static-web-apps#576).
The problem is that as soon as the userDefinedFunction property was set once, it cannot be overwritten and the resource provider even throws a error with the exact same configuration because the field seems to be write protected internally.
There is a uri parameter called isForced that has to be set to overwrite this property, but it is only available in the REST API (https://docs.microsoft.com/en-us/rest/api/appservice/static-sites/register-user-provided-function-app-with-static-site#uri-parameters) and that should be used like this

PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/userProvidedFunctionApps/testFunctionApp?isForced=true&api-version=2021-02-01

Is there any way in Bicep or ARM templates to reference URI parameters or has anyone an idea of a proper workaround to be able to use IaC with staticSites?

@itpropro itpropro added the enhancement New feature or request label Jul 6, 2022
@ghost ghost added the Needs: Triage 🔍 label Jul 6, 2022
@anthony-c-martin
Copy link
Member

Just confirming that there is no capability to add parameters to the PUT query string through Bicep or ARM Templates.

I can't comment on whether there is another workaround for staticSites in Bicep.

@itpropro
Copy link
Contributor Author

itpropro commented Jul 6, 2022

Thanks for confirming @anthony-c-martin! Do you know if there is any guidance for the development of resource providers to avoid uri parameters to be compatible with IaC?

@alex-frankel
Copy link
Collaborator

The guidance to all RPs is to make sure all of their resources are deployable via ARM Templates/bicep, so if a query string parameter is required for deployment, they should change that such it is in the PUT request body.

The more concerning part of what you are reporting is that the API is not idempotent. It is ok for a property to not be modifiable, but if there were no property changes then it should re-deploy successfully.

I would recommend opening a support case for this one. @seligj95 / @naveedaz -- do you have a good contact on the static sites team that can help look into this?

@itpropro
Copy link
Contributor Author

itpropro commented Jul 7, 2022

Exactly, I don't think it's a problem in general, if some parameters like isForced are being exposed later with a newer api version, but unfortunately, the parameter is required for idempotency. Thereby it blocks every ARM/Bicep deployment and management of staticSites that have a customer function app deployed. Maybe Terraform would work, as they use REST APIs, but the Terraform provider doesn't have functionality regarding user provided function apps at all.
I am currently working on some submodules for CARML for the staticSites provider, if a reproduction repository is needed, I can provide one.

@alex-frankel alex-frankel removed Needs: Triage 🔍 enhancement New feature or request labels Jul 7, 2022
@alex-frankel alex-frankel changed the title Possible to provide uri parameters? staticSites API is not idempotent -- requires isForced query parameter for redeployment Jul 7, 2022
@itpropro
Copy link
Contributor Author

@BandaruDheeraj for visibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants