Scalr
Scalr
March 10, 2022

Using A Custom Terraform Provider In Scalr

By
Ryan Fee

To use a custom provider in Scalr, there are just a few simple steps to make this work.

Prerequisites

  • The provider must have a linux_amd64 binary as that is the container type in Scalr
  • The provider must have executable permissions

How to add the provider

To use it in Scalr, the provider needs to be installed in a sub-folder of the Terraform workspace so that it will be uploaded to the remote workspace at the time of a run.
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 the local directory/folder where the Terraform configuration is held.

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-name_1.0.0_linux_amd64.tar.gz
  3. Copy terraform-provider-scalr to {workspace}/terraform.d/plugins/terraform-provider-name
  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 pull request automation, the plugin will be automatically uploaded to the workspace.

Note: While this blog references Terraform, everything mentioned in here also applies to OpenTofu. New to OpenTofu? It is a fork of Terraform 1.5.7 as a result of the license change from MPL to BUSL by HashiCorp. OpenTofu is an open-source alternative to Terraform that is governed by the Linux Foundation. All features available in Terraform 1.5.7 or earlier are also available in OpenTofu. Find out the history of OpenTofu here.

Start using the Terraform platform of the future.

A screenshot of the modules page in the Scalr Platform