../../_images/login_button.png ../../_images/signup_button.png



Terraform 0.13.x Scalr Provider Installation

Terraform Configuration

Terraform 0.13.x requires that a required_providers block is added to the Terraform configuration. This example is for version 1.0.0 for a local run or a VCS based repo.

terraform {
  required_providers {
    scalr = {
      source  = "scalr.com/scalr/scalr"
      version = "1.0.0"
    }
  }
}

Local Installation

Tip

The provider should always be installed locally to ensure that any CLI command that needs the provider code will work, such as init, plan, apply. This is true even when Terraform configuration specifies a remote backend.

Follow these steps to install the provider locally:

  1. Download the correct binary for your OS, e,g, for Mac this will be terraform-provider-scalr_1.0.0-rc9_darwin_amd64.tar.gz

  2. Unzip and copy the provider file terraform-provider-scalr to either (mac examples, based on version 1.0.0)

{workspace}/terraform.d/plugins/scalr.com/scalr/scalr/1.0.0/darwin_amd64

or

~/.terraform.d/plugins/scalr.com/scalr/scalr/1.0.0/darwin_amd64

Remote Backend Installation

To install the provider into a remote backend workspace the linux_amd64 plugin must be installed into a sub-folder of the Terraform configuration workspace so that it will be uploaded to the remote workspace at the time of a run. The linux plugin is required in addition to the plugin for your local system.

The required_providers block must be added to the terraform {} block along with the backend config.

terraform {
  backend "remote" {
    hostname = "example-account.scalr.io"
    organization = "env-xxxxxxxxxxxx"
    workspaces {
      name = "example-name"
    }
  }
  required_providers {
    scalr = {
      source  = "scalr.com/scalr/scalr"
      version = "1.0.0"
    }
  }
}
  • For Terraform configurations in VCS repos linked to workspaces in a Scalr remote backend, the Scalr provider must be added to the VCS repo.

  • For Terraform configurations being run via the CLI the provider must be added to local directory/folder where the Terraform configuration is held

Note

The linux_amd64 plugin is required for the Scalr remote backend.

Follow these steps,

  1. If working with a VCS based repo, clone or pull the repo locally.

  2. Download the binary for linux_amd64 for the version you require, e,g, terraform-provider-scalr_1.0.0-rc9_linux_amd64.tar.gz

  3. Copy terraform-provider-scalr to {workspace}/terraform.d/plugins/scalr.com/scalr/scalr/1.0.0/linux_amd64

  4. For a VCS based repo, commit and push back to the repo.

Now when you run terraform init; terraform apply, or a run is triggered by the VCS integration, the plugin will be automatically uploaded to the workspace.