Merge pull request #5772 from hashicorp/phinze/var-concurrent-map-race
terraform: share graph walker's variables lock w/ interpolater
This commit is contained in:
commit
7efc8b25a5
|
@ -86,6 +86,7 @@ func (w *ContextGraphWalker) EnterPath(path []string) EvalContext {
|
|||
State: w.Context.state,
|
||||
StateLock: &w.Context.stateLock,
|
||||
Variables: variables,
|
||||
VariablesLock: &w.interpolaterVarLock,
|
||||
},
|
||||
InterpolaterVars: w.interpolaterVars,
|
||||
InterpolaterVarLock: &w.interpolaterVarLock,
|
||||
|
|
|
@ -28,6 +28,7 @@ type Interpolater struct {
|
|||
State *State
|
||||
StateLock *sync.RWMutex
|
||||
Variables map[string]string
|
||||
VariablesLock *sync.Mutex
|
||||
}
|
||||
|
||||
// InterpolationScope is the current scope of execution. This is required
|
||||
|
@ -273,6 +274,8 @@ func (i *Interpolater) valueUserVar(
|
|||
n string,
|
||||
v *config.UserVariable,
|
||||
result map[string]ast.Variable) error {
|
||||
i.VariablesLock.Lock()
|
||||
defer i.VariablesLock.Unlock()
|
||||
val, ok := i.Variables[v.Name]
|
||||
if ok {
|
||||
result[n] = ast.Variable{
|
||||
|
|
Loading…
Reference in New Issue