command: backendConfig must mutate its copy, not the original
Here we were going to the trouble of copying the body so we could mutate it, but then ended up mutating the original anyway and then returning the unmodified copy. Whoops! This fix is verified by a number of "init" command tests that exercise the -backend-config option, including TestInit_backendConfigFile and several others whose names have the prefix TestInit_backendConfig .
This commit is contained in:
parent
f001cb8654
commit
b5547f00f6
|
@ -329,7 +329,7 @@ func (m *Meta) backendConfig(opts *BackendOpts) (*configs.Backend, int, tfdiags.
|
||||||
// We'll shallow-copy configs.Backend here so that we can replace the
|
// We'll shallow-copy configs.Backend here so that we can replace the
|
||||||
// body without affecting others that hold this reference.
|
// body without affecting others that hold this reference.
|
||||||
configCopy := *c
|
configCopy := *c
|
||||||
c.Config = configBody
|
configCopy.Config = configBody
|
||||||
return &configCopy, configHash, diags
|
return &configCopy, configHash, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue