Linter rule to replace variables with resource properties to generate correct dependsOn
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
Consider the below snippet. Should there be a linter rule to suggest replacing `storageName` in the synapse `accountUrl` with `storageAccount.name`. Whilst `storageName` and `storageAccount.name` are the exact same value, using the latter causes bicep to generate the correct `dependsOn`. Without the depends on, the template would fail on first execution (although it would succeed on later ones).
```bicep
param storageName string
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01'= {
name: storageName
}
resource workspace 'Microsoft.Synapse/workspaces@2021-03-01' = {
name: 'SomeWorkspace'
properties: {
defaultDataLakeStorage: {
accountUrl: 'https://${storageName}.dfs.core.windows.net'
// Should linter rule suggest correcting this to:
// accountUrl: 'https://${storageAccount.Name}.dfs.core.windows.net'
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.