<p>Created Azure policy to Enforce labels on pods in Kubernetes cluster as below.</p>
<p>Policy Name: Enforce labels on pods in Kubernetes cluster</p>
<p><a href="https://i.stack.imgur.com/CRciv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CRciv.png" alt="Policy Configuration" /></a></p>
<p>I am trying to import policy using below command</p>
<pre><code>terraform import azurerm_policy_set_definition.test /subscriptions/&lt;SubscriptionId&gt;/providers/Microsoft.Authorization/policySetDefinitions/&lt;Id&gt;
</code></pre>
<p>Whenever I am trying to import resource using terraform, getting below error.</p>
<pre><code>Error: setting `policy_definition_reference`: policy_definition_reference.0.parameters.labelsList: '' expected type 'string', got unconvertible type '[]interface {}'
</code></pre>
<p>Any help much appreciated.</p>

krishna bh
<p>It's similar to the <a href="https://github.com/terraform-providers/terraform-provider-azurerm/issues/34" rel="nofollow noreferrer">issue</a> in Github. I also think it looks like the parameters need to be fixed. You can see the <code>policy_definition_reference.0.parameters</code> is a mapping of the parameter values for the referenced policy rule and each member needs a string value. But the Policy Set Definition in Azure, the parameters property is an object in the JSON format like this:</p>
<p><a href="https://i.stack.imgur.com/PsizH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PsizH.png" alt="enter image description here" /></a></p>
<p>Maybe it cannot convert from an object into a string in Terraform.</p>
<p>And I think you also need to change the format you input in the Azure portal, it should be the same as the namespace, without quotes and separated with the character <code>;</code>.</p>
