Jsonencode itself in HCL (azure roles)

Hi Community members,

does anyone face similar issue? i’m encoding json using for_each and i noticed that jsonencode itself injecting in JSON roles definition.

resource “azurerm_role_definition” “definition” {
for_each = local.roles_json
name = justname
scope = data.azurerm_management_group.root_mg.id
description = “This is a custom role created via Terraform”

permissions {
actions = [ jsonencode(each.value.properties.permissions) ]
not_actions =

i would appreciate if you could please share your thoughts.

This is functioning correctly. The data in your screenshot is not in JSON syntax. It is an HCL expression.

@maxb, Yes you’re right but Why jsonencode appearing in HCL while terraform apply?

To show the final value used will be JSON encoded

yes, it is resolved now. i had to use for on each.value to get permissions without jsonencode. many thanks for responses.