Skip to main content

aws_lambda_versions Resource

Use the aws_lambda_versions InSpec audit resource to test properties of multiple AWS Lambda function versions.

The AWS::Lambda::Version resource creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn’t change.

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

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 Lambda version exists.

describe aws_lambda_versions(layer_name: 'LAYER_NAME') do
  it { should exist }
end

Parameters

layer_name (required)

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

Properties

layer_version_arns
The ARN of the layer version.

Field: layer_version_arn

versions
The version number.

Field: version

descriptions
The description of the version.

Field: description

created_dates
The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

Field: created_date

compatible_runtimes
The layer’s compatible runtimes.

Field: compatible_runtimes

license_infos
The layer’s software license.

Field: license_info

compatible_architectures
A list of compatible instruction set architectures .

Field: compatible_architectures

Examples

Ensure a layer version ARN is available.

describe aws_lambda_versions(layer_name: 'LAYER_NAME') do
  its('layer_version_arns') { should include 'LAYER_VERSION_ARN' }
end

Ensure a version is available.

describe aws_lambda_versions(layer_name: 'LAYER_NAME') do
  its('versions') { should include 1 }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

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

exist

Use should to test that the entity exists.

describe aws_lambda_versions(layer_name: 'LAYER_NAME') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_lambda_versions(layer_name: 'LAYER_NAME') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_lambda_versions(layer_name: 'LAYER_NAME') do
  it { should be_available }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results