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-google-container-node-pool-auto-repair-disabled.md.
A documentation index is available at /llms.txt.
Node pools must have automatic node repair enabled so unhealthy or failing nodes are remediated automatically, reducing the risk of prolonged downtime and inconsistent cluster state.
For Ansible GKE node pool resources (modules google.cloud.gcp_container_node_pool and gcp_container_node_pool), the management block must be defined and its auto_repair property set to true. Tasks missing the management block or with management.auto_repair set to false are flagged.
Secure configuration example:
- name:Create GKE node pool with auto repair enabledgoogle.cloud.gcp_container_node_pool:name:my-node-poolcluster:my-clusterlocation:us-central1initial_node_count:3management:auto_repair:true
Compliant Code Examples
- name:create a node poolgoogle.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:'{{ cluster }}'location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:/tmp/auth.pemstate:presentmanagement:auto_repair:yes- name:create a node poolgoogle.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:'{{ cluster }}'location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:/tmp/auth.pemstate:presentmanagement:auto_repair:true
Non-Compliant Code Examples
---- name:create a node poolgoogle.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:"{{ cluster }}"location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:"/tmp/auth.pem"state:presentmanagement:auto_repair:no- name:create a node pool2google.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:"{{ cluster }}"location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:"/tmp/auth.pem"state:presentmanagement:auto_repair:false- name:create a node pool3google.cloud.gcp_container_node_pool:name:my-poolinitial_node_count:4cluster:"{{ cluster }}"location:us-central1-aproject:test_projectauth_kind:serviceaccountservice_account_file:"/tmp/auth.pem"state:present
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.