turbot/aws_insights

Query: ecs_clusters_for_codepipeline_pipeline

Usage

powerpipe query aws_insights.query.ecs_clusters_for_codepipeline_pipeline

SQL

with pipeline_action_details as (
select
jsonb_array_elements(stages) -> 'Actions' -> 'Configuration' ->> 'ClusterName' as cluster_name
from
aws_codepipeline_pipeline
where
arn = $1
and region = split_part($1, ':', 4)
and account_id = split_part($1, ':', 5)
),
distinct_cluster_names as (
select distinct
cluster_name
from
pipeline_action_details
where
cluster_name is not null
)
select
ec.cluster_arn as ecs_cluster_arn
from
aws_ecs_cluster ec
join
distinct_cluster_names dcn on ec.cluster_name = dcn.cluster_name;