Open corymhall opened 1 year ago
Thank you for submitting this issue. The check is using a basic AND operation which was put in there for backward compatibility at the time for older versions of cfn-guard. We are working with the cfn-guard team to make this work for custom error messages.
With the current version a single property value check will complete the exists and value check in one operation. What we can do is remove the exists check to eliminate this issue. There are a few other rules this is done and we can update those as well.
@corymhall the issue you are seeing is something being worked on within cfn-guard. Due to that we have transferred the issue to the repo.
Hi @corymhall, your workaround is currently the best way to achieve your wishes is to encapsulate all the checks inside of a parametrized rule and then use that message.
I am going to go ahead and change the label from bug to enhancement. The reason for this is because this behaviour is as expected.
What is the problem?
When writing a rule, any error message needs to be applied to every check.
So for example the s3_bucket_versioning_enabled rule is written like this:
The custom message there will only be shown in the JSON response for the
%s3_buckets_versioning_enabled.Properties.VersioningConfiguration.Status == 'Enabled'
check. If it fails at theexists
check then the error message won't be shown.Reproduction Steps
template
rule s3_bucket_versioning_enabled
cfn-guard validate --data path/to/template --rules /path/to/rule
What did you expect to happen?
I would expect the output for each check to contain the custom error message.
What actually happened?
CloudFormation Guard Version
2.1.3
OS
Ubuntu
OS Version
No response
Other information
One solution is to wrap all the checks inside a rule check (example from Control Tower rules)