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.
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
Create the workspace
Set the variables (if necessary)
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.
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.
If the local workspace contains any
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.
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.
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.
Here is an example of a run viewed in Scalr