Azure / Azure/arm-template-whatif
Context info for what-if deployments
- Dominant language
- HTML
- Stars
- 101
- Forks
- 21
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Description
Is there any way for a deployment to know whether or not it's a what-if deployment in each deployment context?
For example, if such global deployment-time context information is exposed in `deployment().metadata` each time, you can implement workarounds for the `reference()` limitation like #157 more easily:
```bicep
var vdpoolName = 'desktop1'
var vdvmName = 'vm1'
var whatif = deployment().?metadata.?whatif
// Specify the older API version to get registrationInfo https://github.com/Azure/bicep/issues/6105
resource vdpool 'Microsoft.DesktopVirtualization/hostPools@2021-01-14-preview' existing = {
name: vdpoolName
}
// Avoid reference() in params when it's a what-if deployment
module vdvm 'vdvm.bicep' = {
name: 'vdvm_${deployment().name}'
params: {
vdvmName: vdvmName
registrationInfoToken: whatif ? 'a-token' : vdpool.properties.registrationInfo.token
// Other module parameters...
}
}
```
It would be nice if the ARM infrastructure or tooling could provide this feature. Currently I must have an additional boolean parameter `whatif` and manually enable it when I run a what-if deployment.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing how ARM what-if deployments and Bicep's deployment().metadata are represented, along with the limitation discussed in #157. Determine whether the ARM infrastructure or tooling should expose a what-if indicator, then validate the behavior against the provided deployment example and the existing manual boolean workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100