aws-cloudformation / cloudformation-guard

Guard offers a policy-as-code domain-specific language (DSL) to write rules and validate JSON- and YAML-formatted data such as CloudFormation Templates, K8s configurations, and Terraform JSON plans/configurations against those rules. Take this survey to provide feedback about cfn-guard: https://amazonmr.au1.qualtrics.com/jfe/form/SV_bpyzpfoYGGuuUl0
Apache License 2.0
1.3k stars 180 forks source link

[Enhancement] Github action should support single rule and template files for validation #547

Closed dannyvassallo closed 2 months ago

dannyvassallo commented 3 months ago

Describe the issue

Currently the action and typescript library only support pointing to a directory for either rules or template files. We can update the node file system wrappers to handle single files instead of just directories in the typescript library that the action uses.

Any examples

You can reproduce by pointing to a file instead of a directory in any of the Github Action configs.

Operating System: Github Action

OS Version Not relevant

Additional context This was a bit of an oversight while creating the typescript library. Since you can point to a single file in either case when using the binary, the customer expectation that it should also work for the action or TS library is reasonable.

You can obviously point to a folder with a single file in it as a workaround but this could / should be addressed to alleviate confusion across the two APIs.

dannyvassallo commented 2 months ago

New version available here: https://github.com/aws-cloudformation/cloudformation-guard/releases/tag/action-v0.0.5