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_enabledSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.lambda_function_environment_encryption_enabled --shareSQL
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_linefrom  terraform_resourcewhere  type = 'aws_lambda_function';