Skip to main content

aws_api_gateway_usage_plan_key resource

Use the aws_api_gateway_usage_plan_key InSpec audit resource to test the properties of a specific AWS API Gateway usage plan key.

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

describe aws_api_gateway_usage_plan_key(usage_plan_id: 'USAGE_PLAN_ID', key_id: 'USAGE_PLAN_KEY_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.

key_id (required)

The key ID of the to-be-retrieved usage plan key resource representing a plan customer.

Properties

id
The usage plan key ID.
type
The usage plan key type. Currently, the valid key type is API_KEY.
value
The value of a usage plan key.
name
The usage plan key name.

Examples

Test to ensure a usage plan key ID is available

describe aws_api_gateway_usage_plan_key(usage_plan_id: 'USAGE_PLAN_ID', key_id: 'USAGE_PLAN_KEY_ID') do
  its('id') { should eq 'USAGE_PLAN_KEY_ID' }
end

Test to ensure a usage plan key name is available

describe aws_api_gateway_usage_plan_key(usage_plan_id: 'USAGE_PLAN_ID', key_id: 'USAGE_PLAN_KEY_ID') do
  its('name') { should eq '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(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(usage_plan_id: 'USAGE_PLAN_ID') do
  it { should_not exist }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results