Error "policy_rule" contains an invalid JSON: invalid character '}' after top-level value"


Hey
I got error like the files attached.
help please?

I can’t see any obvious issue by eye, but by posting your code as screenshots, you make it impossible to quickly run it through a JSON formatter to check more rigourously.

When asking questions in a community help forum, for best results, make it easy for people to help you - not hard.

Thanx.

this is all code:

resource "azurerm_policy_definition" "API-use-SKU" {
  name         = "API Management service should use a SKU that supports virtual networks"
  policy_type  = "Custom"
  mode         = "Indexed"
  display_name = "API Management service should use a SKU that supports virtual networks"

  metadata = <<METADATA
    {
    "category": "API Management"
    }

METADATA


policy_rule = <<POLICY_RULE
  {
    "if": 
    {
      "allOf": 
        [
          {
            "field": "type",
            "equals": "Microsoft.ApiManagement/service"
          },
          {
            "not": 
              {
                "field": "Microsoft.ApiManagement/service/sku.name",
                "in": "[parameters('listOfAllowedSKUs')]"
              }
          }
        ]
    },    
    "then": 
    {
      "effect": "[parameters('effect')]"
    }
  }
POLICY_RULE


  parameters = <<PARAMETERS
 {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny"
      },
      "listOfAllowedSKUs": {
        "type": "Array",
        "metadata": {
          "description": "The list of SKUs that can be specified for Azure API Management service.",
          "displayName": "Allowed SKUs"
        },
        "allowedValues": [
          "Developer",
          "Basic",
          "Standard",
          "Premium",
          "Isolated",
          "Consumption"
        ],
        "defaultValue": [
          "Developer",
          "Premium",
          "Isolated"
        ]
      }
    }
PARAMETERS
}

resource "azurerm_management_group_policy_assignment" "Boris2" {
  name                 = "Boris"
  policy_definition_id = azurerm_policy_definition.Function-app-accessible-HTTPS.id
  management_group_id  = "/providers/Microsoft.Management/managementGroups/Sandbox-Management-Group"
}