GCP | How to create VM in GCP with Terraform

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Below are the steps for spinning up VM on Google Cloud Platform with Terraform.

  • Refer post Setting up Terraform for GCP, if you don't have Terraform set up ready.
  • Create new file "createvm.tf" write below code.
  • In Terminal and run below command for formatting Terraform files.
  • Run again "terraform init" command.
  • Run "terraform plan" command to check execution plan.
  • finally run "terraform apply" command to create VM on GCP.
  • After performing all the steps you should see a VM with name "gcptutorials-vm" in GCP.

  • Follow US on Twitter:

    Category: GCP

    Python For Beginners