Enabling the Azure Policy Add-On for Azure Kubernetes Service (AKS) clusters helps enforce organizational standards and compliance at scale by applying policy controls directly to the cluster. If the addon_profile.azure_policy.enabled attribute is set to false, as shown below, the cluster will not have Azure Policy integration, leaving it vulnerable to resource misconfigurations and violating compliance policies.
To mitigate this vulnerability, the policy add-on should be enabled by setting enabled = true, ensuring that security and compliance policies are consistently enforced within the AKS environment.
# An empty `addon_profile {}` block only has HCL meaning under azurerm < 3.0,
# where the provider still exposes the addon_profile/azure_policy schema.
# Under a modern (~> 4.0) provider addon_profile is dropped from the schema
# entirely, so this fixture's plan-JSON is identical to positive4.json's
# (block fully absent) - not a distinguishable case there. The HCL body
# below still exercises the "addon_profile present but empty" rule
# correctly, since HCL retains the block regardless of provider version.
resource"azurerm_kubernetes_cluster""positive3"{name="example-aks1"location=azurerm_resource_group.example.locationresource_group_name=azurerm_resource_group.example.namedns_prefix="exampleaks1"addon_profile{}}
1
2
rulesets:- Terraform / Azure # Rules to enforce / Azure.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.