Control: API Gateway REST API should have create_before_destroy enabled
Description
This control checks whether AWS API Gateway REST API has create_before_destroy enabled. It is recommended to enable the resource lifecycle configuration block create_before_destroy argument in this resource configuration to manage all requests that use this API, avoiding an outage.
Usage
Run the control in your terminal:
powerpipe control run terraform_aws_compliance.control.apigateway_rest_api_create_before_destroy_enabled
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.apigateway_rest_api_create_before_destroy_enabled --share
SQL
This control uses a named query:
select address as resource, case when (lifecycle ->> 'create_before_destroy') = 'true' then 'ok' else 'alarm' end status, split_part(address, '.', 2) || case when (lifecycle ->> 'create_before_destroy') = 'true' then ' create before destroy enabled' else ' create before destroy disabled' end || '.' reason , path || ':' || start_linefrom terraform_resourcewhere type = 'aws_api_gateway_rest_api';