mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Remove the Input flag threaded through the input graph creation process to prevent interpolation failures on module variables. Use an EvalOpFilter instead to inset the correct EvalNode during walkInput. Remove the EvalTryInterpolate type, and use the same ContinueOnErr flag as the output node for consistency and to try and keep the number possible eval node types down.
34 lines
683 B
Go
34 lines
683 B
Go
package terraform
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/hashicorp/terraform/config"
|
|
)
|
|
|
|
// EvalInterpolate is an EvalNode implementation that takes a raw
|
|
// configuration and interpolates it.
|
|
type EvalInterpolate struct {
|
|
Config *config.RawConfig
|
|
Resource *Resource
|
|
Output **ResourceConfig
|
|
ContinueOnErr bool
|
|
}
|
|
|
|
func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) {
|
|
rc, err := ctx.Interpolate(n.Config, n.Resource)
|
|
if err != nil {
|
|
if n.ContinueOnErr {
|
|
log.Printf("[WARN] Interpolation %q failed: %s", n.Config.Key, err)
|
|
return nil, EvalEarlyExitError{}
|
|
}
|
|
return nil, err
|
|
}
|
|
|
|
if n.Output != nil {
|
|
*n.Output = rc
|
|
}
|
|
|
|
return nil, nil
|
|
}
|