command: Restore support for terraform.tfvars.json
In the new implementation of collecting variables I initially forgot the JSON variant of terraform.tfvars. This fix is verified by TestApply_varFileDefaultJSON now passing.
This commit is contained in:
parent
46b4c27dbe
commit
7abf81d8da
|
@ -62,6 +62,11 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
|
|||
moreDiags := m.addVarsFromFile(DefaultVarsFilename, terraform.ValueFromFile, ret)
|
||||
diags = diags.Append(moreDiags)
|
||||
}
|
||||
const defaultVarsFilenameJSON = DefaultVarsFilename + ".json"
|
||||
if _, err := os.Stat(defaultVarsFilenameJSON); err == nil {
|
||||
moreDiags := m.addVarsFromFile(defaultVarsFilenameJSON, terraform.ValueFromFile, ret)
|
||||
diags = diags.Append(moreDiags)
|
||||
}
|
||||
if infos, err := ioutil.ReadDir("."); err == nil {
|
||||
// "infos" is already sorted by name, so we just need to filter it here.
|
||||
for _, info := range infos {
|
||||
|
|
Loading…
Reference in New Issue