Hey
i have terraform structure:
main.tf
data "local_file" "policy_files" {
for_each = fileset("${var.policy_files_folder_path}", "*.json")
filename = "${var.policy_files_folder_path}/${each.value}"
}
resource "azurerm_policy_definition" "policy_definition_security" {
for_each = data.local_file.policy_files
name = each.key
display_name = jsonencode(jsondecode(data.local_file.policy_files[each.key].content).properties.displayName)
policy_type = "Custom"
mode = "Indexed"
metadata = jsonencode(jsondecode(data.local_file.policy_files[each.key].content).properties.metadata)
policy_rule = jsonencode(jsondecode(data.local_file.policy_files[each.key].content).properties.policyRule)
parameters = jsonencode(jsondecode(data.local_file.policy_files[each.key].content).properties.parameters)
}
outputs.tf
output "policy_definitions_security_output" {
value = azurerm_policy_definition.policy_definition_security[*].id
}
and got this error:
Error: Unsupported attribute
on ..\modules\policy\security\policy_definition\outputs.tf line 2, in output "policy_definitions_security_output":
2: value = azurerm_policy_definition.policy_definition_security[*].id
This object does not have an attribute named "id".
by the Terraform documentation it should be correct:
provier version: 3.40
why?
thanks!