Terraform Plan Actions

The Terraform Plan action type provides a way for you to run your Terraform plans from CloudBolt. This action type is supported as a Blueprint build item. This way, you can deploy Terraform resources and later manage those as CloudBolt resources.

CloudBolt will create new server records for any VMs created by Terraform Plan actions. They will not automatically be associated with a resource handler, but they can later be discovered by your resource handlers’ ‘Sync VMs’ jobs, allowing you to take advantage of CloudBolt’s powerful server management features.

Initial Setup

There are a few steps required to get a Terraform Plan set up.

Create the needed directories

Create a terraform directory in /var/opt/cloudbolt/ on the CloudBolt host. Then create a plans directory, which is where you will store all of your plan files.

cd /var/opt/cloudbolt/
mkdir terraform

cd terraform
mkdir plans

Install Terraform

Terraform is distributed as a binary package and must be installed on your machine. You can find a list of available downloads for the latest version of Terraform at https://www.terraform.io/downloads.html

You should add a copy of the terraform binary to the /var/opt/cloudbolt/terraform directory that you just created.


cd /var/opt/cloudbolt/terraform
wget https://releases.hashicorp.com/terraform/0.11.4/terraform_0.11.4_linux_amd64.zip
yum install unzip
unzip terraform_0.11.4_linux_amd64.zip
/var/opt/cloudbolt/terraform/terraform      # verify Terraform is installed and prints help text

Add a Plan

Add plan files

Create a directory in :code`/var/opt/cloudbolt/terraform/plans/` and add plan files there. If your Terraform files are hosted on source control, you may clone your repo here.

cd /var/opt/cloudbolt/terraform/plans/
mkdir <new-plan-directory>
cd <new-plan-directory>

scp <your-remote-plan-files> .
# or
git clone <plan-repo>


All Terraform State files in this plan directory will be ignored when the plan is ordered.

Add the plan in the UI

From a Blueprint, go to the Build tab and click Action, and select Terraform Plan as the action type. When creating a new Terraform plan, specify the full path to your plan directory under plan path, i.e. /var/opt/cloudbolt/terraform/plans/<one-of-your-plan-directories>/

Creating and Deleting Terraform Resources

To run the Terraform plan and create resources from that plan, submit an order of the Blueprint. This will deploy a CloudBolt resource for this run of terraform apply. CloudBolt will automatically create records for servers that are created by Terraform, giving you the ability to manage those servers from within CloudBolt. CloudBolt will not be aware of non-server resources, but you can add custom logic to CloudBolt for managing those types of resources.

CloudBolt supports discovering virtual machines of the following resource types (built by Terraform providers):

  • google_compute_instance
  • azurerm_virtual_machine
  • aws_instance
  • vsphere_virtual_machine
  • openstack_compute_instance_v2
  • clc_server
  • nutanix_virtual_machine

Upon deleting the CloudBolt resource, all of the Terraform-created resources will be cleaned up via terraform destroy and marked as deleted in CloudBolt.

Action Inputs on Terraform Plans

CloudBolt will automatically parse variable blocks in Terraform Plans and make those available in CloudBolt as Action Inputs. An administrator may treat these action inputs just like any other in CloudBolt; changing the type, description, label, and pre-set options.


There are a few limitations to the current Terraform integration into CloudBolt.

This integration:

  • Requires using pre-0.12.0 versions of Terraform for Variable parsing.
  • Does not support plans using Terraform’s Remote State.
  • Is not aware of non-server resources such as load balancers, networks, or managed services.
  • Does not enable re-applying modified Plans.
  • Action Inputs do not use Terraform default, type, or description fields in Variables.
  • Terraform Plans must be run with Blueprints which deploy a resource, i.e. the plan will fail to run on a Blueprint with Resource Type None