2015-02-05 16:32:36 -06:00
|
|
|
package terraform
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/terraform/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ProviderEvalTree returns the evaluation tree for initializing and
|
|
|
|
// configuring providers.
|
|
|
|
func ProviderEvalTree(n string, config *config.RawConfig) EvalNode {
|
2015-02-13 19:59:54 -06:00
|
|
|
seq := make([]EvalNode, 0, 5)
|
|
|
|
seq = append(seq, &EvalInitProvider{Name: n})
|
|
|
|
|
|
|
|
// Input stuff
|
|
|
|
var provider ResourceProvider
|
|
|
|
seq = append(seq, &EvalOpFilter{
|
|
|
|
Ops: []walkOperation{walkInput},
|
|
|
|
Node: &EvalSequence{
|
|
|
|
Nodes: []EvalNode{
|
|
|
|
&EvalGetProvider{
|
|
|
|
Name: n,
|
|
|
|
Output: &provider,
|
|
|
|
},
|
|
|
|
&EvalInputProvider{
|
|
|
|
Name: n,
|
|
|
|
Provider: &provider,
|
|
|
|
Config: config,
|
|
|
|
},
|
2015-02-05 16:32:36 -06:00
|
|
|
},
|
2015-02-13 19:59:54 -06:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
// Apply stuff
|
|
|
|
seq = append(seq, &EvalOpFilter{
|
|
|
|
Ops: []walkOperation{walkValidate, walkRefresh, walkPlan, walkApply},
|
|
|
|
Node: &EvalSequence{
|
|
|
|
Nodes: []EvalNode{
|
|
|
|
&EvalValidateProvider{
|
|
|
|
ProviderName: n,
|
|
|
|
Provider: &EvalGetProvider{Name: n},
|
|
|
|
Config: &EvalInterpolate{Config: config},
|
|
|
|
},
|
|
|
|
&EvalConfigProvider{
|
|
|
|
Provider: n,
|
|
|
|
Config: &EvalInterpolate{Config: config},
|
|
|
|
},
|
2015-02-05 16:32:36 -06:00
|
|
|
},
|
|
|
|
},
|
2015-02-13 19:59:54 -06:00
|
|
|
})
|
|
|
|
|
|
|
|
return &EvalSequence{Nodes: seq}
|
2015-02-05 16:32:36 -06:00
|
|
|
}
|