aws_api_gateway_stages Resource
Use the aws_api_gateway_stages
InSpec audit resource to test properties of multiple AWS API Gateway stages.
The ‘AWS::ApiGateway::Stage’ resource deploys an API Gateway REST API resource to a stage so that clients can call the API over the internet. The stage acts as an environment.
For additional information, including details on parameters and properties, see the AWS API Gateway stage Stage documentation.
Install
This resource is available in the Chef InSpec AWS resource pack.
For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.
Syntax
Ensure that the stage exists.
describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do
it { should exist }
end
Parameters
rest_api_id
(required)The ID of the REST API resource that you’re deploying with this stage.
Properties
deployment_ids
- The identifier for the deployment attached to stage resource.
descriptions
- The description for the stage resource.
created_dates
- The date and time that the stage resource was created.
stage_names
- The name for the stage resource.
Examples
Ensure that the stage name exists.
describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do
its('stage_names') { should include 'STAGE_NAME' }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.This resource has the following special matchers.
exist
Use should
to test that the entity exists.
describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do
it { should exist }
end
Use should_not
to test the entity does not exist.
describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do
it { should_not exist }
end
be_available
Use should
to check if the stage is available.
describe aws_api_gateway_stages(rest_api_id: 'REST_API_ID') do
it { should be_available }
end
AWS Permissions
Your Principal will need the APIGateway:Client::Stages
action with Effect
set to Allow
.