Commit Graph

5 Commits

Author SHA1 Message Date
Paul Hinze 385b17d679 provider/template: don't error when rendering fails in Exists
The Exists function can run in a context where the contents of the
template have changed, but it uses the old set of variables from the
state. This means that when the set of variables changes, rendering will
fail in Exists. This was returning an error, but really it just needs to
be treated as a scenario where the template needs re-rendering.

fixes #2344 and possibly a few other template issues floating around
2015-06-17 15:33:07 -05:00
Paul Hinze 06eb388c3f provider/template: store relative path in state
This makes template_file usage in modules portable.
2015-05-21 15:03:03 -05:00
Paul Hinze a96a3372c6 provider/template: don't diff when there's no diff
This reworks the template lifecycle a bit such that we get nicer diff
behavior.

First, we tick ForceNew on for both filename and vars, so that the diff
indicates that the template will be "replaced" on change. This is mostly
cosmetic, but it also tracks conceptually with the fact that the
identifier we use is a hash of the contents, so any change essentially
makes a "new resource".

Second, we change the Exists implementation to only return `false` when
there has been a change in the rendered template. This lets descendent
resources see the computed value changing so that they'll properly
trigger in the plan.

Fixes #1898
Refs #1866 (but does not fix, there's another deeper issue there)
2015-05-11 10:38:19 -05:00
Josh Bleecher Snyder 76bcac3031 providers/template: add tests, address review comments
Do directory expansion on filenames.

Add basic acceptance tests. Code coverage is 72.5%.
Uncovered code is uninteresting and/or impossible error cases.

Note that this required adding a knob to
helper/resource.TestStep to allow transient
resources.
2015-05-04 10:26:17 -07:00
Josh Bleecher Snyder 745d83a995 providers: add template provider
Fixes #215.
2015-05-01 16:59:49 -07:00