configs/configupgrade: Include provisioner schemas in analysis

We'll need these to migrate any "provisioner" blocks we find in the input
configuration.
This commit is contained in:
Martin Atkins 2019-02-21 16:13:17 -08:00
parent 55cf4e95a5
commit 0095a944cd
1 changed files with 14 additions and 1 deletions

View File

@ -262,7 +262,20 @@ func (u *Upgrader) analyze(ms ModuleSources) (*analysis, error) {
ret.ProviderSchemas[name] = schema
}
// TODO: Also ProvisionerSchemas
for name, fn := range u.Provisioners {
log.Printf("[TRACE] Fetching schema from provisioner %q", name)
provisioner, err := fn()
if err != nil {
return nil, fmt.Errorf("failed to load provisioner %q: %s", name, err)
}
resp := provisioner.GetSchema()
if resp.Diagnostics.HasErrors() {
return nil, resp.Diagnostics.Err()
}
ret.ProvisionerSchemas[name] = resp.Provisioner
}
return ret, nil
}