Terraform or Terragrunt modules from another repository in Azure DevOps

Terraform or Terragrunt modules from another repository in Azure DevOps

Azure DevOps (AZDO) is pretty tool, but sometimes it can be a huge pain in the ass. One painful topic is git operations. I use Terraform and Terragrunt very often to manage multiple environments so using modules is a must. To achieve stability, I am maintaining modules in separate repository with git tags.

Loading external modules is same for Terraform and for Terragrunt, it uses same syntax and same commands under the hood.

I am executing Terraform/Terragrunt within CICD pipelines, which brings a lot of advantages when you are working in a team.

To load Terraform/Terragrunt modules from external repository within AZDO organisation, I was even able to load moduels from different project. You need to setup couple things:

1. Module source syntax

Note the double slash (//) syntax – described here.

2. Pipeline

Within the pipeline, you need to place following task which somehow enables git operations so repository could be checkout fine. See Use predefined variables article in Microsoft docs to learn about used variables.

3. Permissions

This is still a little bit unknown to me, AZDO permissions model is not great so I keep this open and maybe add some info later.

Organization Settings/Pipelines/Settings
Switch off Limit job authorization scope to current project for non-release pipelines
Switch off Limit job authorization scope to current project for release pipelines
Switch off Limit job authorization scope to referenced Azure DevOps repositories

4. Errors

Know errors which can be solved by following steps above ↑

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments