cloudformation-guard icon indicating copy to clipboard operation
cloudformation-guard copied to clipboard

cfn-guard-lambda: document how to pass YAML templates and multi-line Guard rules

Open mrinaudo-aws opened this issue 3 years ago • 2 comments

Describe the issue Document how to pass YAML templates and multi-line Guard rules as inputs to cfn-guard-lambda. For example, given a sample YAML template such as:

---
AWSTemplateFormatVersion: '2010-09-09'
Description: Sample template
Resources:
  SampleVolume:
    Type: AWS::EC2::Volume
    Properties:
      Encrypted: true
      Size: 10

and a sample Guard rule:

AWS::EC2::Volume {
    Properties {
        Encrypted == true
        Size <= 10
    }
}

document and provide an example of the expected format to use to pass information (as in above examples) as part of the payload structure.

Any examples

Operating System:

OS Version

Additional context

mrinaudo-aws avatar Oct 19 '21 22:10 mrinaudo-aws

AWS CloudFormation Guard User Guide Page number 7 under the heading To build and run Guard as a Lambda function shows us that rules can be entered as string format unlike other documentations where list input are shown and next heading To call the Lambda function request structure says about string version of the rule set file. I have tried implementing this but was unable to get to a solution. Some more information about this will be very helpful. Thanks in advance.

akumar-99 avatar Feb 02 '22 15:02 akumar-99

@mrinaudo-aws Understood, we will add some examples in our README for lambda that explains this use case better.

Some of the approaches that come to mind include processing multi-line input in bash first and then supplying them as args to the lambda invoke command. But we'll research more to see if there's a more cleaner way of doing this.

akshayrane avatar Sep 21 '22 20:09 akshayrane