turbot/aws_insights

Query: cloudformation_stacks_for_codepipeline_pipeline

Usage

powerpipe query aws_insights.query.cloudformation_stacks_for_codepipeline_pipeline

SQL

select
id as stack_id
from
aws_cloudformation_stack
where
name in
(
select
a -> 'Configuration' ->> 'StackName'
from
aws_codepipeline_pipeline,
jsonb_array_elements(stages) as s,
jsonb_array_elements(s -> 'Actions') as a
where
s ->> 'Name' = 'Deploy'
and a -> 'ActionTypeId' ->> 'Provider' = 'CloudFormation'
and arn = $1
and region = split_part($1, ':', 4)
and account_id = split_part($1, ':', 5)
);