turbot/aws_insights

Query: ecr_repositories_for_codepipeline_pipeline

Usage

powerpipe query aws_insights.query.ecr_repositories_for_codepipeline_pipeline

SQL

select
arn as ecr_repository_arn
from
aws_ecr_repository
where
repository_name in
(
select
a -> 'Configuration' ->> 'RepositoryName'
from
aws_codepipeline_pipeline,
jsonb_array_elements(stages) as s,
jsonb_array_elements(s -> 'Actions') as a
where
s ->> 'Name' = 'Source'
and a -> 'ActionTypeId' ->> 'Provider' = 'ECR'
and arn = $1
and region = split_part($1, ':', 4)
and account_id = split_part($1, ':', 5)
);