-
Notifications
You must be signed in to change notification settings - Fork 14
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
What-if with bicep does not show changes introduces by deeply nested modules #201
Comments
Note that it doesn't even have to be 'deeply nested'. It can be reproduced with the following example where there is one 'main' bicep file A, which uses modules B and C. Module Amodule B 'B.bicep' = {
name: 'B'
}
module C 'C.bicep' = {
name: 'C'
params: {
storageAccountName: B.outputs.storageAccountName
}
} Module Bresource storageAccount 'Microsoft.Storage/storageAccounts@2021-01-01' = {
name: 'bstorageaccount'
location: resourceGroup().location
sku: {
name: 'Standard_LRS'
tier: 'Standard'
}
kind: 'StorageV2'
properties: {
}
}
output storageAccountName string = storageAccount.name Module Cparam storageAccountName string
resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2021-04-01' = {
name: '${storageAccountName}/default'
properties: {
cors: {
corsRules: []
}
deleteRetentionPolicy: {
enabled: true
days: 7
}
}
} OutputDeploying these templates will lead to the following output (Note the missing $ az deployment group what-if --template-file A.bicep -g my-rg
Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues.
Resource and property changes are indicated with these symbols:
+ Create
* Ignore
The deployment will update the following scope:
Scope: /subscriptions/xxxxxxxxxxxx/resourceGroups/my-rg
+ Microsoft.Storage/storageAccounts/bstorageaccount [2021-01-01]
apiVersion: "2021-01-01"
id: "/subscriptions/xxxxxxxxxxxx/resourceGroups/my-rg/providers/Microsoft.Storage/storageAccounts/bstorageaccount"
kind: "StorageV2"
location: "westeurope"
name: "bstorageaccount"
sku.name: "Standard_LRS"
type: "Microsoft.Storage/storageAccounts"
Resource changes: 1 to create, 0 to ignore. A workaround for the above example is to move content from C to B. We will then see that two resources are to be created in the what-if command. I think bicep modules are very useful! However we are currently forced to workaround the issue described here by maintaining large flat template files. |
This is a dup of #157. Just so folks are aware, this is a pretty low-level issue that we need to be careful in resolving. We're trying to get it fixed before end of CY21. |
Describe the bug
running what-if when you have module that calls a module results that changes introduced by that 2nd module are not reflected.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
What-if should detect changes introduced by entire deployment, regardless how many module calls are there
Client [e.g. PowerShell, CLI, API)
CLI
Additional context
With bicep is very easy now to nest modules. What-if should reflect that.
The text was updated successfully, but these errors were encountered: