diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go b/vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go index 6825ff5..6a78a6b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go +++ b/vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go | |||
@@ -1,18 +1,50 @@ | |||
1 | package terraform | 1 | package terraform |
2 | 2 | ||
3 | import "github.com/hashicorp/terraform/config" | 3 | import ( |
4 | "log" | ||
5 | |||
6 | "github.com/hashicorp/terraform/config" | ||
7 | ) | ||
4 | 8 | ||
5 | // EvalInterpolate is an EvalNode implementation that takes a raw | 9 | // EvalInterpolate is an EvalNode implementation that takes a raw |
6 | // configuration and interpolates it. | 10 | // configuration and interpolates it. |
7 | type EvalInterpolate struct { | 11 | type EvalInterpolate struct { |
8 | Config *config.RawConfig | 12 | Config *config.RawConfig |
9 | Resource *Resource | 13 | Resource *Resource |
10 | Output **ResourceConfig | 14 | Output **ResourceConfig |
15 | ContinueOnErr bool | ||
11 | } | 16 | } |
12 | 17 | ||
13 | func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) { | 18 | func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) { |
14 | rc, err := ctx.Interpolate(n.Config, n.Resource) | 19 | rc, err := ctx.Interpolate(n.Config, n.Resource) |
15 | if err != nil { | 20 | if err != nil { |
21 | if n.ContinueOnErr { | ||
22 | log.Printf("[WARN] Interpolation %q failed: %s", n.Config.Key, err) | ||
23 | return nil, EvalEarlyExitError{} | ||
24 | } | ||
25 | return nil, err | ||
26 | } | ||
27 | |||
28 | if n.Output != nil { | ||
29 | *n.Output = rc | ||
30 | } | ||
31 | |||
32 | return nil, nil | ||
33 | } | ||
34 | |||
35 | // EvalInterpolateProvider is an EvalNode implementation that takes a | ||
36 | // ProviderConfig and interpolates it. Provider configurations are the only | ||
37 | // "inherited" type of configuration we have, and the original raw config may | ||
38 | // have a different interpolation scope. | ||
39 | type EvalInterpolateProvider struct { | ||
40 | Config *config.ProviderConfig | ||
41 | Resource *Resource | ||
42 | Output **ResourceConfig | ||
43 | } | ||
44 | |||
45 | func (n *EvalInterpolateProvider) Eval(ctx EvalContext) (interface{}, error) { | ||
46 | rc, err := ctx.InterpolateProvider(n.Config, n.Resource) | ||
47 | if err != nil { | ||
16 | return nil, err | 48 | return nil, err |
17 | } | 49 | } |
18 | 50 | ||