Apply for invite to IaCP

Scalr Terraform Provider (Preview)

Overview

The Scalr Terraform provider can be used to manage the components within they Scalr IaCP. This will allow you to automate the creation of workspaces, variables, VCS providers and much more.

Authentication

To start, an API token must be generated by clicking on your user on the top right of the screen and click on “TF API Access”:

../_images/api_access.png

This will provide you with an ID and token. The token will disappear after you click close. A user can have as many tokens as they want, it is up to that user to manage the tokens.

The token should then be used within the provider itself:

provider "scalr" {
  hostname = "var.hostname"
  token    = "var.api_token"
}

Provider Executable

The provider executable can be found here: https://github.com/Scalr/terraform-provider-scalr/releases

The provider executable should be placed within the plugins folder of your workspace, for example:

/my_workspace/terraform.d/plugins/darwin_amd64/terraform-provider-scalr

Example

Here is a basic example of creating a workspace with the provider:

provider "scalr" {
  hostname = var.hostname
  token    = var.api_token
}

resource "scalr_workspace" "test" {
  name         = "my-workspace-name"
  organization = "your_org_id"
  auto_apply = "true"
  terraform_version = "0.12.19"
  #vcs_repo only needed if you want to link to a repo
   vcs_repo {
      identifier = "repo_org/repo_name"
      oauth_token_id = "the_vcs_id"
      }
  }

Please see the full details for all of the resources in the list below.