Brain Phrye

code cooking diy fiction personal photos politics reviews tools 

Terraform errors

[ Listen to article ]

So terraform has this interesting feature. Say you have resource A and it depends on resource B. But it turns out there’s an error in the definition of resource B. Say resource B has an element that’s a string and there’s a limit to how big the string can be and as defined the string is too large.

In that case terraform plan will exit with an error. Which makes sense. But the error is that resource A is broken because it can’t find B. Nothing about why B is broken. Just that it’s missing. But if you look in your configs, there’s B! And then you look at this for like 10 hours going, “I see B, did I spell it wrong? Does the name for B break some rule? Is the file it’s in the wrong name? I still see it but it doesn’t see it, why doesn’t it see it???? ARGH!!!!”

Specifically in this case it was an aws_eip entry complaining about an aws_instance not existing - when it very much did. It turned out the user_data param for aws_instance had limits I was exceeding. So it didn’t exist due to that error but never tells me. So frustrating.