Skip to content
Terraform set up VMs for training
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This repository sets up Virtual Machines in Google Cloud Platform for training. This terraform module will output

  1. Private key (RSA PEM encoded) for the user account (default username tux).
  2. Password for the user account (default username tux).
  3. SSH commands via key and password.
  4. SSH command to access Serial Console. This is needed to access GRUB menu or debug VM at boot time if needed.
  5. Saves the Terraform state file in a bucket in your project.
  6. A wrapper shell script ./ which automatically downloads Terraform binary and sets up your environment etc.
  7. Updates GRUB config for the machine.
  8. Installs all the relevant tools (Ubuntu only).


  1. Create a new project in GCP or use an existing one. Note down the Project ID and update the variable project-id in ./ You may need to enable Compute Engine API if you are creating a new project.
  2. Create a bucket with a unique name and update variable bucket. This is because backend definition does not allow interpolation. :(
  3. Create a service account with Editor and Owner permissions for Terraform. Default name for the account is terraform.
  4. Create a key pair for the above service account and save it in ./credentials/key.json.
  5. Also, save the key inside the heredoc in ./credentials/ by pasting the JSON document between the EOFs heredoc.

GRUB menu access

Use the private RSA key and the serial console command to SSH into serial console in a separate terminal window.

Rebooting Virtual Machine and immediately switching to the serial console and pressiing SHIFT key will get you GRUB menu.

Before the 1st use

$ ./ init



$ ./ graph | dot -Tpng > graph.png


$ / plan


$ ./ apply
You can’t perform that action at this time.