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

Standardize ".cfn" file extension for CloudFormation templates

Open iainelder opened this issue 3 years ago • 4 comments

Resource Name

Template files of all formats.

Details

From CloudFormation concepts:

A CloudFormation template is a JSON or YAML formatted text file. You can save these files with any extension, such as .json, .yaml, .template, or .txt.

The lack of a standard file extension makes it more difficult to configure tools like pre-commit to run checks such as cfn-lint only on CloudFormation files.

Current workarounds require you to use a file path filter to identify where the CloudFormation files are. This can get tricky when there are other JSON or YAML files in the project and when the CloudFormation files are stored in different places.

I propose ".cfn" as a standard file extension to make it easy to identify CloudFormation files.

This ought to be backwards compatible since the existing tooling can continue to accept files with any name and depend on the content instead.

See https://github.com/pre-commit/identify/issues/281 for context.

iainelder avatar Feb 05 '22 13:02 iainelder

.cfn.yaml would probably be better since it'd still be unique, but integrations without specific support for the new extension would still at least recognize it as YAML

PatMyron avatar Mar 30 '22 21:03 PatMyron

I like it! So:

  • .cfn.yaml for templates in YAML format
  • .cfn.json for templates in JSON format

iainelder avatar Mar 30 '22 22:03 iainelder

@iainelder 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

I love the idea of ".cfn.yaml". That would make a lot of our automations much simpler.

And perhaps this is heretical, but this feels like a first step to treating the "Cloud Formation template language" as its own first-class programming language (CFTL?), which just happens to have a built-in module for managing AWS resources...

drernie avatar Sep 09 '22 16:09 drernie