cloudformation-guard
cloudformation-guard copied to clipboard
[BUG] Unknown parse error
Hi, We have a problem with AWS Guard. There are two main commands to run, one is validate and the other one is test. The validate one works with both JSON and YAML files as you can see :
But for the test option it doesnt seeem to work. I try different files even empty one, and I still get this error :
“Error processing Parser Error when parsing rules file Unable to process data in file deploy.cf.json, Error invalid type: map, expected a sequence at line 1 column 0,“
I can get different number lines but the message stay the same
The sample code works perfectly, with the yaml format ( only for the sample ), but not our own yaml format code ( even if we believe its correct ).
I'll provide sample code in comments.
Thanks for reporting. I will check and get back to you.
@Yawnek I wasn't able to reproduce this issue in cfn-guard v2.0.3. Can you please share the sample rule and test file?
I used this two files :
When I used this command : cfn-guard test -r api_gateway_private_access.guard -t cfn-guard-example.yaml
I got : Error processing Parser Error when parsing rules file Unable to process data in file cfn-guard-example.yaml, Error invalid number at line 1 column 2,
As you can the error is clearly not at line 1, column 2 but rather in line 20, cause its missing a space
check_rest_api_is_private:FAIL
( Sorry for the late answer )
@Yawnek I was able to recreate on v2.0.4
On Line 19, expect a space before FAIL
Adding the correct space and then runs as expected.
Will bring this back to the team to discuss.
HI @Yawnek,
After looking into this the team has decided that this actually isn't a bug. The issue has to do with incorrect formatting of yaml. Guard will only be able to parse valid yaml/json. As @razcloud posted in his screenshot there is incorrect spacing between the key and value on line 19. I am going to go ahead and close this issue.
Feel free to reopen if you feel necessary
Thanks