mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-24 20:01:06 -05:00
Our previous rule for implicitly moving from IntKey(0) to NoKey would apply that move even when the current resource configuration uses for_each, because we were only considering whether "count" were set. Previously this was relatively harmless because the resource instance in question would end up planned for deletion anyway: neither an IntKey nor a NoKey are valid keys for for_each. Now that we're going to be announcing these moves explicitly in the UI, it would be confusing to see Terraform report that IntKey moved to NoKey in a situation where the config changed from count to for_each, so to address that we'll only generate the implied statement if neither repetition argument is set.
55 lines
1.0 KiB
HCL
55 lines
1.0 KiB
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" "now_for_each_formerly_count" {
|
|
for_each = { a = 1 }
|
|
}
|
|
|
|
resource "foo" "now_for_each_formerly_no_count" {
|
|
for_each = { a = 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.
|
|
}
|