turbot/steampipe-mod-terraform-azure-compliance

Control: Enable connection_throttling on PostgreSQL Servers

Description

Ensure server parameter 'connection_throttling' is set to 'ON' for PostgreSQL Database Server.

Usage

Run the control in your terminal:

powerpipe control run terraform_azure_compliance.control.postgres_db_server_connection_throttling_on

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_azure_compliance.control.postgres_db_server_connection_throttling_on --share

SQL

This control uses a named query:

with postgresql_server as (
select
*
from
terraform_resource
where
type = 'azurerm_postgresql_server'
), connection_throttling_configuration as (
select
*
from
terraform_resource
where
type = 'azurerm_postgresql_configuration'
and (attributes_std ->> 'name') = 'connection_throttling'
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 connection_throttling on'
else ' server parameter connection_throttling off'
end || '.' reason
, a.path || ':' || a.start_line
from
postgresql_server as a
left join connection_throttling_configuration as s on a.name = ( split_part((s.attributes_std ->> 'server_name'), '.', 2));

Tags