aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

AWS::CodePipeline::Pipeline - Add Arn as a Return Value

Open
#376 17 comments 74 reactions 0 assignees View on GitHub
dev tools
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

## 1. Title
AWS::CodePipeline::Pipeline-Add Arn as a Return Value

## 2. Scope of request
When you want to reference the arn of a Pipeline, you have to manually construct it like this:

"arn:aws:codepipeline:${AWS::Region}:${AWS::AccountId}:${Pipeline}"

This is bad for a number of reasons:

1. Cumbersome to read and write
1. Inhibits new user's ability to understand template anatomy
1. Inconsistent with other resource types e.g. AWS::IAM::Role where you can write "${MyRole.Arn}"

It would be great for Arn to be a supported attribute when a Pipeline is passed to Fn::GetAtt like this:

"${Pipeline.Arn}"

## 3. Expected behavior

Arn is returned when a pipeline is passed to Fn::GetAtt with the Arn argument.

## 4. Suggest specific test cases

In order to wire up push events in CodePipeline using S3 as a source, you have to pass the arn of the pipeline to an event rule, like this:

```
"EventRule": {
"Type": "AWS::Event::Rule",
"Properties": {
"EventPattern": {
"source": [ "aws.s3" ],
"detail-type": [ "AWS API Call via CloudTrail" ],
"detail": {
"eventSource": [ "s3.amazonaws.com" ],
"eventName": [
"PutObject",
"CompleteMultipartUpload",
"CopyObject"
],
"requestParameters": {
"bucketName": [ { "Fn::Sub": "${SourceBucket}" } ],
"key": [ { "Fn::Sub": "${SourceKey}" } ]
}
}
},
"Targets": [
{
"Id": { "Fn::Sub": "${Pipeline}-Target" },
"Arn": { "Fn::Sub": "arn:aws:codepipeline:${AWS::Region}:${AWS::AccountId}:${Pipeline}" },
"RoleArn": { "Fn::Sub": "${EventRole.Arn}" }
}
]
}
}
```

## 5. Helpful Links to speed up research and evaluation

* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#aws-resource-codepipeline-pipeline-return-values
* https://docs.aws.amazon.com/codepipeline/latest/userguide/update-change-detection.html#update-change-detection-cfn
* https://theburningmonk.com/cloudformation-ref-and-getatt-cheatsheet/

## 6. Category (required) - Will help with tagging and be easier to find by other users to +1

Developer Tools, Enhancement

Contributor guide

Open the contributing guide

Research direction

Start with the linked AWS::CodePipeline::Pipeline return-values documentation and compare the existing AWS::IAM::Role Arn behavior. Verify the Fn::GetAtt Arn result against the EventRule target example; done means a pipeline reference resolves to its ARN without manual construction.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.