diff --git a/pkg/tests/detailed_diff_set_test.go b/pkg/tests/detailed_diff_set_test.go index 53103a71c8..0221a2a69e 100644 --- a/pkg/tests/detailed_diff_set_test.go +++ b/pkg/tests/detailed_diff_set_test.go @@ -823,6 +823,24 @@ func TestDetailedDiffSetCrossTest(t *testing.T) { } blockSchemaForceNew := schema.Resource{ + Schema: map[string]*schema.Schema{ + "test": { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "nested": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + } + + blockSchemaNestedForceNew := schema.Resource{ Schema: map[string]*schema.Schema{ "test": { Type: schema.TypeSet, @@ -880,7 +898,8 @@ func TestDetailedDiffSetCrossTest(t *testing.T) { {"attribute no force new", attributeSchema, attrList}, {"attribute force new", attributeSchemaForceNew, attrList}, {"block no force new", blockSchema, nestedAttrList}, - {"block force new", blockSchemaForceNew, nestedAttrList}, + {"block top level force new", blockSchemaForceNew, nestedAttrList}, + {"block nested force new", blockSchemaNestedForceNew, nestedAttrList}, } scenarios := []struct { diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_end.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_end.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_end.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_end_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_end_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_end_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_end_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_front.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_front.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_front.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_front_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_front_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_front_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_front_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_middle.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_middle.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_middle.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_middle_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_middle_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/added_middle_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/added_middle_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_empty_to_null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_empty_to_null.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_empty_to_null.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_empty_to_null.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_non-null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_non-null.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_non-null.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_non-null.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_non-null_to_null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_non-null_to_null.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_non-null_to_null.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_non-null_to_null.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_null_to_empty.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_null_to_empty.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_null_to_empty.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_null_to_empty.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_null_to_non-null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_null_to_non-null.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/changed_null_to_non-null.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/changed_null_to_non-null.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_end.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_end.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_end.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_end_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_end_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_end_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_end_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_front.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_front.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_front.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_front_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_front_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_front_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_front_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_middle.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_middle.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_middle.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_middle_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_middle_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/removed_middle_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/removed_middle_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/same_element_updated.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/same_element_updated.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/same_element_updated.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/same_element_updated.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/same_element_updated_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/same_element_updated_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/same_element_updated_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/same_element_updated_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_added_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_added_end.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_added_end.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_added_end.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_added_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_added_front.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_added_front.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_added_front.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_added_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_added_middle.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_added_middle.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_added_middle.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_removed_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_removed_end.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_removed_end.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_removed_end.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_removed_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_removed_front.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_removed_front.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_removed_front.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_removed_middle.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_removed_middle.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_removed_middle.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_with_duplicates.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_with_duplicates.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_with_duplicates.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_with_duplicates.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_with_duplicates_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_with_duplicates_unordered.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/shuffled_with_duplicates_unordered.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/shuffled_with_duplicates_unordered.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_removed.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_removed.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/two_removed.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/two_removed.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/unchanged_empty.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/unchanged_empty.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/unchanged_empty.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/unchanged_empty.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/unchanged_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/unchanged_non-empty.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/unchanged_non-empty.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/unchanged_non-empty.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/unchanged_null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/unchanged_null.golden similarity index 100% rename from pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_force_new/unchanged_null.golden rename to pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_nested_force_new/unchanged_null.golden diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added.golden new file mode 100644 index 0000000000..10d82d99a8 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added.golden @@ -0,0 +1,39 @@ +tests.testOutput{ + initialValue: &[]string{}, + changeValue: &[]string{"value"}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "value" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + tests: [ + + [0]: { + + nested : "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_end.golden new file mode 100644 index 0000000000..3e7a815653 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_end.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + }, + changeValue: &[]string{ + "val1", + "val2", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val3" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [2]: { + + nested : "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[2]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_end_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_end_unordered.golden new file mode 100644 index 0000000000..4f1b9a49b3 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_end_unordered.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + }, + changeValue: &[]string{ + "val2", + "val3", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val1" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [2]: { + + nested : "val1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[2]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_front.golden new file mode 100644 index 0000000000..66286b3f2e --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_front.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + }, + changeValue: &[]string{ + "val1", + "val2", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val1" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [0]: { + + nested : "val1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_front_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_front_unordered.golden new file mode 100644 index 0000000000..fc91a82a26 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_front_unordered.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val3", + "val1", + }, + changeValue: &[]string{ + "val2", + "val3", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val2" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [0]: { + + nested : "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_middle.golden new file mode 100644 index 0000000000..6500bba0b0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_middle.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val3", + }, + changeValue: &[]string{ + "val1", + "val2", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val2" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_middle_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_middle_unordered.golden new file mode 100644 index 0000000000..7f3d1108f3 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/added_middle_unordered.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val1", + }, + changeValue: &[]string{ + "val2", + "val3", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val3" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_empty_to_null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_empty_to_null.golden new file mode 100644 index 0000000000..7bae19762f --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: &[]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_non-null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_non-null.golden new file mode 100644 index 0000000000..0d933f20b0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_non-null.golden @@ -0,0 +1,44 @@ +tests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{"value1"}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "value" -> null + } + + test { + + nested = "value1" + } + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0].nested": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_non-null_to_null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_non-null_to_null.golden new file mode 100644 index 0000000000..8ea0f409e2 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_non-null_to_null.golden @@ -0,0 +1,40 @@ +tests.testOutput{ + initialValue: &[]string{ + "value", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "value" -> null + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - tests: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_null_to_empty.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_null_to_empty.golden new file mode 100644 index 0000000000..9589fbdf0d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + changeValue: &[]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_null_to_non-null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_null_to_non-null.golden new file mode 100644 index 0000000000..c6125570df --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/changed_null_to_non-null.golden @@ -0,0 +1,40 @@ +tests.testOutput{ + changeValue: &[]string{ + "value", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "value" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + tests: [ + + [0]: { + + nested : "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed.golden new file mode 100644 index 0000000000..bce9459bf8 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed.golden @@ -0,0 +1,41 @@ +tests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "value" -> null + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - tests: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_end.golden new file mode 100644 index 0000000000..b9b27b7bb4 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_end.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val1", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val3" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[2]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_end_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_end_unordered.golden new file mode 100644 index 0000000000..3d59d39ff5 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_end_unordered.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + "val1", + }, + changeValue: &[]string{ + "val2", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val1" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [0]: { + - nested: "val1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_front.golden new file mode 100644 index 0000000000..b166de5932 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_front.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val2", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val1" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [0]: { + - nested: "val1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_front_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_front_unordered.golden new file mode 100644 index 0000000000..b32adae12f --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_front_unordered.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + "val1", + }, + changeValue: &[]string{ + "val3", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val2" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [1]: { + - nested: "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_middle.golden new file mode 100644 index 0000000000..43d40629cd --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_middle.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val1", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val2" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [1]: { + - nested: "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_middle_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_middle_unordered.golden new file mode 100644 index 0000000000..53f28a103b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/removed_middle_unordered.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val3", + "val1", + "val2", + }, + changeValue: &[]string{ + "val3", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val2" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [1]: { + - nested: "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/same_element_updated.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/same_element_updated.golden new file mode 100644 index 0000000000..6e47be3c98 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/same_element_updated.golden @@ -0,0 +1,52 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val1", + "val4", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "val2" -> null + } + + test { + + nested = "val4" + } + + # (2 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + ~ [1]: { + ~ nested: "val2" => "val4" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1].nested": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/same_element_updated_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/same_element_updated_unordered.golden new file mode 100644 index 0000000000..24a6cb727b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/same_element_updated_unordered.golden @@ -0,0 +1,58 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + "val1", + }, + changeValue: &[]string{ + "val2", + "val4", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "val3" -> null + } + + test { + + nested = "val4" + } + + # (2 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val4" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}, + "tests[2]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled.golden new file mode 100644 index 0000000000..b224442990 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled.golden @@ -0,0 +1,24 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val3", + "val1", + "val2", + }, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_end.golden new file mode 100644 index 0000000000..37ea563338 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_end.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + }, + changeValue: &[]string{ + "val2", + "val1", + "val3", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val3" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [2]: { + + nested : "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[2]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_front.golden new file mode 100644 index 0000000000..0f837543ff --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_front.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + }, + changeValue: &[]string{ + "val1", + "val3", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val1" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [0]: { + + nested : "val1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_middle.golden new file mode 100644 index 0000000000..1eafb16ce7 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_added_middle.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val3", + }, + changeValue: &[]string{ + "val3", + "val2", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val2" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_end.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_end.golden new file mode 100644 index 0000000000..b7c1fcc2e0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_end.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val2", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val3" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[2]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_front.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_front.golden new file mode 100644 index 0000000000..7f391ace8c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_front.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val3", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val1" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [0]: { + - nested: "val1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[0]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_middle.golden new file mode 100644 index 0000000000..a172a3cf2d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_removed_middle.golden @@ -0,0 +1,48 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val3", + "val1", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val2" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [1]: { + - nested: "val2" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"tests[1]": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_unordered.golden new file mode 100644 index 0000000000..d98c381793 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + "val1", + }, + changeValue: &[]string{ + "val3", + "val1", + "val2", + }, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_with_duplicates.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_with_duplicates.golden new file mode 100644 index 0000000000..09d74fe9c7 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_with_duplicates.golden @@ -0,0 +1,25 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val3", + "val1", + "val2", + "val3", + }, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_with_duplicates_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_with_duplicates_unordered.golden new file mode 100644 index 0000000000..1011e92c5a --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/shuffled_with_duplicates_unordered.golden @@ -0,0 +1,25 @@ +tests.testOutput{ + initialValue: &[]string{ + "val2", + "val3", + "val1", + }, + changeValue: &[]string{ + "val3", + "val1", + "val2", + "val3", + }, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added.golden new file mode 100644 index 0000000000..245630f956 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added.golden @@ -0,0 +1,58 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + }, + changeValue: &[]string{ + "val1", + "val2", + "val3", + "val4", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + + test { # forces replacement + + nested = "val3" + } + + test { # forces replacement + + nested = "val4" + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [2]: { + + nested : "val3" + } + + [3]: { + + nested : "val4" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[2]": map[string]interface{}{"kind": "ADD_REPLACE"}, + "tests[3]": map[string]interface{}{"kind": "ADD_REPLACE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed.golden new file mode 100644 index 0000000000..7fb5ca1caa --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed.golden @@ -0,0 +1,66 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + "val4", + }, + changeValue: &[]string{ + "val1", + "val2", + "val5", + "val6", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "val3" -> null + } + - test { + - nested = "val4" -> null + } + + test { + + nested = "val5" + } + + test { + + nested = "val6" + } + + # (2 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + ~ [2]: { + ~ nested: "val3" => "val5" + } + ~ [3]: { + ~ nested: "val4" => "val6" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[2].nested": map[string]interface{}{"kind": "UPDATE"}, + "tests[3].nested": map[string]interface{}{"kind": "UPDATE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden new file mode 100644 index 0000000000..f14f7acf2b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden @@ -0,0 +1,74 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + "val4", + }, + changeValue: &[]string{ + "val5", + "val6", + "val1", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "val3" -> null + } + - test { + - nested = "val4" -> null + } + + test { + + nested = "val5" + } + + test { + + nested = "val6" + } + + # (2 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [0]: { + + nested : "val5" + } + + [1]: { + + nested : "val6" + } + - [2]: { + - nested: "val3" + } + - [3]: { + - nested: "val4" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[0]": map[string]interface{}{"kind": "ADD_REPLACE"}, + "tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}, + "tests[2]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden new file mode 100644 index 0000000000..01e7fd0270 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden @@ -0,0 +1,70 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + "val4", + }, + changeValue: &[]string{ + "val1", + "val5", + "val6", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "val3" -> null + } + - test { + - nested = "val4" -> null + } + + test { + + nested = "val5" + } + + test { + + nested = "val6" + } + + # (2 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val5" + } + ~ [2]: { + ~ nested: "val3" => "val6" + } + - [3]: { + - nested: "val4" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}, + "tests[2].nested": map[string]interface{}{"kind": "UPDATE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden new file mode 100644 index 0000000000..214c2f28be --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden @@ -0,0 +1,72 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + "val4", + }, + changeValue: &[]string{ + "val1", + "val5", + "val6", + "val2", + "val1", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + - test { + - nested = "val3" -> null + } + - test { + - nested = "val4" -> null + } + + test { + + nested = "val5" + } + + test { + + nested = "val6" + } + + # (2 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val5" + } + ~ [2]: { + ~ nested: "val3" => "val6" + } + - [3]: { + - nested: "val4" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[1]": map[string]interface{}{"kind": "ADD_REPLACE"}, + "tests[2].nested": map[string]interface{}{"kind": "UPDATE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_removed.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_removed.golden new file mode 100644 index 0000000000..751e8ad777 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/two_removed.golden @@ -0,0 +1,58 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + "val4", + }, + changeValue: &[]string{ + "val1", + "val2", + }, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + - test { # forces replacement + - nested = "val3" -> null + } + - test { # forces replacement + - nested = "val4" -> null + } + + # (2 unchanged blocks hidden) + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + - [2]: { + - nested: "val3" + } + - [3]: { + - nested: "val4" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[2]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE_REPLACE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_empty.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_empty.golden new file mode 100644 index 0000000000..7d07227be4 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: &[]string{}, + changeValue: &[]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_non-empty.golden new file mode 100644 index 0000000000..a87f03643b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{"value"}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_null.golden b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_null.golden new file mode 100644 index 0000000000..a53fac34db --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSetCrossTest/block_top_level_force_new/unchanged_null.golden @@ -0,0 +1,11 @@ +tests.testOutput{tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`}