Skip to main content

aws_lambdas Resource

Use the aws_lambdas resource to test the collection of lambdas deployed into an account.

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

describe aws_lambdas do
    its('count') { should eq 20 }
end

Parameters

This resource does not require any parameters.

Properties

names
The names of the lambda deployed.
tags
The tags of the lambda deployed.

Examples

Tests that all lambdas with a particular tag is correctly deployed.

lambdas = aws_lambdas()

describe lambdas do
its ('count') { should eq 33}
end

lambdas.tags.each_with_index { | tag, i |
if tag!= {} and tag.include? 'Application' and tag['Application']=='test')
    lambda_name = lambdas.names[i]

    describe aws_lambda(lambda_name) do
        it { should exist}
        its ('handler') { should eq 'main.on_event'}
        its ('version') { should eq '$LATEST' }
        its ('runtime') { should eq 'python3.7' }
    end
end
}

Matchers

This InSpec audit resource uses the standard matchers. For a full list of available matchers, visit the InSpec matchers page.

AWS Permissions

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

You can find detailed documentation at AWS Lambda

Edit this page on GitHub

Thank you for your feedback!

×









Search Results