turbot/terraform_aws_compliance

Query: ec2_instance_uses_imdsv2

Usage

powerpipe query terraform_aws_compliance.query.ec2_instance_uses_imdsv2

Steampipe Tables

SQL

select
address as resource,
case
when coalesce(trim(attributes_std -> 'metadata_options' ->> 'http_tokens'),'') in ('optional', '') then 'alarm'
else 'ok'
end as status,
split_part(address, '.', 2) || case
when (attributes_std -> 'metadata_options' -> 'http_tokens') is null then ' ''http_tokens'' is not defined'
when (attributes_std -> 'metadata_options' ->> 'http_tokens') = 'optional'
then ' not configured to use Instance Metadata Service Version 2 (IMDSv2)'
else ' configured to use Instance Metadata Service Version 2 (IMDSv2)'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_instance';

Controls

The query is being used by the following controls: