_images/login_button.png _images/signup_button.png



VCS Integration - Deployment Pipelines

Reading time: 2-3 minutes

Scalr workspaces can be linked to Terraform configurations held in VCS repositories in order to automate Pull Request (PR) checks and deployments for deployment pipelines.

Note

A VCS Provider is required.

By linking a workspace to a specific branch of the repository a webhook is created in the VCS system that will POST to Scalr for every PR or commit/merge that affects that branch. Scalr will then automatically perform a “dry run” (terraform plan) for every PR and a full run (terraform apply) for every commit/merge.

There are 2 steps

  1. Create the workspace

  2. Set the variables (if necessary)


Create Workspace

To enable this integration create a workspace with a specific repo and branch. If a subdirectory is specified then Scalr will only create a run if files in that subdirectory are changed.

_images/new_ws_vcs.png

Set Input Variables

If the Terraform configuration contains input variables that do not have assigned values, then these must be assigned values in then Scalr workspace via the UI. Scalr will automatically create the variables.

_images/intro_ws_vars_1.png _images/ws_vars_values.png

If the local workspace contains any *.auto.tfvars or terraform.tfvars files these will provide default variable values that Terraform will automatically use.

If variables in the above tfvars files have the same names as variables specified in the workspace, the workspace’s values will be used. For map variables the values in tfvars are merged with values in the same named variable in the workspace.


Dry Runs

When a PR is made in the VCS a link to the run in Scalr is provided. Dry runs are NOT displayed in the Runs tab of the workspace.

_images/vcs_dry_1.png

Full Runs

Full runs will be visible in the Runs tab and there is the option to configure the workspace to auto-apply. With this option disabled runs will need to be approved manually in the Scalr UI.

_images/vcs_runs.png

Here is an example of a run viewed in Scalr

_images/example_run_vcs.png