Azure / Azure/static-web-apps

[Bug] Error in ARM typings/docs on `provider` property

Open
#575 0 comments 12 reactions 0 assignees View on GitHub
IaaC
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

If you try to create a SWA from a bicep template, for example something like this:
```
resource staticWebApp 'Microsoft.Web/staticSites@2021-01-15' = {
name: '${appName}-staticwebapp${dashSuffix}'
location: location
sku: {
name: 'Standard'
tier: 'Standard'
}
properties: {
repositoryUrl: 'https://github.com/${githubRepo}'
branch: 'main'
repositoryToken: githubToken
buildProperties: {
appLocation: '/'
apiLocation: '/api'
outputLocation: 'dist/'
skipGithubActionWorkflowGeneration: true
githubActionSecretNameOverride: 'AZURE_SWA_TOKEN'
}
stagingEnvironmentPolicy: 'Enabled'
allowConfigFileUpdates: false
}
}
```
The first deployment will work fine, but the second time your try to redeploy the template (even with no changes) you get this error: `Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider.`

![image](https://user-images.githubusercontent.com/593151/132707001-ea49d5b7-5414-4c70-b473-e9c7e1760c81.png)

After looking at related issue https://github.com/Azure/static-web-apps/issues/495, I added the property:
```
provider: 'GitHub'
```
to my template, which fixes the issue. The problem is that this property is wrongly reported as read-only and issues a warning:
![image](https://user-images.githubusercontent.com/593151/132707244-7fc3247f-0e5d-4658-a4a3-4313fc37866a.png)

Worse, it's not even present in the template docs: https://docs.microsoft.com/en-us/azure/templates/microsoft.web/staticsites?tabs=json#StaticSiteBuildProperties

**Expected behavior**
The `provider` property type should not be set as read-only and marked as a required property to have idempotent deployments.

**Additional context**
Related issues: https://github.com/Azure/static-web-apps/issues/516, https://github.com/Azure/static-web-apps/issues/495

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.