ignore errors interpolating RawCount during apply

If a count field references another count field which is interpolated
but is attached to a resource already in the state, the result of that
first interpolation will be lost when a plan is serialized. This is
because the result of the first interpolation is stored directly in the
module config, in an unexported config field.

This is not a general fix for the above situation, which would require
refactoring how counts are handles throughout the config. Ignoring the
error works, because in most cases the count will be properly
handled during the resource's interpolation.
This commit is contained in:
James Bardin 2018-03-09 19:07:28 -05:00
parent f3d1fb3aff
commit a2718e4f79

View File

@ -140,7 +140,10 @@ func (n *NodeApplyableResource) evalTreeDataResource(
// Here we are just populating the interpolated value in-place
// inside this RawConfig object, like we would in
// NodeAbstractCountResource.
&EvalInterpolate{Config: n.Config.RawCount},
&EvalInterpolate{
Config: n.Config.RawCount,
ContinueOnErr: true,
},
// We need to re-interpolate the config here, rather than
// just using the diff's values directly, because we've
@ -271,7 +274,10 @@ func (n *NodeApplyableResource) evalTreeManagedResource(
// Here we are just populating the interpolated value in-place
// inside this RawConfig object, like we would in
// NodeAbstractCountResource.
&EvalInterpolate{Config: n.Config.RawCount},
&EvalInterpolate{
Config: n.Config.RawCount,
ContinueOnErr: true,
},
&EvalInterpolate{
Config: n.Config.RawConfig.Copy(),