turbot/terraform_azure_compliance

Query: postgres_db_server_log_connections_on

Usage

powerpipe query terraform_azure_compliance.query.postgres_db_server_log_connections_on

Steampipe Tables

SQL

with postgresql_server as (
select
*
from
terraform_resource
where
type = 'azurerm_postgresql_server'
), log_connections_configuration as (
select
*
from
terraform_resource
where
type = 'azurerm_postgresql_configuration'
and (attributes_std ->> 'name') = 'log_connections'
and (attributes_std ->> 'value') = 'on'
)
select
a.address as resource,
case
when (s.attributes_std ->> 'server_name') is not null then 'ok'
else 'alarm'
end as status,
split_part(a.address, '.', 2) || case
when (s.attributes_std ->> 'server_name') is not null then ' server parameter log_connections on'
else ' server parameter log_connections off'
end || '.' reason
, a.path || ':' || a.start_line
from
postgresql_server as a
left join log_connections_configuration as s on a.name = (split_part((s.attributes_std ->> 'server_name'), '.', 2));

Controls

The query is being used by the following controls: