Azure Pipelines
Integrating Resourcely with Azure Pipeline and GitHub as the Version Control System (VCS).
You can integrate Resourcely with Azure Pipelines to automatically evaluate your Terraform plans and policies on every pull request. This integration allows Resourcely to provide feedback directly within your pull/merge requests in GitHub or GitLab. The following guide will help you set up Resourcely with Azure Pipelines.
Prerequisites
Before integrating Resourcely with Azure Pipelines, ensure that the following prerequisites are met:
Azure Pipelines Project: You have an existing Azure Pipelines project configured.
Pipelines Egress Access: Your build agents have internet access to download the Resourcely CLI and communicate with Resourcely's API.
Docker Availability: Your build agents can run Docker containers. If not, you can pull the Resourcely CLI Binaries directly (see CLI Artifacts).
Storing the Resourcely API Token
The Resourcely CLI requires access to a Resourcely API token at build time to report findings from your Terraform plans. You can securely store this token in Azure Pipelines using variable groups.
Generate an API token from Resourcely:
Navigate to Your Project:
Go to your Azure DevOps project.
Select Pipelines > Library.
Create a Variable Group:
Click on + Variable Group.
Name the variable group (e.g.,
Resourcely
).
Add the API Token:
Click Add to create a new variable.
Name:
RESOURCELY_API_TOKEN
.Value: Paste your Resourcely API token.
Keep this value secret: Check this option to store the token securely.
Click OK and then Save the variable group.
Add Pipeline Permission after generating the variable.
Select Pipelines > Library.
Select the variable group you want to authorize.
select the Pipeline permissions tab.
select + and then select a pipeline to authorize
Granting Access to the Resourcely API Token
Ensure that your pipeline has access to the variable group containing the Resourcely API token.
Link Variable Group to Pipeline:
In your pipeline YAML file (
azure-pipelines.yml
), reference the variable group:
Adding the Resourcely Command
You'll need to update your pipeline to include steps that:
Run
terraform plan
and convert the plan to JSON.Run the Resourcely CLI to evaluate the plan.
Here's an example of how to modify your azure-pipelines.yml
file:
Confirm your VCS is evaluating guardrails successfully
If you have questions, please email us at support@resourcely.io or contact us.
Last updated