Skip to content

Commit

Permalink
Merge pull request #535 from prupe/download-dir-env
Browse files Browse the repository at this point in the history
Configure terragrunt-download-dir via environment variable
  • Loading branch information
brikis98 authored Aug 8, 2018
2 parents c9fc53e + 0adf5ed commit 916bdfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1763,8 +1763,8 @@ start with the prefix `--terragrunt-`. The currently available options are:
subfolders of the `terragrunt-working-dir`, running `terraform` in the root of each module it finds.
* `--terragrunt-download-dir`: The path where to download Terraform code when using [remote Terraform
configurations](#keep-your-terraform-code-dry). Default is `.terragrunt-cache` in the working directory. We recommend
adding this folder to your `.gitignore`.
configurations](#keep-your-terraform-code-dry). May also be specified via the `TERRAGRUNT_DOWNLOAD` environment
variable. Default is `.terragrunt-cache` in the working directory. We recommend adding this folder to your `.gitignore`.
* `--terragrunt-source`: Download Terraform configurations from the specified source into a temporary folder, and run
Terraform in that temporary folder. May also be specified via the `TERRAGRUNT_SOURCE` environment variable. The
Expand Down Expand Up @@ -1858,6 +1858,9 @@ delete all of them as follows:
find . -type d -name ".terragrunt-cache" -prune -exec rm -rf {} \;
```
Also consider setting the `TERRAGRUNT_DOWNLOAD` environment variable if you wish to place the cache directories
somewhere else.
Expand Down
5 changes: 4 additions & 1 deletion cli/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ func parseTerragruntOptionsFromArgs(args []string, writer, errWriter io.Writer)
return nil, err
}

downloadDirRaw, err := parseStringArg(args, OPT_DOWNLOAD_DIR, util.JoinPath(workingDir, options.TerragruntCacheDir))
downloadDirRaw, err := parseStringArg(args, OPT_DOWNLOAD_DIR, os.Getenv("TERRAGRUNT_DOWNLOAD"))
if err != nil {
return nil, err
}
if downloadDirRaw == "" {
downloadDirRaw = util.JoinPath(workingDir, options.TerragruntCacheDir)
}
downloadDir, err := filepath.Abs(downloadDirRaw)
if err != nil {
return nil, errors.WithStackTrace(err)
Expand Down

0 comments on commit 916bdfc

Please sign in to comment.