Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR should fix the rego policy for Azure Container Registry which ensure the presence of a Azure Management Lock on that resource (
AC_AZURE_0185
).In particular it adds a case that should be also accepted.
This Rego expression is evaluated to
true
when theazurerm_management_lock
resource has the correctscope
field value.In particular this is relevant for the validation of the HCL code.
The
scope
value can be a Terraform attribute reference expression that references theid
attribute of theazurerm_container_registry
resource to be locked.So, for example:
Without this new Rego expression the only accepted HCL code is when the
azurerm_managament_lock
resourcename
field is equal to a string composed like this:""<resource_to_lock_type>.<resource_to_lock_name>"
. For example:This shouldn't add regression as when the
scope
value has always to match the resource name of theregistry
from the Regoinput
.Furthermore, this is pretty similar to what is declared for Resource Group locking.
What do you think?