Skip to content

Commit

Permalink
fix incorrect rule
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Feb 17, 2025
1 parent 8653c31 commit b7f105b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ package Azure_Proactive_Resiliency_Library_v2

import rego.v1

valid_azurerm_deny_migrate_vm_using_availability_sets_to_vmss_flex(_resource) if {
not _resource.values.availability_set_id
}

valid_azurerm_deny_migrate_vm_using_availability_sets_to_vmss_flex(_resource) if {
_resource.values.availability_set_id == null
}

deny_migrate_vm_using_availability_sets_to_vmss_flex contains reason if {
resource := data.utils.resource(input, "azurerm_linux_virtual_machine")[_]
resource.values.availability_set_id
not valid_azurerm_deny_migrate_vm_using_availability_sets_to_vmss_flex(resource)

reason := sprintf("Azure-Proactive-Resiliency-Library-v2: '%s' `azurerm_linux_virtual_machine` must not define `availability_set_id`: https://azure.github.io/Azure-Proactive-Resiliency-Library-v2/azure-resources/Compute/virtualMachines/#migrate-vms-using-availability-sets-to-vmss-flex", [resource.address])
}
2 changes: 1 addition & 1 deletion policy/common/common.utils.rego
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ is_create_or_update(change_actions) if {

is_resource_create_or_update(resource) if {
is_create_or_update(resource.change.actions)
}
}

0 comments on commit b7f105b

Please sign in to comment.