Ensure GCP SQL database uses the latest Major version

Error: GCP SQL database does not use the latest Major version

Bridgecrew Policy ID: BC_GCP_GENERAL_13
Checkov Check ID: CKV_GCP_79
Severity: LOW

GCP SQL database does not use the latest Major version

Description

Using the latest major version for your Google Cloud Platform (GCP) SQL database can help improve the security and reliability of your database. Newer versions of software often include security updates and bug fixes that can help protect your database from potential threats and improve its performance.

Fix - Runtime

Fix - Buildtime

Terraform

resource "google_sql_database_instance" "pass" {
  provider = google-beta

  name             = "private-instance-${random_id.db_name_suffix.hex}"
  region           = "us-central1"
  database_version = "MYSQL_8_0"

  depends_on = [google_service_networking_connection.private_vpc_connection]

  settings {
    tier = "db-f1-micro"
    ip_configuration {
      ipv4_enabled    = false
      private_network = google_compute_network.private_network.id
    }
  }
}