Control: Check that legacy metadata endpoints are disabled on Kubernetes clusters(disabled by default since GKE 1.12+)
Description
This control checks that legacy metadata endpoints are disabled on Kubernetes clusters(disabled by default since GKE 1.12+).
Usage
Run the control in your terminal:
powerpipe control run terraform_gcp_compliance.control.kubernetes_cluster_legacy_endpoints_disabledSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_gcp_compliance.control.kubernetes_cluster_legacy_endpoints_disabled --shareSQL
This control uses a named query:
select  address as resource,  case    when (attributes_std -> 'node_config' -> 'metadata' ->> 'disable-legacy-endpoints') = 'true' then 'ok' else 'alarm'  end as status,  split_part(address, '.', 2) || case    when (attributes_std -> 'node_config') is null then ' ''node_config'' is not defined'    when (attributes_std -> 'node_config' -> 'metadata') is null then ' ''node_config.metadata'' is not defined'    when coalesce(trim((attributes_std -> 'node_config' -> 'metadata' ->> 'disable-legacy-endpoints')), '') = ''    then ' ''node_config.metadata.disable-legacy-endpoints'' is not defined'    when (attributes_std -> 'node_config' -> 'metadata' ->> 'disable-legacy-endpoints') = 'true' then ' legacy endpoints disabled'    else ' legacy endpoints enabled'  end || '.' reason    , path || ':' || start_linefrom  terraform_resourcewhere  type = 'google_container_cluster';