GKE clusters must have Cloud Logging (Stackdriver) enabled so cluster control plane and node logs are centrally collected for monitoring, alerting, incident response, and forensic analysis. Without central logging, audit trails and operational diagnostics can be lost or unavailable during security investigations.
For the Ansible GCP modules google.cloud.gcp_container_cluster and gcp_container_cluster, the logging_service property must be defined and must not be set to "none" (case-insensitive), since "none" disables Cloud Logging. Resources missing logging_service or with logging_service: "none" are flagged.
Secure example configuration:
- name:Create GKE cluster with logging enabledgoogle.cloud.gcp_container_cluster:name:my-clusterzone:us-central1-alogging_service:logging.googleapis.com
Compliant Code Examples
#this code is a correct code for which the query should not find any result- name:create a clustergoogle.cloud.gcp_container_cluster:name:my-clusterinitial_node_count:2master_auth:username:cluster_adminpassword:my-secret-passwordnode_config:machine_type:n1-standard-4disk_size_gb:500location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:/tmp/auth.pemstate:presentlogging_service:logging.googleapis.com
Non-Compliant Code Examples
#this is a problematic code where the query should report a result(s)- name:create a cluster1google.cloud.gcp_container_cluster:name:my-cluster1initial_node_count:2master_auth:username:cluster_adminpassword:my-secret-passwordnode_config:machine_type:n1-standard-4disk_size_gb:500location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:"/tmp/auth.pem"state:present- name:create a cluster2google.cloud.gcp_container_cluster:name:my-cluster2initial_node_count:2master_auth:username:cluster_adminpassword:my-secret-passwordnode_config:machine_type:n1-standard-4disk_size_gb:500location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:"/tmp/auth.pem"state:presentlogging_service:none
1
2
rulesets:- Ansible / GCP # Rules to enforce / GCP.
맞춤형 데모 요청
Datadog 시작하기
Ask AI
AI-generated responses may be inaccurate. Verify important info.