# Policy\_definition id output error

**URL:** <https://discuss.hashicorp.com/t/policy-definition-id-output-error/52764>\
**Category:** Azure\
**Tags:** policy-as-code\
**Created:** [April 16, 2023, 7:11am UTC](https://discuss.hashicorp.com/t/policy-definition-id-output-error/52764 "2023-04-16T07:11:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![orallony](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/orallony/32/35212_2.png) [@orallony](https://discuss.hashicorp.com/u/orallony)\
**Post date:** [April 16, 2023, 7:11am UTC](https://discuss.hashicorp.com/t/policy-definition-id-output-error/52764/1 "2023-04-16T07:11:09Z")

</div>

Hey  
i have terraform structure:

**main.tf**

```auto
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**

```auto
output "policy_definitions_security_output" {
  value = azurerm_policy_definition.policy_definition_security[*].id
}

```

and got this error:

```auto
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:

 ![image](https://global.discourse-cdn.com/hashicorp/original/3X/e/c/ec143ac14b6b04d490b2b67fc6a0c7f8a426f573.png)

provier version: 3.40

why?

thanks!
