a provisioner may not always have a connection

This commit is contained in:
James Bardin 2018-05-21 09:46:06 -04:00 committed by Martin Atkins
parent 07042a95fa
commit cdaeed4f26
1 changed files with 31 additions and 28 deletions

View File

@ -305,7 +305,9 @@ func (n *EvalApplyProvisioners) apply(ctx EvalContext, provs []*configs.Provisio
config, _, configDiags := ctx.EvaluateBlock(prov.Config, schema, instanceAddr, instanceAddr.Key) config, _, configDiags := ctx.EvaluateBlock(prov.Config, schema, instanceAddr, instanceAddr.Key)
diags = diags.Append(configDiags) diags = diags.Append(configDiags)
connInfo, _, connInfoDiags := ctx.EvaluateBlock(prov.Config, connectionBlockSupersetSchema, instanceAddr, instanceAddr.Key) // A provisioner may not have a connection block
if prov.Connection != nil {
connInfo, _, connInfoDiags := ctx.EvaluateBlock(prov.Connection.Config, connectionBlockSupersetSchema, instanceAddr, instanceAddr.Key)
diags = diags.Append(connInfoDiags) diags = diags.Append(connInfoDiags)
if configDiags.HasErrors() || connInfoDiags.HasErrors() { if configDiags.HasErrors() || connInfoDiags.HasErrors() {
@ -338,6 +340,7 @@ func (n *EvalApplyProvisioners) apply(ctx EvalContext, provs []*configs.Provisio
overlay[k] = v overlay[k] = v
} }
state.Ephemeral.ConnInfo = overlay state.Ephemeral.ConnInfo = overlay
}
{ {
// Call pre hook // Call pre hook