Update plannedNewVal itself
Using markedPlannedNewVal caused many test failures with ignoreChanges, and I noted plannedNewVal itself is modified in the eval_diff. plannedNewVal is now marked closer to the change where it needs it. There is also a test fixture update to remove interpolation warnings.
This commit is contained in:
parent
b03d5df9dc
commit
712f5a5cc3
|
@ -247,13 +247,6 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
|
|||
}
|
||||
|
||||
plannedNewVal := resp.PlannedState
|
||||
|
||||
// Add the marks back to the planned new value
|
||||
markedPlannedNewVal := plannedNewVal
|
||||
if configVal.ContainsMarked() {
|
||||
markedPlannedNewVal = plannedNewVal.MarkWithPaths(unmarkedPaths)
|
||||
}
|
||||
|
||||
plannedPrivate := resp.PlannedPrivate
|
||||
|
||||
if plannedNewVal == cty.NilVal {
|
||||
|
@ -480,6 +473,11 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// Add the marks back to the planned new value
|
||||
if configVal.ContainsMarked() {
|
||||
plannedNewVal = plannedNewVal.MarkWithPaths(unmarkedPaths)
|
||||
}
|
||||
|
||||
// Call post-refresh hook
|
||||
if !n.Stub {
|
||||
err := ctx.Hook(func(h Hook) (HookAction, error) {
|
||||
|
@ -499,10 +497,10 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
|
|||
Change: plans.Change{
|
||||
Action: action,
|
||||
Before: priorVal,
|
||||
// Pass the marked value through in our change
|
||||
// Pass the marked planned value through in our change
|
||||
// to propogate through evaluation.
|
||||
// Marks will be removed when encoding.
|
||||
After: markedPlannedNewVal,
|
||||
After: plannedNewVal,
|
||||
},
|
||||
RequiredReplace: reqRep,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
variable "foo" {}
|
||||
|
||||
resource "aws_instance" "foo" {
|
||||
ami = "${var.foo}"
|
||||
ami = var.foo
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = ["ami"]
|
||||
ignore_changes = [ami]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue