turbot/terraform_aws_compliance

Query: apigateway_method_restricts_open_access

Usage

powerpipe query terraform_aws_compliance.query.apigateway_method_restricts_open_access

Steampipe Tables

SQL

select
address as resource,
case
when (attributes_std ->> 'http_method') != 'OPTIONS' and (attributes_std ->> 'authorization') = 'NONE' and (attributes_std ->> 'api_key_required') is null then 'alarm'
when (attributes_std ->> 'http_method') != 'OPTIONS' and (attributes_std ->> 'authorization') = 'NONE' and (attributes_std ->> 'api_key_required') = 'false' then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std ->> 'http_method') != 'OPTIONS' and (attributes_std ->> 'authorization') = 'NONE' and (attributes_std ->> 'api_key_required') is null then ' does not restrict open access'
when (attributes_std ->> 'http_method') != 'OPTIONS' and (attributes_std ->> 'authorization') = 'NONE' and (attributes_std ->> 'api_key_required') = 'false' then ' does not restrict open access'
else ' is restrictive with http_method as ' || (attributes_std ->> 'http_method') || ', authorization as ' || (attributes_std ->> 'authorization') || ' and api_key_required as ' || (attributes_std ->> 'api_key_required')
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_api_gateway_method';

Controls

The query is being used by the following controls: