I’m LIKING Terraform BUT Sometimes, It’s Painful!

Vikram Nayyar CS
3 min readAug 26, 2024

--

Introduction:

This is long overdue but I finally decided to delve into the world of Terraform. It’s something that I’ve thought about for a while but never ended up taking that step. Now that university is done, there’s no harm in exploring new tech.

As always, before we get into this week’s article, please make sure to applaud, comment and share this post with your friends.

Happy Reading!

Thoughts Before Using It:

The idea of Terraform (well the concept of “Infrastructure as Code”, IaC) really is amazing. Me personally, I don’t want to be aimlessly browsing Google Cloud Platform. I would much rather do this programmatically as it keeps everything in one place and in my opinion, automation is always favourable.

At this point, I just really appreciated the idea of Infrastructure of Code, I was all for it!

Problems Encountered:

No region found.

No project found.

Resource already exists.

Cannot find the IAM Policy for the specific resource.

Next Steps to Rectify Them:

I should point out that these were challenging at the time. Of course I did the usual actions of googling the error messages and browsing stack overflow however this is all completely new to me and it was time consuming.

The first 2 error messages were simple to rectify as they clearly state the problem.

The next one was challenging because the error message was saying one thing however when I opened Google Cloud Platform, I couldn’t see my resource. My next step was to use the GCloud Shell to see if the resource was appearing there however again, it wasn’t visible.

This was by far the most challenging bug and it turned out that I had to use the project’s name instead of the project id. In all honesty, I’m not sure why this was the case however it got the code working so I was happy :)

Future Improvements:

Use multiple Terraform files in order to improve the readability of the codebase.

Make use of environment variables.

Tweak service accounts to ensure that they have the minimal responsibility needed to complete their role.

Thoughts After This Experience:

Despite all of the challenges (yes, some of them took a lot of time!), I can still appreciate the value of IaC.

One big reason for me actually taking this step was because the “Cloud Resume API” encourages the use of Terraform in order to improve the project’s quality.

This is only the beginning. The aim was to develop an understanding of Terraform because whilst documentation is helpful, nothing is ever as simple as what the docs say. This was achieved so this whole “exercise” was a success!

Final Things:

As always, thank you for taking the time to read this article.

It was challenging to work out how much I should write in this week’s post. I could’ve included error screenshots and perhaps there’s more detail I could’ve gone into. With that being said, future blog posts can discuss my experiences with Terraform and I can relate them to more significant projects.

All my links are here.

--

--