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-node-auto-upgrade-disabled.md.
A documentation index is available at /llms.txt.
Kubernetes node pools must have automatic node upgrades enabled so nodes receive security patches and Kubernetes version updates promptly. This reduces exposure to known vulnerabilities and version drift.
For Ansible tasks using the google.cloud.gcp_container_node_pool or gcp_container_node_pool modules, the management.auto_upgrade property must be defined and set to true. Tasks missing the management block, missing management.auto_upgrade, or with auto_upgrade set to false are flagged as insecure. Secure configuration example:
- name:Create GKE node pool with auto-upgradegoogle.cloud.gcp_container_node_pool:name:my-node-poolcluster:my-clusterzone:us-central1-amanagement:auto_upgrade:trueinitial_node_count:3
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:yesauto_upgrade:yes
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:present- name:create a second 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:yes- name:create a third 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:yesauto_upgrade:no
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.