github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/terraform/eval_interpolate.go (about)

     1  package terraform
     2  
     3  import (
     4  	"github.com/hashicorp/terraform/config"
     5  )
     6  
     7  // EvalInterpolate is an EvalNode implementation that takes a raw
     8  // configuration and interpolates it.
     9  type EvalInterpolate struct {
    10  	Config   *config.RawConfig
    11  	Resource *Resource
    12  	Output   **ResourceConfig
    13  }
    14  
    15  func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) {
    16  	rc, err := ctx.Interpolate(n.Config, n.Resource)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	if n.Output != nil {
    22  		*n.Output = rc
    23  	}
    24  
    25  	return nil, nil
    26  }