avatarTeri Radichel

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2759

Abstract

div><h3>A convoluted combination of Bash and CloudFormation that caused obnoxiously confusing errors</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*4oxP4LXk8l8c3mpRvO7ejg.png)"></div> </div> </div> </a> </div><p id="7276">The second time I got this error I actually thought I was done with my code. Somehow I inadvertently replaced all my parameters with the number 1. Don’t ask me how. But once again I got this nonsensical error:</p><div id="a85a"><pre><span class="hljs-built_in">int</span><span class="hljs-built_in">object</span> <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> iterable</pre></div><p id="7212">This time the error was only on the command line. The template never executed. Just this:</p><figure id="912b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*f_JzL5sIzp7eS-r1nIRS9w.png"><figcaption></figcaption></figure><p id="0cf5">So how was I supposed to know this was not an error in my template code but with the CLI call? A little hint would be nice.</p><p id="ff6c">Now that I’ve written this down in a blog post hopefully I will remember what the problem is next time I see it.</p><p id="c428"><i>Update:</i></p><p id="3afa">Even more bizarre…is that when I finished writing this post and went back and printed out my parameters to see what is going on and without making any other changes the code worked again. I don’t know how parameter-overrides got set to 1 or how it got fixed. Multi-threaded coding error? Not sure. Will have to see if it happens again.</p><p id="7758"><i>Update 9/22/2022 6:17 PM ET:</i></p><p id="f640">I’m tracking this bug as it is random and not sure what causes it. It seems to be happening when I look through some numbers to create subnets. Everything will run fine and did all morning. Then in the evening it starts failing. I don’t know if the morning / evening thing is consistent yet but it seems to be. I’ll track it moving forward and record when it happens.</p><p id="9f2d">I commented out the functions that deploy subnets and NACLs and the rest of the code works fine. The main difference with the code to deploy subnets is the iterator from 1 to n to deploy subnets. I am not writing any multi-threaded code so as far as I know there should be no confusion between threads unless that is happening on the underlying OS. Somehow these values calculate fine and suddenly the script starts failing and my parameters get set to “1”.</p><figure id="d79e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*z1g9nHBPiJrS-AfpsScARg.png"><figcapt

Options

ion></figcaption></figure><p id="2bb8">The only thing I have that could be setting values to 1 is this function which kicks out 1 as an error. This function is in a different file included with “source”:</p><figure id="98fe"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Bu9nBxr0YsIq7nRF5MjUow.png"><figcaption></figcaption></figure><p id="03a3">However, if my values were not set properly by my own code, it seems like I would get the error consistently, but it comes and goes with no changes to this code.</p><p id="14bf">Also, I randomly get a 1 in my current folder all the time after errors, even errors unrelated to this one:</p><figure id="c0ff"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*tyziR7r4jVlzXss64UN5vg.png"><figcaption></figcaption></figure><p id="8f00">I deleted that “1” above and re-ran my script. See, now suddenly it works again:</p><figure id="490b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*SYbUDzw1lrnbPo7J6uhmyw.png"><figcaption></figcaption></figure><p id="cb69">I don’t know if deleting that 1 had anything to do with it. No code changes.</p><p id="48d2">Follow for updates.</p><p id="4a3a">Teri Radichel | <i>© <a href="https://2ndsightlab.com/?source=post_page---------------------------">2nd Sight Lab</a> 2022</i></p><div id="8b5f"><pre><span class="hljs-section">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 Lab</pre></div><div id="caae"><pre><span class="hljs-section">Need Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for Presentation</pre></div><div id="46f6"><pre>Follow <span class="hljs-keyword">for</span> more stories like <span class="hljs-keyword">this</span>:

❤️ Sign Up my Medium Email List ❤️ Twitter: <span class="hljs-meta">@teriradichel</span> ❤️ LinkedIn: https:<span class="hljs-comment">//www.linkedin.com/in/teriradichel</span> ❤️ Mastodon: <span class="hljs-meta">@teriradichel</span><span class="hljs-meta">@infosec</span>.exchange ❤️ Facebook: 2nd Sight Lab ❤️ YouTube: @2ndsightlab</pre></div><figure id="550c"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*4oxP4LXk8l8c3mpRvO7ejg.png"><figcaption></figcaption></figure></article></body>

‘int’ object is not iterable: CloudFormation

The mysterious error that doesn’t really explain what’s going on with parameter-overrides

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

⚙️ 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 got the above error while trying to execute a CloudFormation template. Actually I got it a couple of times and by the second time I got it I already forgot what caused it.

Wasted time. Wasted time…please better error messages…

What happened the first time is that I was constructing a string for my parameter overrides in a CLI call and inadvertently passed in an empty string, so the parameter overrides were malformed.

How about an error that says exactly that:

The parameter overrides value malformed. It should be in this form ["x=y","z=q","b=d”]

The template actually executed so I though the error was in my template code and wasted time on that. I always print out my parameters due to a myriad of cryptic error messages related to parameter overrides so I can verify they are correct, so I finally spotted what I was doing wrong.

By the way there are multiple ways to pass in parameter overrides and I’ve had best luck with the above format — especially when there are spaces in one of the parameter values.

The second time I got this error I actually thought I was done with my code. Somehow I inadvertently replaced all my parameters with the number 1. Don’t ask me how. But once again I got this nonsensical error:

intobject is not iterable

This time the error was only on the command line. The template never executed. Just this:

So how was I supposed to know this was not an error in my template code but with the CLI call? A little hint would be nice.

Now that I’ve written this down in a blog post hopefully I will remember what the problem is next time I see it.

Update:

Even more bizarre…is that when I finished writing this post and went back and printed out my parameters to see what is going on and without making any other changes the code worked again. I don’t know how parameter-overrides got set to 1 or how it got fixed. Multi-threaded coding error? Not sure. Will have to see if it happens again.

Update 9/22/2022 6:17 PM ET:

I’m tracking this bug as it is random and not sure what causes it. It seems to be happening when I look through some numbers to create subnets. Everything will run fine and did all morning. Then in the evening it starts failing. I don’t know if the morning / evening thing is consistent yet but it seems to be. I’ll track it moving forward and record when it happens.

I commented out the functions that deploy subnets and NACLs and the rest of the code works fine. The main difference with the code to deploy subnets is the iterator from 1 to n to deploy subnets. I am not writing any multi-threaded code so as far as I know there should be no confusion between threads unless that is happening on the underlying OS. Somehow these values calculate fine and suddenly the script starts failing and my parameters get set to “1”.

The only thing I have that could be setting values to 1 is this function which kicks out 1 as an error. This function is in a different file included with “source”:

However, if my values were not set properly by my own code, it seems like I would get the error consistently, but it comes and goes with no changes to this code.

Also, I randomly get a 1 in my current folder all the time after errors, even errors unrelated to this one:

I deleted that “1” above and re-ran my script. See, now suddenly it works again:

I don’t know if deleting that 1 had anything to do with it. No code changes.

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 Lab
Need Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for Presentation
Follow 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
Int Object Not Iterable
Cloudformation
Bug
Error Message
Parameter Overrides
Recommended from ReadMedium