title: Terraform: pass variable as a parameter in azure policy initiative
body: <p>I have a custom policy initiative I would like to assign using terraform, one of the policies does have parameters.
  I know that for single policy assignment, we could use something like this, and pass variable as parameter.</p>
  <pre><code> parameters = jsonencode({
      &quot;operationName&quot;: {
        &quot;value&quot;: var.allowed_values,
      }
    })
  </code></pre>
  <p>however, I tried this with initiative, this doesn't seem to like it keeps complaining parameter is missing.</p>
  <p>Infact, I tried to hardcode parameter into the body of azurerm_policy_assignment, I don't think even this is working.</p>
  <pre><code>resource &quot;azurerm_policy_assignment&quot; &quot;example&quot; {
    name                 = &quot;mcs_governance_policy_assignment&quot;
    scope                = var.scopes
    policy_definition_id = azurerm_policy_set_definition.iam.id
    description          = &quot;example&quot;
    display_name         = &quot;Governance Policy&quot;
  
    metadata = &lt;&lt;METADATA
      {
      &quot;category&quot;: &quot;General&quot;
      }
  METADATA
    parameters = &lt;&lt;PARAMETERS
      {
       &quot;operationName&quot;: {
          &quot;value&quot;: &quot;Microsoft.Authorization/policyAssignments/write&quot; 
        }
    }
  PARAMETERS
  
  }
  </code></pre>
  <p>the policy initiative definition policy is as following, it uses built in policy, I have not included all the policies in this initiative, just for the one that complaining about the parameter</p>
  <pre><code>resource &quot;azurerm_policy_set_definition&quot; &quot;iam&quot; {
  
    name         = &quot;mcs_iam&quot;
    policy_type  = &quot;Custom&quot;
    display_name = &quot;MCS IAM Governance Policy Set&quot;
    description  = &quot;Contains MCS Governance policies&quot;
  
    metadata = &lt;&lt;METADATA
      {
      &quot;category&quot;: &quot;General&quot;
      }
  
  METADATA
  
      policy_definition_reference {
      # An activity log alert should exist for specific Policy operations
      policy_definition_id = &quot;/providers/Microsoft.Authorization/policyDefinitions/c5447c04-a4d7-4ba8-a263-c9ee321a6858&quot;
      reference_id         = &quot;MCS IAM 3.1&quot;
    }
  
  </code></pre>