turbot/terraform_aws_compliance

Query: lambda_function_use_latest_runtime

Usage

powerpipe query terraform_aws_compliance.query.lambda_function_use_latest_runtime

Steampipe Tables

SQL

select
address as resource,
case
when (attributes_std ->> 'runtime') is null then 'skip'
when (attributes_std ->> 'runtime') in (
'nodejs14.x',
'nodejs12.x',
'nodejs10.x',
'python3.8',
'python3.7',
'python3.6',
'ruby2.5',
'ruby2.7',
'java11',
'java8',
'go1.x',
'dotnetcore2.1',
'dotnetcore3.1'
) then 'ok'
else 'alarm'
end as status,
split_part(address, '.', 2) || case
when (attributes_std ->> 'runtime') is null then ' runtime not set'
when (attributes_std ->> 'runtime') in (
'nodejs14.x',
'nodejs12.x',
'nodejs10.x',
'python3.8',
'python3.7',
'python3.6',
'ruby2.5',
'ruby2.7',
'java11',
'java8',
'go1.x',
'dotnetcore2.1',
'dotnetcore3.1'
) then ' uses latest runtime - ' || (attributes_std ->> 'runtime') || '.'
else ' uses ' || (attributes_std ->> 'runtime') || ' which is not the latest version.'
end as reason,
path || ':' || start_line
from
terraform_resource
where
type = 'aws_lambda_function';

Controls

The query is being used by the following controls: