Files
opentf/internal/refactoring/testdata/move-statement-implied/move-statement-implied.tf
Martin Atkins ef5a1c9cfe refactoring: ImpliedMoveStatements function
This new function complements the existing function FindMoveStatements
by potentially generating additional "implied" move statements that aren't
written explicit in the configuration but that we'll infer by comparing
the configuration and te previous run state.

The goal here is to infer only enough to replicate the effect of the
"count boundary fixup" graph node (terraform.NodeCountBoundary) that we
currently use to deal with this concern of preserving the zero-instance
when switching between "count" and not "count".

This is just dead code for now. A subsequent commit will introduce this
into the "terraform" package while also removing
terraform.NodeCountBoundary, thus achieving the same effect as before but
in a way that'll get reported in the UI as a move, using the same language
that we'd use for an explicit move statement.
2021-09-20 09:06:22 -07:00

47 lines
882 B
HCL

# This fixture is useful only in conjunction with a previous run state that
# conforms to the statements encoded in the resource names. It's for
# TestImpliedMoveStatements only.
terraform {
experiments = [config_driven_move]
}
resource "foo" "formerly_count" {
# but not count anymore
}
resource "foo" "now_count" {
count = 2
}
resource "foo" "new_no_count" {
}
resource "foo" "new_count" {
count = 2
}
resource "foo" "formerly_count_explicit" {
# but not count anymore
}
moved {
from = foo.formerly_count_explicit[1]
to = foo.formerly_count_explicit
}
resource "foo" "now_count_explicit" {
count = 2
}
moved {
from = foo.now_count_explicit
to = foo.now_count_explicit[1]
}
resource "foo" "ambiguous" {
# this one doesn't have count in the config, but the test should
# set it up to have both no-key and zero-key instances in the
# state.
}