ElasticDW Docs

Getting Started

Download the Terraform Provider

Version: 1.2.0

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:

  1. Log on to the UI using your credentials. /img/Authentication%20UI/login.png

  2. Click the “Key” icon on the top right to go to Home>Access page.

  1. Click the “Generate” button under “Master Token” section.
  2. 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.
  3. 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
}