aws_lambda_permissions Resource
Use the aws_lambda_permissions
InSpec audit resource to test properties of multiple AWS Lambda permissions.
The AWS::Lambda::Permission
resource grants an AWS service or another account permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function.
For additional information, including details on parameters and properties, see the AWS documentation on AWS Lambda permission.
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 permission has the desired statement id.
describe aws_lambda_permission(function_name: 'LAMBDA_FUNCTION_NAME') do
its('sids') { should include 'STATEMENT_ID' }
end
Parameters
function_name
(required)
Properties
sids
- The statement ID of the function.
effects
- The effect of the function.
principals
- The AWS services or accounts that invokes the function.
actions
- The action of the function.
resources
- The resource ARNs of the function..
Examples
Ensure a statement ID is available.
describe aws_lambda_permission(function_name: 'LAMBDA_FUNCTION_NAME') do
its('sids') { should include 'STATEMENT_ID' }
end
Ensure an effect is available.
describe aws_lambda_permission(function_name: 'LAMBDA_FUNCTION_NAME') do
its('effects') { should include 'Allow' }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.AWS Permissions
Your Principal will need the Lambda:Client:GetPolicyResponse
action with Effect
set to Allow
.