cfn-language-discussion icon indicating copy to clipboard operation
cfn-language-discussion copied to clipboard

Add a !Link (or equivalent) function

Open benbridts opened this issue 4 years ago • 2 comments

A lot of time writing CloudFormation is spent by looking up expected inputs and outputs. With questions like:

  • Does this property take a Name, an Arn or something else
  • Do I get that value with !Ref or !GetAtt (see also aws-cloudformation/cfn-language-discussion#56 and aws-cloudformation/cloudformation-coverage-roadmap#68)

A new function, possibly called !Link could remove this friction in a lot of cases:

  • The expected input is documented and hopefully in the schema
  • The possible output is documented and hopefully in the schema

For the case where there is a 1-to-1 mapping CloudFormation should be able to figure out which attribute is needed and resolve it. For other cases there could be:

  • a push to improve outputs (adding more variations to !GetAtt so they can be !Link'ed directly in the related resource without the user having to use !Sub to construct an Arn)
  • a way to specify a template in the schema at the resource property level (This input should be of resource type AWS::Foo::Bar and use this !Sub to construct the value)
  • an independent mapping that defines these relations explicitly.

benbridts avatar Aug 26 '20 22:08 benbridts

+1

JimmyDqv avatar Oct 01 '21 21:10 JimmyDqv

@benbridts 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 avatar May 10 '22 02:05 lejiati