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.
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_idapi_mapping_ids- The API mapping identifier.
Field:
api_mapping_idapi_mapping_keys- The API mapping key.
Field:
api_mapping_keystages- 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
For a full list of available matchers, see 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 AWS principal will need the APIGatewayv2:Client:GetApiMappingsResponse action with Effect set to Allow.