Policy as code - Azure - Terraform https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/policy_definition
The output is an id. This id needs to be used as a variable for a policy assignment. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group_policy_assignment
You can simply pass the azurerm_policy_definition
output to resource azurerm_resource_group_policy_assignment
like in the example you find in the DOC
resource "azurerm_resource_group_policy_assignment" "example" {
name = "example"
resource_group_id = azurerm_resource_group.example.id
policy_definition_id = azurerm_policy_definition.example.id # This is the output of azurerm_policy_definition resource
...
...
}