Skip to content

Commit

Permalink
Fix CLI docs. Fix find_in_parent_folders bug with relative paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
brikis98 committed Dec 9, 2016
1 parent b112675 commit 0b44d4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
20 changes: 11 additions & 9 deletions cli/cli_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var MULTI_MODULE_COMMANDS = []string{CMD_SPIN_UP, CMD_TEAR_DOWN}
// Since Terragrunt is just a thin wrapper for Terraform, and we don't want to repeat every single Terraform command
// in its definition, we don't quite fit into the model of any Go CLI library. Fortunately, urfave/cli allows us to
// override the whole template used for the Usage Text.
var CUSTOM_USAGE_TEXT = fmt.Sprintf(`DESCRIPTION:
var CUSTOM_USAGE_TEXT = `DESCRIPTION:
{{.Name}} - {{.UsageText}}
USAGE:
Expand All @@ -42,22 +42,24 @@ COMMANDS:
import Acquire a lock and run 'terraform import'
refresh Acquire a lock and run 'terraform refresh'
remote push Acquire a lock and run 'terraform remote push'
%s Acquire a long-term lock for these templates
%s Release a long-term lock or a lock that failed to clean up
%s Spin up a 'stack' by running 'terragrunt apply' in each subfolder
%s Tear down a 'stack' by running 'terragrunt destroy' in each subfolder
acquire-lock Acquire a long-term lock for these templates
release-lock Release a long-term lock or a lock that failed to clean up
spin-up Spin up a 'stack' by running 'terragrunt apply' in each subfolder
tear-down Tear down a 'stack' by running 'terragrunt destroy' in each subfolder
* Terragrunt forwards all other commands directly to Terraform
{{if .VisibleFlags}}
GLOBAL OPTIONS:
{{range .VisibleFlags}}{{.}}
{{end}}{{end}}
terragrunt-config Path to the Terragrunt config file. Default is .terragrunt.
terragrunt-non-interactive Assume "yes" for all prompts.
terragrunt-working-dir The path to the Terraform templates. Default is current directory.
VERSION:
{{.Version}}{{if len .Authors}}
AUTHOR(S):
{{range .Authors}}{{.}}{{end}}
{{end}}
`, CMD_ACQUIRE_LOCK, CMD_RELEASE_LOCK, CMD_SPIN_UP, CMD_TEAR_DOWN)
`

var MODULE_REGEX = regexp.MustCompile(`module ".+"`)

Expand Down
5 changes: 4 additions & 1 deletion config/config_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func executeTerragruntHelperFunction(functionName string, include *IncludeConfig

// Find a parent .terragrunt file in the parent folders above the current .terragrunt file and return its path
func findInParentFolders(terragruntOptions *options.TerragruntOptions) (string, error) {
previousDir := filepath.Dir(terragruntOptions.TerragruntConfigPath)
previousDir, err := filepath.Abs(filepath.Dir(terragruntOptions.TerragruntConfigPath))
if err != nil {
return "", errors.WithStackTrace(err)
}

// To avoid getting into an accidental infinite loop (e.g. do to cyclical symlinks), set a max on the number of
// parent folders we'll check
Expand Down

0 comments on commit 0b44d4e

Please sign in to comment.