aws-cloudformation / cfn-language-discussion

Language discussions for CloudFormation template language
https://aws.amazon.com/cloudformation/
Apache License 2.0
142 stars 13 forks source link

Standardize ".cfn" file extension for CloudFormation templates #45

Open iainelder opened 2 years ago

iainelder commented 2 years ago

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.

PatMyron commented 2 years ago

.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

iainelder commented 2 years ago

I like it! So:

lejiati commented 2 years ago

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

drernie commented 2 years ago

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...