Using Terraform with Google Cloud Platform – Part 1

This blog series is aimed at those who are interested in developing scalable cloud infrastructure and automating repetitive tasks. I’ll walk you through the setup process to get Google Cloud Platform and Terraform working together and show you how to create a basic virtual machine using 3 files and less than 40 lines of code.

First, let’s talk about how infrastructure development use to be accomplished. Let’s use an example and show how it might have been solved. Imagine we’re a system admin for a medium-sized company that has several well-known clients. One of those clients needs us to create 30 servers, all which have different disk sizes, memory, processors, and operating systems. Oh, and to make things more difficult, they’re in different regions and spread across different cloud vendors — Google Cloud Platform, Amazon Web Services, and Microsoft Azure.

What a nightmare! This is going to take us hours to set up, and we might make some mistakes if we’re not careful. We also have no way to easily test if everything is working, so it’ll likely take us days to debug if we’re not incredibly smart. Thankfully, we have tools like Terraform that allow us to turn a little bit of code into something that can plan, deploy, modify, and destroy all of our systems. If we’re able to get it working, we’ll also need to make some changes to each system, such as modifying the disk size and memory, so that our client isn’t wasting money on unused resources.

Read the full post: