-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Identify CloudFormation templates #281
Comments
nope, this is unfortunately why the official cfn-lint requires you to set your own |
Thanks for confirming. I've proposed a standard file extension here: aws-cloudformation/cfn-language-discussion#45 |
Thanks @PatMyron for the links to help further the discussion! |
Would identify be able to tag CloudFormation templates with a
cloudformation
tag?A CloudFormation template uses one of two syntaxes (YAML or JSON) and has no standard extension ("you can use any extension", according to the docs).
Although there is no extension, there are a couple of a magic strings. All CloudFormation files contain
Resources
as a top-level key. If that's too general, there's alsoAWSTemplateFormatVersion
, although that's not strictly required (I'd consider it poor form to omit it, though.)I ask for this because I lint my CloudFormation templates in pre-commit using cfn-lint.
I use cfn-lint to lint my CloudFormation templates. As my project grows and I change the organization of my CloudFormation templates, I need to keep the pre-commit configuration synchronized with the project structure to keep everything linted.
All my CloudFormation templates are written with YAML syntax. They are named
*.yaml
because there's no better extension to use.I have other YAML files in my project (for example to configure pre-commit). So I can't just run the linter on all files tagged as
yaml
because it would correctly fail on non-CloudFormation files.Early in the project I just chucked all the CloudFormation templates into a
templates
directory and use thefiles
filter to run cfn-lint only on files in that folder.So my pre-commit configuration looked like this (following Kenneth J Pronovici's example of using Poetry to control the linter version):
As my project grows I move functionality into submodules each containing CloudFormation templates in different subfolders. The problem this causes is that the pre-commit configuration no longer passes all the CloudFormation templates to the linter.
I'm dealing with it by updating the pre-commit configuration each time I identify a new folder to store CloudFormation templates.
I don't like having to maintain that list. It would be great to be able to just let the type tagging take care of it.
I see a similar issue affecting SaltStack files (#61). It seems that part of the problem is that identify is not designed to read the file contents to determine the file type. Does that mean this is a no-go?
The text was updated successfully, but these errors were encountered: