[Bug Report]: Module Storage Account is not idempotent ; isHnsEnabled parameter
Describe the bug
Storage Account cannot be deployed idempotently.
To reproduce
Deploy the SA-Module twice without removal.
Code snippet
https://github.com/Azure/ResourceModules/blob/ec1d408ba000f339cc4660a9a5135b98ad0a220b/arm/Microsoft.Storage/storageAccounts/deploy.bicep#L86
Relevant log output
The property 'isHnsEnabled' was specified in the
| input, but it cannot be updated as it is read-only
(Code: | DeploymentFailed) - { "error": { "code":
| "AccountPropertyCannotBeUpdated", "message": "The
| property 'isHnsEnabled' was specified in the input, but it
| cannot be updated as it is read-only. For more information,
| see - https://aka.ms/storageaccountupdate" } }
Suggestion: We could implement 2 consecutive deployments to catch these kind of errors. However, if we implement multiple pipeline runs to catch these kind of issues we have to be careful
- With modules that generate unique resource names (e.g. storage account)
- With the deployment name
Regarding the issue itself we might need to use union() to not specify the HNS parameter at all (if it is not allowed to even use null).
needs a PoC to see if union works
any progress on resolution of the bug ? bicep module supposed to be idempotent.
I tried to reconstruct this issue. For me it looks like expected now.
The isHnsEnabled has to be set in the initial creation of the SA. Afterwards this is not changeable anymore. Like it's described in the readme