Skip to content

Commit

Permalink
Change Uniqueness to UniquenessCriteria
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Duchesne committed Nov 26, 2019
1 parent 364da41 commit b14dd25
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions cli/cli_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ func runTerragrunt(terragruntOptions *options.TerragruntOptions) (finalStatus er
return false
}

if conf.Uniqueness != nil {
if conf.UniquenessCriteria != nil {
// If uniqueness_criteria has been defined, we set it in the options to ensure that
// we use distinct folder based on this criteria
terragruntOptions.Uniqueness = *conf.Uniqueness
terragruntOptions.UniquenessCriteria = *conf.UniquenessCriteria
}

// Copy the deployment files to the working directory
Expand Down
2 changes: 1 addition & 1 deletion cli/download_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func processTerraformSource(source string, terragruntOptions *options.Terragrunt

// We add the uniqueness factor to the folder name to ensure that distinct environment are processed in
// distinct directory
encodedWorkingDir := util.EncodeBase64Sha1(canonicalWorkingDir + terragruntOptions.Uniqueness)
encodedWorkingDir := util.EncodeBase64Sha1(canonicalWorkingDir + terragruntOptions.UniquenessCriteria)
downloadDir := util.JoinPath(terragruntOptions.DownloadDir, encodedWorkingDir, rootPath)
workingDir := util.JoinPath(downloadDir, modulePath)
versionFile := util.JoinPath(downloadDir, ".terragrunt-source-version")
Expand Down
32 changes: 16 additions & 16 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ const (

// TerragruntConfig represents a parsed and expanded configuration
type TerragruntConfig struct {
Description string `hcl:"description"`
RunConditions RunConditions `hcl:"run_conditions"`
Terraform *TerraformConfig `hcl:"terraform"`
RemoteState *remote.State `hcl:"remote_state"`
Dependencies *ModuleDependencies `hcl:"dependencies"`
Uniqueness *string `hcl:"uniqueness_criteria"`
AssumeRole interface{} `hcl:"assume_role"`
ExtraArgs TerraformExtraArgumentsList `hcl:"extra_arguments"`
PreHooks HookList `hcl:"pre_hook"`
PostHooks HookList `hcl:"post_hook"`
ExtraCommands ExtraCommandList `hcl:"extra_command"`
ImportFiles ImportFilesList `hcl:"import_files"`
ApprovalConfig ApprovalConfigList `hcl:"approval_config"`
ImportVariables ImportVariablesList `hcl:"import_variables"`
Description string `hcl:"description"`
RunConditions RunConditions `hcl:"run_conditions"`
Terraform *TerraformConfig `hcl:"terraform"`
RemoteState *remote.State `hcl:"remote_state"`
Dependencies *ModuleDependencies `hcl:"dependencies"`
UniquenessCriteria *string `hcl:"uniqueness_criteria"`
AssumeRole interface{} `hcl:"assume_role"`
ExtraArgs TerraformExtraArgumentsList `hcl:"extra_arguments"`
PreHooks HookList `hcl:"pre_hook"`
PostHooks HookList `hcl:"post_hook"`
ExtraCommands ExtraCommandList `hcl:"extra_command"`
ImportFiles ImportFilesList `hcl:"import_files"`
ApprovalConfig ApprovalConfigList `hcl:"approval_config"`
ImportVariables ImportVariablesList `hcl:"import_variables"`

options *options.TerragruntOptions
variablesSet []hcl.Dictionary
Expand Down Expand Up @@ -539,8 +539,8 @@ func (conf *TerragruntConfig) mergeIncludedConfig(includedConfig TerragruntConfi
conf.Dependencies.Paths = append(conf.Dependencies.Paths, includedConfig.Dependencies.Paths...)
}

if conf.Uniqueness == nil {
conf.Uniqueness = includedConfig.Uniqueness
if conf.UniquenessCriteria == nil {
conf.UniquenessCriteria = includedConfig.UniquenessCriteria
}

if conf.AssumeRole == nil {
Expand Down
2 changes: 1 addition & 1 deletion config/config_substitute.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// SubstituteAllVariables replace all remaining variables by the value
func (conf *TerragruntConfig) SubstituteAllVariables() {
conf.substitute(conf.Uniqueness)
conf.substitute(conf.UniquenessCriteria)

if roles, ok := conf.AssumeRole.([]string); ok {
for i := range roles {
Expand Down
2 changes: 1 addition & 1 deletion configstack/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func assertConfigsEqual(t *testing.T, expected config.TerragruntConfig, actual c
assert.Equal(t, expected.PreHooks, actual.PreHooks, messageAndArgs...)
assert.Equal(t, expected.RemoteState, actual.RemoteState, messageAndArgs...)
assert.Equal(t, expected.Terraform, actual.Terraform, messageAndArgs...)
assert.Equal(t, expected.Uniqueness, actual.Uniqueness, messageAndArgs...)
assert.Equal(t, expected.UniquenessCriteria, actual.UniquenessCriteria, messageAndArgs...)
}

// Return the absolute path for the given path
Expand Down
2 changes: 1 addition & 1 deletion options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type TerragruntOptions struct {
// If set in terragrunt configuration, this string is added to the directory name before calculating the hashing
// This allow differentiation based on certain attribute to ensure that different config (env, region) are executed
// in distinct folder
Uniqueness string
UniquenessCriteria string

// If set, this indicate that remaining interpolation are not considered as an error during the configuration
// resolving process. This allows further resolution of variables that are not initially defined.
Expand Down

0 comments on commit b14dd25

Please sign in to comment.