Control: GCP SQL instance should be using latest major database version
Description
This control checks whether the GCP SQL instance is using the latest major database version.
Usage
Run the control in your terminal:
powerpipe control run terraform_gcp_compliance.control.sql_instance_using_latest_major_database_version
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_gcp_compliance.control.sql_instance_using_latest_major_database_version --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std ->> 'database_version') in ('POSTGRES_15', 'MYSQL_8_0', 'SQLSERVER_2019_STANDARD', 'SQLSERVER_2019_WEB', 'SQLSERVER_2019_ENTERPRISE', 'SQLSERVER_2019_EXPRESS') then 'ok' else 'alarm' end as status, split_part(address, '.', 2) || case when (attributes_std ->> 'database_version') in ('POSTGRES_15', 'MYSQL_8_0', 'SQLSERVER_2019_STANDARD', 'SQLSERVER_2019_WEB', 'SQLSERVER_2019_ENTERPRISE', 'SQLSERVER_2019_EXPRESS') then ' latest major database version in use' else ' latest major database version not in use' end || '.' reason , path || ':' || start_linefrom terraform_resourcewhere type = 'google_sql_database_instance';