terraform 0.12.29
azurerm_policy_set_definitionprovider "azurerm" {
# whilst the `version` attribute is optional, we recommend pinning to a given version of the Provider
version = ">=2.31.0"
features {}
}
data "azurerm_policy_definition" "activity_log_exist_admin_operations" {
display_name = "An activity log alert should exist for specific Administrative operations"
}
resource "azurerm_policy_set_definition" "cis_custom" {
name = "CIS Custom Effects"
policy_type = "Custom"
display_name = "CIS Custom Effects"
policy_definition_reference {
policy_definition_id = data.azurerm_policy_definition.activity_log_exist_admin_operations.id
parameter_values = jsonencode({
operationName = { value = "Microsoft.Sql/servers/firewallRules/delete" }
})
}
}
The policy set definition could be updated successfully
An error occurs:
Error: expanding `policy_definition_reference`: cannot set both `parameters` and `parameter_values`
terraform apply with the config aboveterraform apply againparameter_values now expects a string but should be an object map:
Inappropriate value for attribute "parameter_values": string required.
Also Related
parameter_valuesnow expects a string but should be an object map:
Inappropriate value for attribute "parameter_values": string required.
Actually parameters is an object map (and deprecated), parameter_values is a JSON string with the same format as the parameters in azurerm_policy_assignment.
Please note the jsonencode function in the config I posted in the description.
Also Related
parameter_valuesnow expects a string but should be an object map:
Inappropriate value for attribute "parameter_values": string required.Actually
parametersis an object map (and deprecated),parameter_valuesis a JSON string with the same format as theparametersinazurerm_policy_assignment.Please note the
jsonencodefunction in the config I posted in the description.
The docs should be updated to avoid confusion:
parameter_values - (Optional) Parameter values for the referenced policy rule. This field is a json object that allows you to assign parameters to this policy rule.
Hi @gettek I also include the doc update in my fix for this issue.
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!