Deploy an Ubuntu or Debian Google Cloud Platform server with Terraform

This guide provides the information you need to deploy an Ubuntu or Debian Google Cloud Platform Server with systemd using Terraform. Depending on your target server and enrollment type some topics in this guide may not apply to you, such as if your team's project will not be using Terraform or if you plan to add a different server type to your project. Modify these steps as needed to fit your team or refer to another cloud deployment guide.

Creating a cloud server with Terraform means installing the Terraform tool on your personal machine and using an Access ID, enrollment token, and secret ID to create servers on the Google Cloud Platform console. After being created, your new servers should automatically be listed in your team's Advanced Server Access console.

Note: This guide uses the ScaleFT Starter Kit as its Terraform module. View the kit on GitHub. For your setup, use your company's Terraform repository for your production environment. The configuration values in your terraform.tfvars file should be similar to those in this guide.


You need the following to deploy a Google Cloud Platform server with Terraform:

Google Cloud Platform

Requirement Description
Google Cloud Platform account A Google Cloud Platform account is needed to access the GCP console, where you create virtual machines for your team.

Advanced Server Access

Requirement Description
Advanced Server Access team This is the top-level object that is representing an organization within Advanced Server Access.
Advanced Server Access project This is the authorization-scope of your team, organizing your users, groups, and servers.

Download and install Terraform

  1. Download the Terraform installer.
  2. Unzip the downloaded file and run the executable.

Create an Advanced Server Access enrollment token

  1. On the Advanced Server Access dashboard, click Projects.
  2. Select the project you want to add the server to.
  3. Select the Enrollment tab, then click Create Enrollment Token.

    Note: You can use the same enrollment token every time you add a server to your team. If you have already created an enrollment token, skip this step.

  4. Enter a description for the token, then click Submit.
  5. After the token has been successfully created, copy the string of characters from the Token field and store it in a safe location.

Create and save your Google Cloud Platform project ID

  1. Navigate to the Google Cloud Platform console and sign in to your account.
  2. Use the Select a project dropdown at the top of the page to click the New Project button.

  3. Create a new name for your project and use the Location field to set its parent organization or folder .
  4. Click Create when you've finished creating your project.
  5. From the dashboard of your new project, copy the Project ID number from the Project Info section and store it in a safe location.

    Note: To find your project's dashboard, use the Select a project box at the top of the console.

Create and configure your Terraform.tfvars file

  1. Create a file named terraform.tfvars and add the following lines:

    project: "<project-id>"


  2. Replace <project-id> with your Google Cloud Platform project ID.
  3. Replace <enrollment-token> with your Advanced Server Access enrollment token.
  4. Save the file and place it in your Terraform module.

Enable the Google Compute Engine API for your project

  1. Navigate to your project's dashboard in the Google Cloud Platform console.

  2. In the left sidebar, use the APIs & Services tab to click the Dashboard option.
  3. Click ENABLE APIS AND SERVICES under the search bar to navigate to the API Library.
  4. Under Category on the left side of the page, click Compute.
  5. Select the tab for Compute Engine API.
  6. Click Enable.

Run Terraform commands to create your server

  1. In your machine's console, run the command which terraform to confirm that your terraform path exists. Depending on your platform, the output should look similar to:/Users/user/bin/terraform
  2. Confirm that you are in your Terraform module, then run terraform init
  3. Confirm that the information in terraform.tfvars is correct by running terraform plan. If you receive any errors, troubleshoot as needed before proceeding
  4. Run terraform apply to begin creating your servers. Enter yes if prompted for approval.

Confirm that your new servers are listed in Advanced Server Access before you attempt to connect to them.

Next steps

Verify server enrollment