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

Intrinsic function for constructing ARNs #56

Open
benkehoe opened this issue Aug 4, 2019 · 3 comments
Open

Intrinsic function for constructing ARNs #56

benkehoe opened this issue Aug 4, 2019 · 3 comments
Labels
feature request Proposal for new features or requests

Comments

@benkehoe
Copy link

benkehoe commented Aug 4, 2019

ARNs are a pain to create. They aren't always provided (see aws-cloudformation/cloudformation-coverage-roadmap#68), and they all have slightly different formats. We should have a function that assembles ARNs for us. I imagine a syntax like:

{
  "Fn::Arn": {
    "Service": "s3",
    "Resource": "bucket/my-bucket",
    "Account": false,
    "Region": false
  }
}

Resource can be a string or a list, which will get Fn::Join'd by the empty string. If Account is true, it will use the AWS::AccountId pseudoparameter, if false, it will be omitted, and if it's a string, the value will be used. Similar for Region.

What I'd really like is for the user to not have to provide Account and Region for most ARNs. Make them optional, and know the rules. CloudFormation should know that S3 buckets don't have accounts or regions. It's not that hard to build such a thing. And if it's not 100% up to date, users can specify explicitly.

@lejiati
Copy link
Contributor

lejiati commented May 10, 2022

@benkehoe Thank you very much for your feedback! Since this repository is focused on resource coverage, I'm transferring this issue over to a new GitHub repository dedicated to CloudFormation template language issues.

@lejiati lejiati transferred this issue from aws-cloudformation/cloudformation-coverage-roadmap May 10, 2022
@muneebar muneebar added feature request Proposal for new features or requests and removed enhancement New feature or request labels May 10, 2022
@bjorg
Copy link

bjorg commented Sep 9, 2022

I would recommend the function contains an action verb as well, such as Fn::MakeArn.

When I first read the issue title, I thought this was going to fix the pain of knowing when I need to use Ref vs. Fn::GetAtt to get the ARN of a resource. That would be Fn::GetArn instead.

So, for ease of disambiguation of intent, let's always prefix functions with verbs.

@benkehoe benkehoe changed the title New Function Request Fn::Arn Intrinsic function for constructing ARNs Sep 12, 2022
@benkehoe
Copy link
Author

That's a good point, I've changed the title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Proposal for new features or requests
Projects
None yet
Development

No branches or pull requests

5 participants