update provisioners for multiple processes
The "internal" provisioners are still run in a separate process, and need to be updated to restart on each walk.
This commit is contained in:
parent
a14fe7ae0c
commit
52c0032aed
|
@ -326,12 +326,7 @@ func (m *Meta) provisionerFactories() map[string]terraform.ProvisionerFactory {
|
||||||
// Wire up the internal provisioners first. These might be overridden
|
// Wire up the internal provisioners first. These might be overridden
|
||||||
// by discovered provisioners below.
|
// by discovered provisioners below.
|
||||||
for name := range InternalProvisioners {
|
for name := range InternalProvisioners {
|
||||||
client, err := internalPluginClient("provisioner", name)
|
factories[name] = internalProvisionerFactory(discovery.PluginMeta{Name: name})
|
||||||
if err != nil {
|
|
||||||
log.Printf("[WARN] failed to build command line for internal plugin %q: %s", name, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
factories[name] = internalProvisionerFactory(client)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byName := plugins.ByName()
|
byName := plugins.ByName()
|
||||||
|
@ -397,8 +392,12 @@ func provisionerFactory(meta discovery.PluginMeta) terraform.ProvisionerFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func internalProvisionerFactory(client *plugin.Client) terraform.ProvisionerFactory {
|
func internalProvisionerFactory(meta discovery.PluginMeta) terraform.ProvisionerFactory {
|
||||||
return func() (provisioners.Interface, error) {
|
return func() (provisioners.Interface, error) {
|
||||||
|
client, err := internalPluginClient("provisioner", meta.Name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("[WARN] failed to build command line for internal plugin %q: %s", meta.Name, err)
|
||||||
|
}
|
||||||
return newProvisionerClient(client)
|
return newProvisionerClient(client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,7 @@ func (s *GRPCProvisionerServer) ProvisionResource(req *proto.ProvisionResource_R
|
||||||
Ephemeral: terraform.EphemeralState{
|
Ephemeral: terraform.EphemeralState{
|
||||||
ConnInfo: conn,
|
ConnInfo: conn,
|
||||||
},
|
},
|
||||||
|
Meta: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.provisioner.Apply(uiOutput{srv}, instanceState, resourceConfig)
|
err = s.provisioner.Apply(uiOutput{srv}, instanceState, resourceConfig)
|
||||||
|
|
|
@ -64,6 +64,7 @@ func (p *GRPCProvisioner) GetSchema() (resp provisioners.GetSchemaResponse) {
|
||||||
resp.Diagnostics = resp.Diagnostics.Append(err)
|
resp.Diagnostics = resp.Diagnostics.Append(err)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics))
|
||||||
|
|
||||||
if protoResp.Provisioner == nil {
|
if protoResp.Provisioner == nil {
|
||||||
resp.Diagnostics = resp.Diagnostics.Append(errors.New("missing provisioner schema"))
|
resp.Diagnostics = resp.Diagnostics.Append(errors.New("missing provisioner schema"))
|
||||||
|
|
Loading…
Reference in New Issue