Skip to main content

aws_lambda_layer_version_permission Resource

[edit on GitHub]

Use the aws_lambda_layer_version_permission InSpec audit resource to test properties of a single AWS Lambda layer version permission.

The AWS::Lambda::LayerVersionPermission resource adds permissions to the resource-based policy of a version of an Lambda layer.

For additional information, including details on parameters and properties, see the AWS documentation on AWS Lambda layer version permission.

Installation

This resource is available in the Chef InSpec AWS resource pack.

See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.

Syntax

Ensure that the permission exists.

describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do
  it { should exist }
end

Parameters

layer_name (required)

The name or Amazon Resource Name (ARN) of the layer.

version_number (required)

The version number.

Properties

policy
The policy document.
revision_id
A unique identifier for the current revision of the policy.

Examples

Ensure a policy is available.

describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do
  its('policy') { should eq 'POLICY' }
end

Ensure a revision ID is available.

describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do
    its('revision_id') { should eq 'REVISION_ID' }
end

Matchers

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

The controls will pass if the get method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_lambda_layer_version_permission(layer_name: 'LAYER_NAME', version_number: 'VERSION_NUMBER') do
  it { should be_available }
end

AWS Permissions

Your Principal will need the Lambda:Client:GetLayerVersionPolicyResponse action with Effect set to Allow.

Was this page helpful?

×









Search Results