cloudformation-guard
cloudformation-guard copied to clipboard
`cfn-guard validate -o json` does not include `CDK-Path`
I see CDK-Path in text output, but don't see when using-o json
.
By the way, should there be a difference between --print-json
and -o json
? Why not have only -o json
?
Command
cfn-guard validate -d template.json -r rules.guard -o json > output.json
template.json
{
"Resources": {
"WebsiteBucket4326D7C2": {
"Type": "AWS::S3::Bucket",
"Properties": {
"AccessControl": "PublicRead"
},
"Metadata": {
"aws:cdk:path": "LandingPageFrontend/Website/Bucket/Resource"
}
}
}
}
rules.guard
let aws_s3_bucket_resources = Resources.*[ Type == 'AWS::S3::Bucket' ]
rule aws_s3_bucket_versioning_defined {
when %aws_s3_bucket_resources not empty {
%aws_s3_bucket_resources {
Properties {
VersioningConfiguration exists <<VersioningConfiguration is not defined>>
}
}
}
}
Originally posted by @alexpulver in https://github.com/aws-cloudformation/cloudformation-guard/issues/204#issuecomment-1171957925
Noted @alexpulver Will bring this back to the team.
--print-json
is supposed to print JSON for abstract syntax tree for the clauses in the rule, which tells us more details about how the clauses get evaluated.
-o json
just changes the format of output summary that's emitted for failures, with error message from the rule, if any.
We will keep this issue opened, and make the --help
docs less ambiguous.
Thank you!
Hey @alexpulver due to work required to add this, and it leading to possibly a breaking change with existing consumers of the JSON output we have chosen to not add this to the current JSON output.
Thanks,