Skip to main content

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.

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 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

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 Principal will need the APIGatewayv2:Client:GetApiMappingsResponse action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×