|
|
|
|
@ -17,6 +17,7 @@ type hclConfigurable struct {
|
|
|
|
|
|
|
|
|
|
func (t *hclConfigurable) Config() (*Config, error) {
|
|
|
|
|
validKeys := map[string]struct{}{
|
|
|
|
|
"atlas": struct{}{},
|
|
|
|
|
"module": struct{}{},
|
|
|
|
|
"output": struct{}{},
|
|
|
|
|
"provider": struct{}{},
|
|
|
|
|
@ -70,6 +71,15 @@ func (t *hclConfigurable) Config() (*Config, error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get Atlas configuration
|
|
|
|
|
if atlas := t.Object.Get("atlas", false); atlas != nil {
|
|
|
|
|
var err error
|
|
|
|
|
config.Atlas, err = loadAtlasHcl(atlas)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Build the modules
|
|
|
|
|
if modules := t.Object.Get("module", false); modules != nil {
|
|
|
|
|
var err error
|
|
|
|
|
@ -187,6 +197,19 @@ func loadFileHcl(root string) (configurable, []string, error) {
|
|
|
|
|
return result, nil, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Given a handle to a HCL object, this transforms it into the Atlas
|
|
|
|
|
// configuration.
|
|
|
|
|
func loadAtlasHcl(obj *hclobj.Object) (*AtlasConfig, error) {
|
|
|
|
|
var config AtlasConfig
|
|
|
|
|
if err := hcl.DecodeObject(&config, obj); err != nil {
|
|
|
|
|
return nil, fmt.Errorf(
|
|
|
|
|
"Error reading atlas config: %s",
|
|
|
|
|
err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &config, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Given a handle to a HCL object, this recurses into the structure
|
|
|
|
|
// and pulls out a list of modules.
|
|
|
|
|
//
|
|
|
|
|
|