turbot/steampipe-mod-terraform-azure-compliance

Control: Kubernetes clusters should use a minimum number of 50 pods

Description

This control checks if Kubernetes cluster is using a minimum number of 50 pods.

Usage

Run the control in your terminal:

powerpipe control run terraform_azure_compliance.control.kubernetes_cluster_max_pod_50

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_azure_compliance.control.kubernetes_cluster_max_pod_50 --share

SQL

This control uses a named query:

select
address as resource,
case
when (type = 'azurerm_kubernetes_cluster' and (attributes_std -> 'default_node_pool' -> 'max_pods') is null)
or (type = 'azurerm_kubernetes_cluster_node_pool' and (attributes_std -> 'max_pods') is null ) then 'alarm'
when type = 'azurerm_kubernetes_cluster_node_pool' and (attributes_std ->> 'max_pods')::int >= 50 then 'ok'
when type = 'azurerm_kubernetes_cluster' and (attributes_std -> 'default_node_pool' ->> 'max_pods')::int >= 50 then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when
(type = 'azurerm_kubernetes_cluster' and (attributes_std -> 'default_node_pool' -> 'max_pods') is null)
or (type = 'azurerm_kubernetes_cluster_node_pool' and (attributes_std -> 'max_pods') is null ) then ' max pods not defined'
when type = 'azurerm_kubernetes_cluster_node_pool' then ' has ' || (attributes_std ->> 'max_pods') || ' pods'
when type = 'azurerm_kubernetes_cluster' then ' has ' || (attributes_std -> 'default_node_pool' ->> 'max_pods') || ' pods'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type in ('azurerm_kubernetes_cluster', 'azurerm_kubernetes_cluster_node_pool');

Tags