For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-gcp-outdated-gke-version.md.
A documentation index is available at /llms.txt.
Running outdated versions of Google Kubernetes Engine (GKE) exposes clusters to unpatched security vulnerabilities and known exploits that attackers can leverage to compromise workloads or gain unauthorized access. Terraform configurations should specify the min_master_version and node_version attributes with values such as "latest" or a supported, up-to-date release to ensure that the cluster automatically receives important security patches. For example, a secure configuration might look like the following:
#this code is a correct code for which the query should not find any result
resource"google_container_cluster""negative1"{name="marcellus-wallace"location="us-central1-a"initial_node_count=3master_auth{username=""password=""client_certificate_config{issue_client_certificate=false}}timeouts{create="30m"update="40m"}min_master_version="latest"}#this code is a correct code for which the query should not find any result
resource"google_container_cluster""negative2"{name="marcellus-wallace"location="us-central1-a"initial_node_count=3master_auth{username=""password=""client_certificate_config{issue_client_certificate=false}}timeouts{create="30m"update="40m"}min_master_version="1.25"}#this code is a correct code for which the query should not find any result
resource"google_container_cluster""negative3"{name="marcellus-wallace"location="us-central1-a"initial_node_count=3master_auth{username=""password=""client_certificate_config{issue_client_certificate=false}}timeouts{create="30m"update="40m"}min_master_version="1.25"node_version="1.25"}
Non-Compliant Code Examples
#this code is a correct code for which the query should not find any result
resource"google_container_cluster""positive1"{name="marcellus-wallace"location="us-central1-a"initial_node_count=3master_auth{username=""password=""client_certificate_config{issue_client_certificate=false}}timeouts{create="30m"update="40m"}min_master_version="1.24"}#this code is a correct code for which the query should not find any result
resource"google_container_cluster""positive2"{name="marcellus-wallace"location="us-central1-a"initial_node_count=3master_auth{username=""password=""client_certificate_config{issue_client_certificate=false}}timeouts{create="30m"update="40m"}node_version="1.24"}
1
2
rulesets:- Terraform / GCP # Rules to enforce / GCP.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.