While parsing a block mapping…expected <block end>, but found ‘<block sequence start>’
Cryptic error message for a one character problem in AWS CloudFormation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
⚙️ Check out my series on Automating Cybersecurity Metrics. The Code.
🔒 Related Stories: AWS Security | Application Security | CloudFormation
💻 Free Content on Jobs in Cybersecurity | ✉️ Sign up for the Email List
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I’m trying to deploy an AWS CloudFormation template getting this error:
while parsing a block mapping
in "<unicode string>", line 18, column 9:
Version: "2012-10-17"
^ (line: 18)
expected <block end>, but found '<block sequence start>'
in "<unicode string>", line 31, column 10:
- Effect: Allow
^ (line: 31)In this CloudFormation template. Do you see the problem?

Yeah, that lovely error message is fixed like this. Now do you see it?

Seriously which CloudFormation would add some syntax specific errors instead of dumping the generic YAML errors to the screen which are not that helpful for someone new to this. I knew specifically what I changed in this template before I got the error. As a matter of fact, the fix was not what I changed so I don’t know how the problem got into the template at all.
Why in the world it is referencing the version is beyond me. The error is no where near or had anything to do with the version.
Have you figured it out yet? Perhaps even after looking at the corrected version you don’t see it because it’s really hard to spot.
I knew that I added the two MFA conditions. I’ve written about this MFA conditions and possibly incorrect explanation of the logic here, depending on your use case and point of view:
I did not intentionally change the line of code causing the error, nor did I type or delete anything on that line that could have caused those error. Perhaps when I inserted the condition I hit the return key and that caused the second line with “- Effect: allow” to have one less space that it should have. The indentation of the two effect lines do not align in the first version. I added one space and then my template ran correctly.

These error messages could be a lot more helpful if AWS would invest in the time, money, and resources to fix them. It would probably save their customers tons of time in development. There would be less support requests. And additionally, these road blocks probably cause developers to throw their hands up and skip security configurations when things don’t work easily. That’s why I’m writing a lot of sample code to help people deploy things more easily.
Please, please, please test your code every which way and write user-friendly error messages — no matter what code you are writing.
Follow for updates.
Teri Radichel | © 2nd Sight Lab 2022
About Teri Radichel:
~~~~~~~~~~~~~~~~~~~~
⭐️ Author: Cybersecurity Books
⭐️ Presentations: Presentations by Teri Radichel
⭐️ Recognition: SANS Award, AWS Security Hero, IANS Faculty
⭐️ Certifications: SANS ~ GSE 240
⭐️ Education: BA Business, Master of Software Engineering, Master of Infosec
⭐️ Company: Penetration Tests, Assessments, Phone Consulting ~ 2nd Sight LabNeed Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for PresentationFollow for more stories like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
❤️ Sign Up my Medium Email List
❤️ Twitter: @teriradichel
❤️ LinkedIn: https://www.linkedin.com/in/teriradichel
❤️ Mastodon: @teriradichel@infosec.exchange
❤️ Facebook: 2nd Sight Lab
❤️ YouTube: @2ndsightlab






