For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/ansible-gcp-stackdriver-monitoring-disabled.md.
A documentation index is available at /llms.txt.
GKE clusters must have Cloud Monitoring (Stackdriver) enabled to provide observability and support timely incident detection and response. Disabling monitoring removes metrics and logs needed for alerting, troubleshooting, and forensic analysis.
For Ansible resources using the google.cloud.gcp_container_cluster or gcp_container_cluster modules, the monitoring_service property must be defined and must not be set to 'none'. Resources that omit monitoring_service or explicitly set monitoring_service: 'none' are flagged.
Secure configuration example:
- name:Create GKE cluster with monitoring enabledgoogle.cloud.gcp_container_cluster:name:my-clustermonitoring_service:monitoring.googleapis.com/kubernetes
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:presentmonitoring_service:monitoring.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:presentmonitoring_service:none
1
2
rulesets:- Ansible / GCP # Rules to enforce / GCP.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.