-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Existing rule
Azure.VM.DiskCaching
Description of the issue
The PSRule Azure.VM.DiskCaching raises an incorrect error.
In the AVM Virtual Machine module, the VM-level property properties.storageProfile.dataDisks[*].managedDisk.storageAccountType has been deprecated (see commit
) and is no longer expected to be set, as the storage account type is defined on the managed disk resource itself and implicitly derived when the disk is attached to the VM.
Consequently, when data disks are configured with caching: ReadOnly, the rule incorrectly evaluates the VM configuration and raises an error due to the absence of storageAccountType on the VM definition, even though the attached managed disks are of type Premium_LRS.
The rule should not require storageAccountType to be present on the VM resource and should instead resolve the disk SKU from the associated managed disk resources.
Error messages
Reproduction
To reproduce the issue, use the latest version of the AVM Virtual Machine module (0.21.0) and use the parameter "dataDisks":
(e.g)
using 'br/public:avm/res/compute/virtual-machine:0.21.0'
...
param dataDisks = [
{
diskSizeGB: 128
caching: 'ReadOnly'
managedDisk: {
storageAccountType: 'Premium_LRS'
}
}
]
...
Version of PSRule
2.9.0
Version of PSRule for Azure
1.46.0
Additional context
No response