Bicep reports cycle for app service slot swapping
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.11.1 (030248df55)
**Describe the bug**
If you try to implement azure app service slot swapping via a bicep template, for example, by decompiling the example given for ARM templates https://azure.github.io/AppService/2019/10/02/Swap-slots-with-arm-templates.html then you'll get an error, saying that `The expression is involved in a cycle` because the site depends on the slot but the site is the parent of the slot.
Also if you remove the `dependsOn` so that the cycle error goes away, `targetBuildVersion` and `buildVersion` are warned as `not allowed on SiteProperties`
**To Reproduce**
```bicep
param location string = resourceGroup().location
param siteName string
param buildId int
var buildVersion = '${buildId}-${deployment().name}'
resource mySite 'Microsoft.Web/sites@2018-11-01' = {
kind: 'app'
name: siteName
location: location
properties: {
targetBuildVersion: buildVersion
}
dependsOn: [
mySite_Slot
]
}
resource mySite_Slot 'Microsoft.Web/sites/slots@2018-11-01' = {
parent: mySite
kind: 'app'
name: 'PreProd'
location: location
properties: {
buildVersion: buildVersion
}
}
```
Contributor guide
Research direction
Start with the provided Bicep template and the Microsoft.Web sites and sites/slots resource definitions for API version 2018-11-01. Reproduce both diagnostics with Bicep CLI 0.11.1, then trace the dependency and property validation behavior. Done means the slot-swapping template no longer reports a cycle and accepts targetBuildVersion and buildVersion in their shown locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100