v3.0.1
What's Changed
- [Misc]: Minor fixes to documentation, and help for command options by @joshfried-aws in #384
- [Enhancement]: Conversion functions by @joshfried-aws in #388
- [BugFix]: Custom Message is now JSON/YAML parseable by @joshfried-aws in #396
- [BugFix]: updating docs, adding is_null and is_float operators by @joshfried-aws in #398
- updating known issues by @joshfried-aws in #397
- [BugFix]: small change for single-line-summary error messages by @joshfried-aws in #399
- [Enhancement]: Adding support for calling functions inline by @joshfried-aws in #400
- [Code Quality]: Addressing new clippy lints (warns) by @joshfried-aws in #401
- [BugFix]: cfn-guard no longer errors out when rule files are empty, or contain only comments by @joshfried-aws in #402
Details
Added support for conversion functions
To improve the user experience for validating templates when schemas use types that might be easier evaluated as a different type (i.e. a string thats actually a number) the 3.0.1 release adds support to convert between specific types.
The conversions allowed are the following
strings/floats-> ints
strings/ints -> floats
strings -> bools
bools/floats/ints -> strings
The following is an example of parsing a string into an int.
Given the following template:
Resources:
asg:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
MinSize: "1"
We can write the following rule
let asg = Resources.*[ Type == 'AWS::AutoScaling::AutoScalingGroup' ]
rule test_parse_int when %asg !empty {
let min = parse_int(%asg.Properties.MinSize)
%min == 1
}
Full Changelog: 3.0.0...3.0.1