turbot/aws_insights

Query: elastic_beanstalk_applications_for_codepipeline_pipeline

Usage

powerpipe query aws_insights.query.elastic_beanstalk_applications_for_codepipeline_pipeline

SQL

with pipeline_details as (
select
jsonb_array_elements(stages) as stage
from
aws_codepipeline_pipeline
where
arn = $1
and region = split_part($1, ':', 4)
and account_id = split_part($1, ':', 5)
),
beanstalk_actions as (
select
a -> 'Configuration' ->> 'ApplicationName' as application_name
from
pipeline_details,
jsonb_array_elements(stage -> 'Actions') as a
where
stage ->> 'Name' = 'Deploy'
and a -> 'ActionTypeId' ->> 'Provider' = 'ElasticBeanstalk'
)
select
arn as beanstalk_app_arn
from
aws_elastic_beanstalk_application
where
name in (select application_name from beanstalk_actions);