Skip to main content

aws_apigateway_base_path_mapping Resource

Use the aws_apigateway_base_path_mapping Chef InSpec audit resource to test properties of a single specific AWS API Gateway base path mapping.

The AWS::ApiGateway::BasePathMapping resource creates a base path that clients who call your API must use in the invocation URL.

For additional information, including details on parameters and properties, see the AWS documentation on AWS APIGateway BasePathMapping..

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

Test that the base path mapping exists.

describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do
  it { should exist }
end

Parameters

domain_name (required)

The domain name of the base path mapping resource to be described.

base_path (required)

The base path name that callers of the API must provide as part of the URL after the domain name.

Properties

base_path
The base path name that callers of the API must provide as part of the URL after the domain name.
rest_api_id
The string identifier of the associated RestApi.
stage
The name of the associated stage.

Examples

Test that a base path is available.

describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do
  its('base_path') { should eq 'BASE_PATH')' }
end

Test that a stage name is available.

describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do
    its('stage') { should eq 'StageName' }
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_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_apigateway_base_path_mapping(domain_name: 'DOMAIN_NAME', base_path: 'BASE_PATH') do
  it { should be_available }
end

AWS Permissions

Your Principal will need the APIGateway:Client:BasePathMapping action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×