aws_api_gateway_v2_api_mappings Resource
Use the aws_api_gateway_v2_api_mappings
InSpec audit resource to test the properties of multiple AWS API Gateway V2 API mappings.
For additional information, including parameters and properties, see the AWS documentation on AWS APIGatewayV2 ApiMapping.
Installation
This resource is available in the Chef InSpec AWS resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.
Syntax
Ensure the API mappings exist.
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
it { should exist }
end
Parameters
domain_name
(required)- The domain name.
Properties
api_ids
- The API identifier.
Field:
api_id
api_mapping_ids
- The API mapping identifier.
Field:
api_mapping_id
api_mapping_keys
- The API mapping key.
Field:
api_mapping_key
stages
- The API stage.
Field:
stage
Examples
Test to ensure an API ID is available
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
its('api_ids') { should include 'REST_API_ID' }
end
Test to ensure an API mapping ID is available
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
its('api_mapping_ids') { should include 'API_MAPPING_ID' }
end
Test to ensure an API mapping key is available
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
its('api_mapping_keys') { should include 'API_MAPPING_KEY' }
end
Test to ensure an API mapping stage is available
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
its('stages') { should include 'API_STAGE_NAME' }
end
Matchers
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.
The control passes if the get
method returns at least one result.
exist
Use should
to test that the entity exists.
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
it { should exist }
end
Use should_not
to test that the entity does not exist.
describe aws_api_gateway_v2_api_mappings(domain_name: 'DOMAIN_NAME') do
it { should_not exist }
end
AWS Permissions
Your Principal will need the APIGatewayv2:Client:GetApiMappingsResponse
action with Effect
set to Allow
.
Was this page helpful?