Skip to content

Commit bf48d01

Browse files
committed
Checkpoint signature fixes
- Currently the disable_checkpoint setting from $HOME/.terraformrc is never respsected due to: -- The runCheckpoint go routine being fired off prior to loading configuration -- The config.Merge method not actually merging in the c2s settings
1 parent 3920460 commit bf48d01

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

‎config.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ func (c1 *Config) Merge(c2 *Config) *Config {
183183
}
184184
result.Provisioners[k] = v
185185
}
186+
result.DisableCheckpoint = c1.DisableCheckpoint || c2.DisableCheckpoint
187+
result.DisableCheckpointSignature = c1.DisableCheckpointSignature || c2.DisableCheckpointSignature
186188

187189
return &result
188190
}

‎main.go‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ func wrappedMain() int {
103103
return 1
104104
}
105105

106+
// Load the configuration file if we have one, that can be used to
107+
// define extra providers and provisioners.
108+
clicfgFile, err := cliConfigFile()
109+
if err != nil {
110+
Ui.Error(fmt.Sprintf("Error loading CLI configuration: \n\n%s", err))
111+
return 1
112+
}
113+
114+
if clicfgFile != "" {
115+
usrcfg, err := LoadConfig(clicfgFile)
116+
if err != nil {
117+
Ui.Error(fmt.Sprintf("Error loading CLI configuration: \n\n%s", err))
118+
return 1
119+
}
120+
121+
config = *config.Merge(usrcfg)
122+
}
123+
106124
// Run checkpoint
107125
go runCheckpoint(&config)
108126

@@ -129,24 +147,6 @@ func wrappedMain() int {
129147
HelpWriter: os.Stdout,
130148
}
131149

132-
// Load the configuration file if we have one, that can be used to
133-
// define extra providers and provisioners.
134-
clicfgFile, err := cliConfigFile()
135-
if err != nil {
136-
Ui.Error(fmt.Sprintf("Error loading CLI configuration: \n\n%s", err))
137-
return 1
138-
}
139-
140-
if clicfgFile != "" {
141-
usrcfg, err := LoadConfig(clicfgFile)
142-
if err != nil {
143-
Ui.Error(fmt.Sprintf("Error loading CLI configuration: \n\n%s", err))
144-
return 1
145-
}
146-
147-
config = *config.Merge(usrcfg)
148-
}
149-
150150
// Initialize the TFConfig settings for the commands...
151151
ContextOpts.Providers = config.ProviderFactories()
152152
ContextOpts.Provisioners = config.ProvisionerFactories()

0 commit comments

Comments
 (0)