Getting Started
Download the Terraform Provider
Version: 1.2.0
- checksums.txt
- macOS - 64bit
- Linux - 64bit
- Linux - 32bit
- Linux ARM - 64bit
- Linux ARM - 32bit
- FreeBSD - 64bit
- FreeBSD - 32bit
- FreeBSD ARM - 64bit
- FreeBSD ARM - 32bit
- OpenBSD - 64bit
- OpenBSD - 32bit
- Solaris - 64bit
- Windows - 64bit
- Windows - 32bit
Add the plugin to the terraform plugins directory
Unzip and add the terraform-provider-edw_v1.2.0
file to ~/.terraform.d/plugins
on linux/OSX and %APPDATA%\terraform.d\plugins
on Windows.
We also recommend setting an environment variable for caching terraform providers:
export TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
Get the Master Token from the UI
After downloading the Terraform provider, you’ll need a Client ID
and a
Master token
for authentication purposes. To get these, please follow these
steps:
-
Log on to the UI using your credentials.
-
Click the “Key” icon on the top right to go to Home>Access page.
- Click the “Generate” button under “Master Token” section.
- Copy the “Client ID” as well as “Master Token” and keep it for your records, since these will be required to use the ElasticDW terraform provider to manage your resources.
- These can be generated again as needed, however you will have to update your ElasticDW terraform provider configuration, since the previous master token is disabled when a new one is generated.
Set the Client ID and Master Token environment variables
The following environment variables must be present for the terraform provider to be able to manage resources. Use the Client ID and Master Token from the prior step.
export EDW_CLIENT_ID=<your_client_id>
export EDW_TOKEN=<your_master_token>
Create, Plan and Apply Terraform resources
After the above steps, you are ready to use the ElasticDW Terraform provider to create environments, clusters, and other resources as code:
provider "edw" {}
# Create an environment
resource "edw_environment" "my-environment" {
name = "test-env-1"
aws_iam_role = "arn:aws:iam::xxxx:role/edw/access/role/edw-access-role"
}
# Create a license from the content of a local file
data "local_file" "license_file" {
filename = "${path.module}/license.txt"
}
resource "edw_license" "my-license" {
name = "test-lic-1"
content = data.local_file.license_file.content
}
# Create a cluster
resource "edw_cluster" "my-cluster" {
name = "dev-cluster-a"
environment_id = edw_environment.my-environment.id
license_id = edw_license.my-license.id
database_name = "vertica"
database_master_password = "secret-password"
vertica_version = "10.0.0-0"
storage_size = 128
node_count = 1
disable_backups = false
enable_eon_mode = false
aws_region = "us-west-2"
aws_vpc_id = "vpc-xxxx"
aws_subnet_id = "subnet-xxxx"
aws_instance_type = "m4.large"
use_aws_spot_instances = false
}
Video Guide
This video gives some examples of how the Terraform works. The CLI is showed here as well.