Creating Basic infra in Google cloud using Terraform

Creating Basic infra in Google cloud using Terraform


Google Cloud Platform, offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search and YouTube. Alongside a set of management tools, it provides, a series of modular cloud services including computing, data storage, data analytics and machine can find more information here

Services offered by Google cloud

Here are the some of services offered by google

1.Compute Engine:

compute engine provides services related to virtual machines,disks, can find more about compute engine from here

2.App Engine:

Google’s App Engine makes possible to built salable mobile backends in any language in google cloud platform more about appengine 

please  refer google official documentation here for detailed information here

Writing code as infrastructure in Terraform for google cloud

To configure terraform with google cloud provider we need obtain google cloud credentials

Obtaining GCP Credentials:

  • Once you’re logged into your GCP console, click on API Manager à Credentials à Create Credentials à Select Service Account Key à New Service Account à Fill in the details à Select Role for Project à Select the key type as JSON and proceed to Create
  • The Credentials file in .JSON format will be downloaded shortly.

Create a Project:

  • Login to your GCP console à Click on Select Project à Click on + to create a New Project
  • Once your Project is created, click on the Project from the Dashboard.

Configuring Google Cloud with Terraform:

The Google Cloud provider is used to interact with Google Cloud services using Terraform. The provider needs to be configured with the proper credentials before it can be used & can be done in the following way. Save the file as


Launching Basic Infrastructure: 




Launching Instances into a VPC:

Save the file as



The Conclusion

Here we launched an Instance in a Subnet with in a VPC in Google Cloud using Terraform


Generate your own SSH key to before you launch your Instance using “ssh-keygen” in Linux Distros & “Puttygen” in Windows



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s