mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-02 12:17:39 -06:00
78c4a8c461
Configuration-driven moves are represented in the plan file by setting the resource's `PrevRunAddr` to a different value than its `Addr`. For JSON plan output, we here add a new field to resource changes, `previous_address`, which is present and non-empty only if the resource is planned to be moved. Like the CLI UI, refresh-only plans will include move-only changes in the resource drift JSON output. In normal plan mode, these are elided to avoid redundancy with planned changes.
23 lines
623 B
HCL
23 lines
623 B
HCL
# In state with `ami = "foo"`, so this should be a regular update. The provider
|
|
# should not detect changes on refresh.
|
|
resource "test_instance" "no_refresh" {
|
|
ami = "bar"
|
|
}
|
|
|
|
# In state with `ami = "refresh-me"`, but the provider will return
|
|
# `"refreshed"` after the refresh phase. The plan should show the drift
|
|
# (`"refresh-me"` to `"refreshed"`) and plan the update (`"refreshed"` to
|
|
# `"baz"`).
|
|
resource "test_instance" "should_refresh_with_move" {
|
|
ami = "baz"
|
|
}
|
|
|
|
terraform {
|
|
experiments = [ config_driven_move ]
|
|
}
|
|
|
|
moved {
|
|
from = test_instance.should_refresh
|
|
to = test_instance.should_refresh_with_move
|
|
}
|