turbot/terraform_gcp_compliance

Query: compute_instance_block_project_wide_ssh_enabled

Usage

powerpipe query terraform_gcp_compliance.query.compute_instance_block_project_wide_ssh_enabled

Steampipe Tables

SQL

select
address as resource,
case
when ((attributes_std ->> 'source_instance_template') is not null and (attributes_std ->> 'metadata') is null) then 'skip'
when ((attributes_std ->> 'source_instance_template') is not null and (attributes_std -> 'metadata' ->> 'block-project-ssh-keys') is null) then 'skip'
when ((attributes_std ->> 'source_instance_template') is null and (attributes_std ->> 'metadata') is null) then 'skip'
when ((attributes_std ->> 'source_instance_template') is null and (attributes_std -> 'metadata' ->> 'block-project-ssh-keys') is null) then 'skip'
when (attributes_std -> 'metadata' ->> 'block-project-ssh-keys')::bool then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when ((attributes_std ->> 'source_instance_template') is not null and (attributes_std ->> 'metadata') is null) then ' underlying source template is unknown'
when ((attributes_std ->> 'source_instance_template') is not null and (attributes_std -> 'metadata' ->> 'block-project-ssh-keys') is null) then ' underlying source template is unknown'
when ((attributes_std ->> 'source_instance_template') is null and (attributes_std ->> 'metadata') is null) then ' block project-wide SSH keys not set'
when ((attributes_std ->> 'source_instance_template') is null and (attributes_std -> 'metadata' ->> 'block-project-ssh-keys') is null) then ' block project-wide SSH keys not set'
when (attributes_std -> 'metadata' ->> 'block-project-ssh-keys')::bool then ' block project-wide SSH keys enabled'
else ' block project-wide SSH keys disabled'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type in ('google_compute_instance', 'google_compute_instance_template', 'google_compute_instance_from_template');

Controls

The query is being used by the following controls: