Open cicdguy opened 4 years ago
Hi @dinakar29. Apologies for the long wait. Can you explain your use case for this feature?
Hi @stilvoid, no worries, and thanks for getting back to me.
My use case is that I have several (100s) of legacy CloudFormation templates that utilize the long-format version of the intrinsic functions with varying formatting styles such as compact YAML vs non-compact YAML. I wanted to have all templates conform to a standard formatting style so there isn’t any drift, and that’s where rain would be very beneficial where it could potentially run as a pre-commit hook.
I'm currently working on overhauling the parsing and formatting of YAML in rain so I haven't forgotten this ticket but it might take a while.
What's the reason to prefer long format over short? Once I'm done with this refactor, it will be easy enough to add a switch to provide it but I'm curious :)
No worries. There is no real reason to prefer the long format over short - just that I have inherited a legacy codebase with 100s of templates which utilize the long format and wanted to minimize the risk of disrupting existing stacks that utilize those templates. I've definitely resorted to using the short form for all new templates going forward.
Hi @cicdguy, sorry for the long delay here, I've been added as a maintainer and I'd like to check with you to see if this is something you still need.
Hi there, I personally no longer need this but I'm sure someone else might benefit from it. Totally up to you on how you want to proceed with this request.
Hi,
just want to check if it's worth creating another issue:
aws-cloudformation-template-formatter has a -c
option to generate compact templates without adding extra blank lines.
Seeing the message from @cicdguy, it looks like a 2019 release of rain still had that flag as well:
rain fmt -c <template>
results in a template that looks like this:
Any chance to re-introduce the compact mode in rain again - if so, let me know and I can raise a separate issue for that.
Go ahead and create a separate issue.
@ericzbeard Thanks, here it is: #105
Hi!
First of all - this project, along with aws-cloudformation-template-formatter, is an awesome tool for formatting YAML-formatted CloudFormation templates. So thank you for creating this, as it is a huge time saver.
Second - is it possible to add the ability to format the CloudFormation templates with the long-format version of intrinsic functions?
For instance, suppose there's a template that looks like this:
rain fmt -c <template>
results in a template that looks like this:Would it be possible to add an additional option to
rain fmt
so that the long-format (Ref:
instead of!Ref
|Fn::Join
instead of!Join
etc) of the intrinsic functions is retained?