Control: Ensure that Compute instances do not have public IP addresses
Description
Compute instances should not be configured to have external IP addresses.
Usage
Run the control in your terminal:
powerpipe control run terraform_gcp_compliance.control.compute_instance_with_no_public_ip_addresses
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_gcp_compliance.control.compute_instance_with_no_public_ip_addresses --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std -> 'network_interface' -> 'access_config') is null or (attributes_std -> 'network_interface' ->> 'access_config') like '{}' then 'ok' else 'alarm' end status, split_part(address, '.', 2) || case when (attributes_std -> 'network_interface' -> 'access_config') is null or (attributes_std -> 'network_interface' ->> 'access_config') like '{}' then ' not associated with public IP addresses' else ' associated with public IP addresses' end || '.' reason , path || ':' || start_linefrom terraform_resourcewhere type = 'google_compute_instance';