turbot/oci_insights

Query: oci_vcn_subnet_by_compartment

Usage

powerpipe query oci_insights.query.oci_vcn_subnet_by_compartment

SQL

with compartments as (
select
id,
'root [' || title || ']' as title
from
oci_identity_tenancy
union
(
select
c.id,
c.title || ' [' || t.title || ']' as title
from
oci_identity_compartment c,
oci_identity_tenancy t
where
c.tenant_id = t.id
and c.lifecycle_state = 'ACTIVE'
)
)
select
c.title as "Title",
count(s.*) as "Subnets"
from
oci_core_subnet as s,
compartments as c
where
c.id = s.compartment_id
and s.lifecycle_state <> 'DELETED'
group by
c.title
order by
c.title;

Dashboards

The query is used in the dashboards: