Reputation: 133
I know that it is possible in terragrunt to add a git source reference to a specific branch as mentioned in another post.
But is it possible to set the branch based on something like a global variable?
So instead of
terraform {
source = "git::https://git.repo.modules.git//src/modules/vpc?ref=develop"
}
something like
terraform {
source = "git::https://git.repo.modules.git//src/modules/vpc?ref=${VAR_BRANCH}"
}
We develop on different branches and I don't want to change every source reference when merging things to another branch.
I also read about source mapping, but it seems to me that we also have to map every single source, or did I miss something?
Thank you very much & best regards
Upvotes: 0
Views: 1911
Reputation: 1190
Your code example should work, i.e. if your variable is local
the code snippet should look like this:
terraform {
source = "git::https://git.repo.modules.git//src/modules/vpc?ref=${locals.branch}"
}
I also read about source mapping, but it seems to me that we also have to map every single source, or did I miss something?
Yes, that is correct. Unless you want to use the master
branch.
Upvotes: 1