aws_api_gateway_deployment Resource
Use the aws_api_gateway_deployment
InSpec audit resource to test properties of a single AWS ApiGateway Deployment.
The AWS::ApiGateway::Deployment resource deploys an API Gateway RestApi 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 ApiGateway Deployment 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 deployment exists.
describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do
it { should exist }
end
Parameters
rest_api_id
(required)The string identifier of the associated RestApi.
deployment_id
(required)The identifier of the deployment resource to get information about.
Properties
id
- The identifier for the deployment resource.
description
- The description for the deployment resource.
created_date
- The date and time that the deployment resource was created.
api_summary
- A summary of the RestAPI at the date and time that the deployment resource was created.
api_summary (authorization_type)
- The method’s authorization type. Valid values are
NONE
for open access,AWS_IAM
for using AWS IAM permissions,CUSTOM
for using a custom authorizer, orCOGNITO_USER_POOLS
for using a Cognito user pool. api_summary (api_key_required)
- Specifies whether the method requires a valid ApiKey .
Examples
Ensure that the deployment ID exists.
describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do
its('id') { should eq 'DEPLOYMENT_IDENTIFIER' }
end
Check whether the API key is required for a particular deployment.
describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do
its('api_summary.api_key_required') { should eq false }
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_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do
it { should exist }
end
Use should_not
to test the entity does not exist.
describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do
it { should_not exist }
end
be_available
Use should
to check if the work_group name is available.
describe aws_api_gateway_deployment(rest_api_id: 'REST_API_ID', deployment_id: 'DEPLOYMENT_ID') do
it { should be_available }
end
AWS Permissions
Your Principal will need the APIGateway:Client:Deployment
action with Effect
set to Allow
.