turbot/terraform_aws_compliance

Query: apigateway_stage_cache_encryption_at_rest_enabled

Usage

powerpipe query terraform_aws_compliance.query.apigateway_stage_cache_encryption_at_rest_enabled

Steampipe Tables

SQL

with stages_v1 as (
select
*
from
terraform_resource
where
type = 'aws_api_gateway_stage'
),
method_settings as (
select
*
from
terraform_resource
where
type = 'aws_api_gateway_method_settings'
),
all_stages as (
select
m.attributes_std -> 'settings' ->> 'caching_enabled' as caching_enabled,
m.attributes_std -> 'settings' ->> 'cache_data_encrypted' as cache_data_encrypted,
a.*
from
stages_v1 as a
left join method_settings as m on (m.attributes_std ->> 'rest_api_id') = (a.attributes_std ->> 'rest_api_id')
)
select
address as resource,
case
when (caching_enabled) :: boolean
and (cache_data_encrypted) :: boolean then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when (caching_enabled) :: boolean
and (cache_data_encrypted) :: boolean then ' API cache and encryption enabled'
else ' API cache and encryption not enabled'
end || '.' reason,
path || ':' || start_line
from
all_stages;

Controls

The query is being used by the following controls: