Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mikerochip opened this issue Feb 13, 2020 · 15 comments
Open

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

mikerochip opened this issue Feb 13, 2020 · 15 comments
Labels
dev tools CodeStar, CodeCommit, CodeBuild, CodeDeploy, CodePipeline, Cloud9, X-Ray

Comments

@mikerochip
Copy link

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
  2. Inhibits new user's ability to understand template anatomy
  3. 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

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

Developer Tools, Enhancement

@luiseduardocolon luiseduardocolon added the dev tools CodeStar, CodeCommit, CodeBuild, CodeDeploy, CodePipeline, Cloud9, X-Ray label Feb 18, 2020
@PatMyron
Copy link
Contributor

PatMyron commented Feb 23, 2020

More generalized workaround with the AWS::Partition pseudoparameter as described in:
#68 (comment)
https://stackoverflow.com/a/59362496/4122849

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

@mikerochip
Copy link
Author

Oh right, forgot about that one. Honestly it's difficult to tell from outside AWS who's responsible for providing this kind of functionality.

If it's the cfn team then this issue feels like a duplicate of #68 but if it's the CodePipeline team then it'd be better if this issue stayed separate.

My concern is that inertia will set in if ALL Arns are added at once. Individual additions feels more tractable since you can make quicker, more incremental progress.

@andreybleme
Copy link

Any news about this? I have just lost 2h of my day trying to get the Arn using Fn::GetAtt 💔

@libert-xyz
Copy link

libert-xyz commented Jan 5, 2021

vouch for this.
I need to get my pipeline arn to use it in AWS::CodeStarNotifications::NotificationRule

@jwalsh2me
Copy link

I just also hit this one! Can we add a return value to make it consistent with CodeBuild etc?

@fernandohonig
Copy link

This is needed. Thanks.

@aleksei-panin
Copy link

Also vote for this! Please implement! Thanks!

@chienkira
Copy link

+1

@WaelA WaelA changed the title AWS::CodePipeline::Pipeline-Add Arn as a Return Value AWS::CodePipeline::Pipeline - Add Arn as a Return Value Aug 4, 2021
@muthu329024
Copy link

vouch for this.
I need to get my pipeline arn to use it in AWS::CodeStarNotifications::NotificationRule

work-around:

  Resource: !Sub
                - 'arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:${PipelineName}'
                - { PipelineName: !Ref MyPipeline }

@benbridts
Copy link

You can make it even shorter if you want:

!Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:${MyPipeline}"

@65
Copy link

65 commented Jul 6, 2022

+1 for this

@mday-ntirety
Copy link

Please add this. I need to pass a codepipeline arn to AWS::Scheduler::Schedule in the same stack.

@RamazanKara
Copy link

+1

@neoReuters
Copy link

+1. It's a value available already - why isn't this just exposed?

@sbraverman
Copy link

+1
Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev tools CodeStar, CodeCommit, CodeBuild, CodeDeploy, CodePipeline, Cloud9, X-Ray
Projects
None yet
Development

No branches or pull requests