2015-02-03 10:43:18 +01:00
|
|
|
package terraform
|
|
|
|
|
2016-05-19 19:46:51 +02:00
|
|
|
import "github.com/hashicorp/terraform/config"
|
2015-02-03 10:43:18 +01:00
|
|
|
|
|
|
|
// EvalInterpolate is an EvalNode implementation that takes a raw
|
|
|
|
// configuration and interpolates it.
|
|
|
|
type EvalInterpolate struct {
|
2015-02-06 02:09:57 +01:00
|
|
|
Config *config.RawConfig
|
|
|
|
Resource *Resource
|
2015-02-14 07:58:41 +01:00
|
|
|
Output **ResourceConfig
|
2015-02-03 10:43:18 +01:00
|
|
|
}
|
|
|
|
|
2015-02-14 07:58:41 +01:00
|
|
|
func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) {
|
|
|
|
rc, err := ctx.Interpolate(n.Config, n.Resource)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2015-02-03 10:43:18 +01:00
|
|
|
|
2015-02-14 07:58:41 +01:00
|
|
|
if n.Output != nil {
|
|
|
|
*n.Output = rc
|
|
|
|
}
|
2015-02-03 10:43:18 +01:00
|
|
|
|
2015-02-14 07:58:41 +01:00
|
|
|
return nil, nil
|
2015-02-03 10:43:18 +01:00
|
|
|
}
|