Skip to main content

aws_api_gateway_usage_plan_keys resource

Use the aws_api_gateway_usage_plan_keys InSpec audit resource to test the properties of multiple AWS API Gateway usage plan keys.

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

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 usage plan key exists.

describe aws_api_gateway_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do
  it { should exist }
end

Parameters

usage_plan_id (required)

The usage plan resource ID represents the usage plan containing the to-be-retrieved usage plan’s key resource and a plan customer.

Properties

ids
The usage plan key ID.

Field: id

types
The usage plan key type. Currently, the valid key type is API_KEY.

Field: type

values
The usage plan key value.

Field: value

names
The usage plan key name.

Field: name

Examples

Test to ensure a usage plan key ID is available

describe aws_api_gateway_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do
  its('ids') { should include 'USAGE_PLAN_KEY_ID' }
end

Test to ensure a usage plan key name is available

describe aws_api_gateway_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do
  its('names') { should include 'USAGE_PLAN_KEY_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_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do
  it { should exist }
end

Use should_not to test that the entity does not exist.

describe aws_api_gateway_usage_plan_keys(usage_plan_id: 'USAGE_PLAN_ID') do
  it { should_not exist }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×











Search Results