terragrunt.star¶
Move Terragrunt and Terraform module sources to a new ?ref= tag.
Edits are line-based, so comments and alignment stay as they were.
| Function | What it does |
|---|---|
sources |
Lists every module source pinned with ?ref=. |
set_source_ref |
Sets the ?ref= of every module source that matches. |
sources¶
Lists every module source pinned with ?ref=.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: A list of dicts with path, source and ref, in file order.
Example
[s["source"] + " " + s["ref"] for s in sources(repo)]
# returns ["git::https://github.com/acme/modules.git//vpc v1.2.0"]
Used in: terragrunt-module-ref
set_source_ref¶
Sets the ?ref= of every module source that matches.
Covers source in terragrunt.hcl terraform blocks and in Terraform
module blocks. Sources pinned to a commit SHA are left alone.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
source |
The source before ?ref=; * matches any run of characters, so git::https://github.com/acme/modules.git//* covers every module in that repository. |
ref |
The new tag or branch. |
Returns: The list of paths that changed.
Example
set_source_ref(repo, "git::https://github.com/acme/modules.git//*", "v1.3.0")
# returns ["live/prod/vpc/terragrunt.hcl", "main.tf"]
live/prod/vpc/terragrunt.hcl
main.tf
Used in: terragrunt-module-ref