turbot/steampipe-mod-terraform-aws-compliance

Control: Lambda functions variable encryption should be enabled

Description

Ensure that functions environment variables encryption is enabled.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.lambda_function_environment_encryption_enabled

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_aws_compliance.control.lambda_function_environment_encryption_enabled --share

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'environment') is not null and (attributes_std -> 'kms_key_arn') is not null then 'ok'
when (attributes_std -> 'environment') is not null and (attributes_std -> 'kms_key_arn') is null then 'alarm'
when (attributes_std -> 'environment') is null and (attributes_std -> 'kms_key_arn') is null then 'skip'
else 'alarm'
end as status,
split_part(address, '.', 2) || case
when (attributes_std -> 'environment') is not null and (attributes_std -> 'kms_key_arn') is not null then ' environment encryption enabled'
when (attributes_std -> 'environment') is not null and (attributes_std -> 'kms_key_arn') is null then ' environment encryption disabled'
when (attributes_std -> 'environment') is null and (attributes_std -> 'kms_key_arn') is null then ' no environment exists'
else ' encryption is enabled even though no environment exists'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_lambda_function';

Tags