The VAST Terraform Provider allows you to create, modify, or remove resources of a VAST Cluster using Terraform files. Terraform reads these files and applies them to the VAST Cluster using the VAST REST API.
Benefits
Using Terraform and the VAST Terraform Provider, you can automate the creation and modification of entities in a VAST Cluster such as users, views, protected paths, snapshots, policies, quotas, and more, by creating and modifying Terraform files.
Prerequisites
Access to a VAST Cluster with a user & password
Terraform, downloaded and installed (see Installing Terraform)
Getting Setup to Use Terraform
In order to use the VAST Terraform Provider, you must download and install Terraform, and download and configure the Terraform Provider.
Downloading the VAST Terraform Provider
The VAST Terraform Provider is downloaded automatically from the Terraform Registry when you start Terraform.
Installing Terraform
Download the latest version of Terraform from here and then install it.
Using the VAST Terraform Provider
You use Terraform to create and update VAST Cluster resources by creating Terraform files. These files describe the cluster resources to be created or changed.
Supported Resources
These VAST resources can be created or modified using the Terraform Provider.
Views
Policies
Quotas
Users and Groups
Protected Paths
S3 Buckets
Tenants
Global Snapshots
VIP Pools
DNS Services
Quality of Service Policies
Replication Peers
S3 Replication Peers
Authorization Providers (LDAP, AD, NIS)
Volumes and Block Hosts (for block storage)
Creating a Terraform File (.tf)
The Terraform file must include these blocks at the beginning:
terraform {
required_providers {
vastdata = {
source = "vast-data/vastdata"
}
}
}
## The VAST Provider
provider vastdata {
username = "<username>"
port = <port>
password = "<password>"
host = "<address>"
skip_ssl_verify = true
version_validation_mode = "warn"
}where:
path to terraform provider binaries is the path to the folder containing the VAST Terraform provider binary, extracted from the repo
username and password are for a VAST admin user on the cluster, with permissions to create and modify resources on the cluster
address and port are the IP address and port of the VAST Cluster
skip_ssl_verify indicates whether to verify the SSL certificate (default: false)
version_validation_mode indicates the level of validation checking (strict or warn)
Running Terraform
Run this command to start Terraform:
terraform init
This will download the VAST Terraform Provider from the Terraform Registry.
Run this command to apply terraform files, to create or modify the resources described in them:
terraform apply
Terraform will analyze all the terraform files in the folder and then list the changes that will be made as a result. When prompted whether to proceed, enter 'yes' (or 'y').
If you re-apply the same files with Terraform, the following results:
resources in the plan that are unchanged from the previous apply will be ignored
resources that are missing from the plan will be removed from the VAST cluster
resources that are changed in the plan will be changed on the VAST cluster
Removing Resources
To remove a resource from the cluster, edit the terraform file in which it is defined, and remove reference to it.
Then, run this command to apply the file and remove the resource from the cluster:
terraform apply
To remove all resources in the cluster, run this command:
terraform destroy
Examples
The docs folder of the VAST Terraform Provider repo has descriptions on how to use each of the resources (in the resources subfolder) and providers (in the providers subfolder).