turbot/terraform_gcp_compliance

Query: sql_instance_mysql_local_infile_database_flag_off

Usage

powerpipe query terraform_gcp_compliance.query.sql_instance_mysql_local_infile_database_flag_off

Steampipe Tables

SQL

select
address as resource,
case
when coalesce(trim((attributes_std ->> 'database_version')), '') = '' then 'alarm'
when (attributes_std ->> 'database_version') not like 'MYSQL%' then 'skip'
when (attributes_std -> 'settings' -> 'database_flags' ->> 'name') = 'local_infile' and
(attributes_std -> 'settings' -> 'database_flags' ->> 'value') = 'off'
then 'ok'
else 'alarm'
end as status,
split_part(address, '.', 2) || case
when coalesce(trim((attributes_std ->> 'database_version')), '') = ''
then ' ''database_version'' is not defined'
when (attributes_std ->> 'database_version') not like 'MYSQL%'
then ' not a MySQL database'
when (attributes_std -> 'settings') is null then ' ''settings'' is not defined'
when (attributes_std -> 'settings' -> 'database_flags') is null then ' ''settings.database_flags'' is not defined'
when coalesce(trim((attributes_std -> 'settings' -> 'database_flags' ->> 'name')), '') = ''
then ' ''settings.database_flags.name'' is not defined'
when coalesce(trim((attributes_std -> 'settings' -> 'database_flags' ->> 'value')), '') = ''
then ' ''settings.database_flags.value'' is not defined'
when (attributes_std -> 'settings' -> 'database_flags' ->> 'name') <> 'local_infile'
then ' ''local_infile'' database flag not set'
when (attributes_std -> 'settings' -> 'database_flags' ->> 'name') = 'local_infile' and
(attributes_std -> 'settings' -> 'database_flags' ->> 'value') = 'off'
then ' ''local_infile'' database flag set to ''off'''
else ' ''local_infile'' database flag set to ''on'''
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'google_sql_database_instance';

Controls

The query is being used by the following controls: