Terraform is a tool that provides the management of the vCloud Director cloud infrastructure from the command line. This article demonstrates the installation and initial configuration in CentOS 7, but it is the same for the vast majority of Linux. For a successful installation, you must have the wget and unzip utilities installed on your system.
First, let's update the system with a command:
sudo yum update
Next, let's install (check the installation) wget, unzip and the nano text editor with the command:
sudo yum install wget unzip nano
Then, download the latest (at the moment of writing 0.12.20) version of Terraform from the developer's website (https://www.terraform.io/downloads.html):
sudo wget https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_linux_amd64.zip
(note that this file is for the amd64 architecture)
Next step is unpacking:
sudo unzip ./terraform_0.12.20_linux_amd64.zip -d /usr/local/bin
Installation is over, check the correctness with the command:
terraform -v
If it's done right, you should see a version of Terraform
Next, you need to create a directory in which the working configuration will be located:
mkdir test
Let's go to the directory we created:
cd test
Terraform uses configuration files with .tf extension. Let's create and open a new configuration file:
sudo nano test.tf
Enter the minimum set of variables for successful connection:
provider "vcd" {
user = "your_login"
password = "your_password"
org = "organization name"
url = "https://vcd.cloud4y.ru"
}
Save the configuration and try to connect:
terraform init
If it's done right, we get that answer:
You can now manage your organization's cloud infrastructure from the command line.