Control: EC2 instances should not use multiple ENIs
Description
This control checks whether an EC2 instance uses multiple Elastic Network Interfaces (ENIs) or Elastic Fabric Adapters (EFAs). This control passes if a single network adapter is used. The control includes an optional parameter list to identify the allowed ENIs.
Usage
Run the control in your terminal:
powerpipe control run terraform_aws_compliance.control.ec2_instance_not_use_multiple_enis
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.ec2_instance_not_use_multiple_enis --share
SQL
This control uses a named query:
select address as resource, case when jsonb_typeof(attributes_std -> 'network_interface') is null then 'skip' when (jsonb_typeof(attributes_std -> 'network_interface'))::text = 'object' then 'ok' else 'alarm' end status, split_part(address, '.', 2) || case when jsonb_typeof(attributes_std -> 'network_interface') is null then ' has no ENI attached' when (jsonb_typeof(attributes_std -> 'network_interface'))::text = 'object' then ' has 1 ENI attached' else ' has ' || (jsonb_array_length(attributes_std -> 'network_interface')) || ' ENI(s) attached' end || '.' as reason , path || ':' || start_linefrom terraform_resourcewhere type = 'aws_instance';