mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 17:01:04 -06:00
14cea95e86
This set of changes addresses two bug scenarios: (1) When an ignored change canceled a resource replacement, any downstream resources referencing computer attributes on that resource would get "diffs didn't match" errors. This happened because the `EvalDiff` implementation was calling `state.MergeDiff(diff)` on the unfiltered diff. Generally this is what you want, so that downstream references catch the "incoming" values. When there's a potential for the diff to change, thought, this results in problems w/ references. Here we solve this by doing away with the separate `EvalNode` for `ignore_changes` processing and integrating it into `EvalDiff`. This allows us to only call `MergeDiff` with the final, filtered diff. (2) When a resource had an ignored change but was still being replaced anyways, the diff was being improperly filtered. This would cause problems during apply when not all attributes were available to perform the replacement. We solve that by deferring actual attribute removal until after we've decided that we do not have to replace the resource.
13 lines
239 B
HCL
13 lines
239 B
HCL
resource "aws_instance" "foo" {
|
|
count = 2
|
|
ami = "ami-bcd456"
|
|
lifecycle {
|
|
ignore_changes = ["ami"]
|
|
}
|
|
}
|
|
|
|
resource "aws_eip" "foo" {
|
|
count = 2
|
|
instance = "${element(aws_instance.foo.*.id, count.index)}"
|
|
}
|