diff --git a/pkg/tests/detailed_diff_list_test.go b/pkg/tests/detailed_diff_list_test.go index ded726a67..dd89cb96a 100644 --- a/pkg/tests/detailed_diff_list_test.go +++ b/pkg/tests/detailed_diff_list_test.go @@ -239,8 +239,7 @@ func TestDetailedDiffList(t *testing.T) { {"list attribute force new", listAttrSchemaForceNew, attrList}, {"list block", listBlockSchema, blockList}, {"list block force new", listBlockSchemaForceNew, blockList}, - // TODO[pulumi/pulumi-terraform-bridge#2726]: These tests fail to produce the correct replacement plan - // {"list block nested force new", listBlockSchemaNestedForceNew, blockList}, + {"list block nested force new", listBlockSchemaNestedForceNew, blockList}, } maxItemsOnePairs := []struct { @@ -251,9 +250,8 @@ func TestDetailedDiffList(t *testing.T) { {"max items one attribute", maxItemsOneAttrSchema, attrList}, {"max items one attribute force new", maxItemsOneAttrSchemaForceNew, attrList}, {"max items one block", maxItemsOneBlockSchema, nestedBlockList}, - // TODO[pulumi/pulumi-terraform-bridge#2726]: These tests fail to produce the correct replacement plan - // {"max items one block force new", maxItemsOneBlockSchemaForceNew, nestedBlockList}, - // {"max items one block nested force new", maxItemsOneBlockSchemaNestedForceNew, nestedBlockList}, + {"max items one block force new", maxItemsOneBlockSchemaForceNew, nestedBlockList}, + {"max items one block nested force new", maxItemsOneBlockSchemaNestedForceNew, nestedBlockList}, } oneElementScenarios := []struct { diff --git a/pkg/tests/detailed_diff_set_test.go b/pkg/tests/detailed_diff_set_test.go index 874d78208..c04653422 100644 --- a/pkg/tests/detailed_diff_set_test.go +++ b/pkg/tests/detailed_diff_set_test.go @@ -890,22 +890,15 @@ func TestDetailedDiffSet(t *testing.T) { return cty.ListVal(slice) } - noForceNewSchemaValueMakerPairs := []struct { + schemaValueMakerPairs := []struct { name string res schema.Resource valueMaker func(*[]string) cty.Value }{ {"attribute no force new", attributeSchema, attrList}, {"block no force new", blockSchema, nestedAttrList}, - } - - forceNewSchemaValueMakerPairs := []struct { - name string - res schema.Resource - valueMaker func(*[]string) cty.Value - }{ {"attribute force new", attributeSchemaForceNew, attrList}, - {"block top level force new", blockSchemaForceNew, nestedAttrList}, + {"block force new", blockSchemaForceNew, nestedAttrList}, {"block nested force new", blockSchemaNestedForceNew, nestedAttrList}, } @@ -942,6 +935,7 @@ func TestDetailedDiffSet(t *testing.T) { {"added end unordered", &[]string{"val2", "val3"}, &[]string{"val2", "val3", "val1"}}, {"same element updated", &[]string{"val1", "val2", "val3"}, &[]string{"val1", "val4", "val3"}}, + {"same element updated unordered", &[]string{"val2", "val3", "val1"}, &[]string{"val2", "val4", "val1"}}, {"shuffled", &[]string{"val1", "val2", "val3"}, &[]string{"val3", "val1", "val2"}}, {"shuffled unordered", &[]string{"val2", "val3", "val1"}, &[]string{"val3", "val1", "val2"}}, @@ -958,24 +952,12 @@ func TestDetailedDiffSet(t *testing.T) { {"two added", &[]string{"val1", "val2"}, &[]string{"val1", "val2", "val3", "val4"}}, {"two removed", &[]string{"val1", "val2", "val3", "val4"}, &[]string{"val1", "val2"}}, - } - - // TODO[pulumi/pulumi-terraform-bridge#2726]: These tests fail to produce the correct replacement plan - // for the force new shcemas - extraScenarios := []struct { - name string - initialValue *[]string - changeValue *[]string - }{ - {"same element updated unordered", &[]string{"val2", "val3", "val1"}, &[]string{"val2", "val4", "val1"}}, {"two added and two removed", &[]string{"val1", "val2", "val3", "val4"}, &[]string{"val1", "val2", "val5", "val6"}}, {"two added and two removed shuffled, one overlaps", &[]string{"val1", "val2", "val3", "val4"}, &[]string{"val1", "val5", "val6", "val2"}}, {"two added and two removed shuffled, no overlaps", &[]string{"val1", "val2", "val3", "val4"}, &[]string{"val5", "val6", "val1", "val2"}}, {"two added and two removed shuffled, with duplicates", &[]string{"val1", "val2", "val3", "val4"}, &[]string{"val1", "val5", "val6", "val2", "val1", "val2"}}, } - allScenarios := append(scenarios, extraScenarios...) - type testOutput struct { initialValue *[]string changeValue *[]string @@ -999,7 +981,7 @@ func TestDetailedDiffSet(t *testing.T) { }) } - for _, schemaValueMakerPair := range forceNewSchemaValueMakerPairs { + for _, schemaValueMakerPair := range schemaValueMakerPairs { t.Run(schemaValueMakerPair.name, func(t *testing.T) { t.Parallel() for _, scenario := range scenarios { @@ -1010,16 +992,4 @@ func TestDetailedDiffSet(t *testing.T) { } }) } - - for _, schemaValueMakerPair := range noForceNewSchemaValueMakerPairs { - t.Run(schemaValueMakerPair.name, func(t *testing.T) { - t.Parallel() - for _, scenario := range allScenarios { - t.Run(scenario.name, func(t *testing.T) { - t.Parallel() - runTest(t, schemaValueMakerPair.res, schemaValueMakerPair.valueMaker, scenario.initialValue, scenario.changeValue) - }) - } - }) - } } diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/added_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/added_empty.golden new file mode 100644 index 000000000..9589fbdf0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/added_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/TestDetailedDiffList/list_block_nested_force_new/added_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/added_non-empty.golden new file mode 100644 index 000000000..d6e44e7cd --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/added_non-empty.golden @@ -0,0 +1,37 @@ +tests.testOutput{ + changeValue: &[]string{ + "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" + + + list_block {} + } + +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] + + listBlocks: [ + + [0]: { + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks": map[string]interface{}{}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/changed.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/changed.golden new file mode 100644 index 000000000..b9ed46f8e --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/changed.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + }, + changeValue: &[]string{"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/TestDetailedDiffList/list_block_nested_force_new/list_element_added_back.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_back.golden new file mode 100644 index 000000000..f004cc40c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_back.golden @@ -0,0 +1,45 @@ +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: + ~ 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" + + + list_block {} + + # (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] + ~ listBlocks: [ + + [2]: { + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_front.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_front.golden new file mode 100644 index 000000000..6b6068947 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_front.golden @@ -0,0 +1,45 @@ +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: + ~ 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" + + + list_block {} + + # (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] + ~ listBlocks: [ + + [2]: { + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_middle.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_middle.golden new file mode 100644 index 000000000..4828a7d56 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_added_middle.golden @@ -0,0 +1,45 @@ +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: + ~ 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" + + + list_block {} + + # (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] + ~ listBlocks: [ + + [2]: { + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_end.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_end.golden new file mode 100644 index 000000000..9333e7525 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_end.golden @@ -0,0 +1,46 @@ +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: + ~ 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" + + - list_block {} + + # (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] + ~ listBlocks: [ + - [2]: { + - nestedProp: + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_front.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_front.golden new file mode 100644 index 000000000..34709388a --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_front.golden @@ -0,0 +1,46 @@ +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: + ~ 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" + + - list_block {} + + # (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] + ~ listBlocks: [ + - [2]: { + - nestedProp: + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_middle.golden new file mode 100644 index 000000000..0d7ba5196 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/list_element_removed_middle.golden @@ -0,0 +1,46 @@ +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: + ~ 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" + + - list_block {} + + # (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] + ~ listBlocks: [ + - [2]: { + - nestedProp: + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[2]": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_added_back.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_added_back.golden new file mode 100644 index 000000000..408c0efc5 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_added_back.golden @@ -0,0 +1,81 @@ +tests.testOutput{ + initialValue: &[]string{ + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + }, + changeValue: &[]string{ + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + "value20", + }, + 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" + + + list_block {} + + # (20 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] + ~ listBlocks: [ + + [20]: { + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[20]": map[string]interface{}{}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_added_front.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_added_front.golden new file mode 100644 index 000000000..fe72a40b9 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_added_front.golden @@ -0,0 +1,81 @@ +tests.testOutput{ + initialValue: &[]string{ + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + }, + changeValue: &[]string{ + "value20", + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + }, + 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" + + + list_block {} + + # (20 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] + ~ listBlocks: [ + + [20]: { + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[20]": map[string]interface{}{}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_removed_back.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_removed_back.golden new file mode 100644 index 000000000..9f62cfbb7 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_removed_back.golden @@ -0,0 +1,82 @@ +tests.testOutput{ + initialValue: &[]string{ + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + "value20", + }, + changeValue: &[]string{ + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + }, + 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" + + - list_block {} + + # (20 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] + ~ listBlocks: [ + - [20]: { + - nestedProp: + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[20]": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_removed_front.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_removed_front.golden new file mode 100644 index 000000000..a9c7e5f1a --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/long_list_removed_front.golden @@ -0,0 +1,82 @@ +tests.testOutput{ + initialValue: &[]string{ + "value20", + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + }, + changeValue: &[]string{ + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "value11", + "value12", + "value13", + "value14", + "value15", + "value16", + "value17", + "value18", + "value19", + }, + 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" + + - list_block {} + + # (20 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] + ~ listBlocks: [ + - [20]: { + - nestedProp: + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks[20]": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/one_added,_one_removed.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/one_added,_one_removed.golden new file mode 100644 index 000000000..ec6d9dee0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/one_added,_one_removed.golden @@ -0,0 +1,24 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + "val2", + "val3", + }, + changeValue: &[]string{ + "val2", + "val3", + "val4", + }, + 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/TestDetailedDiffList/list_block_nested_force_new/removed_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/removed_empty.golden new file mode 100644 index 000000000..7bae19762 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/removed_empty.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/TestDetailedDiffList/list_block_nested_force_new/removed_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/removed_non-empty.golden new file mode 100644 index 000000000..f28fcaa04 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/removed_non-empty.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &[]string{ + "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" + + - list_block {} + } + +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] + - listBlocks: [ + - [0]: { + - nestedProp: + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlocks": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/unchanged_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/unchanged_empty.golden new file mode 100644 index 000000000..a53fac34d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/unchanged_empty.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 +`} diff --git a/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/unchanged_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/unchanged_non-empty.golden new file mode 100644 index 000000000..e250a9f9c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/list_block_nested_force_new/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + }, + changeValue: &[]string{"val1"}, + 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/TestDetailedDiffList/max_items_one_block_force_new/added_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/added_empty.golden new file mode 100644 index 000000000..9589fbdf0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/added_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/TestDetailedDiffList/max_items_one_block_force_new/added_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/added_non-empty.golden new file mode 100644 index 000000000..d499d6b10 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/added_non-empty.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + changeValue: &[]string{ + "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) + + + list_block { # forces replacement + + nested_prop = "val1" + } + } + +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] + + listBlock: { + + nestedProp: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlock": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/changed.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/changed.golden new file mode 100644 index 000000000..c0d558ea3 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/changed.golden @@ -0,0 +1,39 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + }, + changeValue: &[]string{"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" + + ~ list_block { + ~ nested_prop = "val1" -> "val2" + } + } + +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] + ~ listBlock: { + ~ nestedProp: "val1" => "val2" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlock.nestedProp": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/removed_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/removed_empty.golden new file mode 100644 index 000000000..7bae19762 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/removed_empty.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/TestDetailedDiffList/max_items_one_block_force_new/removed_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/removed_non-empty.golden new file mode 100644 index 000000000..75e5fd209 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/removed_non-empty.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &[]string{ + "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) + + - list_block { # forces replacement + - nested_prop = "val1" -> 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] + - listBlock: { + - nestedProp: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlock": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/unchanged_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/unchanged_empty.golden new file mode 100644 index 000000000..a53fac34d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/unchanged_empty.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 +`} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/unchanged_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/unchanged_non-empty.golden new file mode 100644 index 000000000..e250a9f9c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_force_new/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + }, + changeValue: &[]string{"val1"}, + 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/TestDetailedDiffList/max_items_one_block_nested_force_new/added_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/added_empty.golden new file mode 100644 index 000000000..9589fbdf0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/added_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/TestDetailedDiffList/max_items_one_block_nested_force_new/added_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/added_non-empty.golden new file mode 100644 index 000000000..0048a8175 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/added_non-empty.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + changeValue: &[]string{ + "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) + + + list_block { + + nested_prop = "val1" # forces replacement + } + } + +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] + + listBlock: { + + nestedProp: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlock": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/changed.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/changed.golden new file mode 100644 index 000000000..733ec0705 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/changed.golden @@ -0,0 +1,39 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + }, + changeValue: &[]string{"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) + + ~ list_block { + ~ nested_prop = "val1" -> "val2" # forces replacement + } + } + +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] + ~ listBlock: { + ~ nestedProp: "val1" => "val2" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlock.nestedProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/removed_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/removed_empty.golden new file mode 100644 index 000000000..7bae19762 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/removed_empty.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/TestDetailedDiffList/max_items_one_block_nested_force_new/removed_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/removed_non-empty.golden new file mode 100644 index 000000000..4993e76cf --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/removed_non-empty.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &[]string{ + "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) + + - list_block { + - nested_prop = "val1" -> null # forces replacement + } + } + +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] + - listBlock: { + - nestedProp: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"listBlock": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/unchanged_empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/unchanged_empty.golden new file mode 100644 index 000000000..a53fac34d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/unchanged_empty.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 +`} diff --git a/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/unchanged_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/unchanged_non-empty.golden new file mode 100644 index 000000000..e250a9f9c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffList/max_items_one_block_nested_force_new/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &[]string{ + "val1", + }, + changeValue: &[]string{"val1"}, + 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/TestDetailedDiffSet/block_force_new/added.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added.golden new file mode 100644 index 000000000..10d82d99a --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/added_end.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added_end.golden new file mode 100644 index 000000000..3e7a81565 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/added_end_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added_end_unordered.golden new file mode 100644 index 000000000..4f1b9a49b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/added_front.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added_front.golden new file mode 100644 index 000000000..66286b3f2 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/added_front_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added_front_unordered.golden new file mode 100644 index 000000000..fc91a82a2 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/added_middle.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added_middle.golden new file mode 100644 index 000000000..6500bba0b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/added_middle_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/added_middle_unordered.golden new file mode 100644 index 000000000..7f3d1108f --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/changed_empty_to_null.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/changed_empty_to_null.golden new file mode 100644 index 000000000..7bae19762 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/changed_non-null.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/changed_non-null.golden new file mode 100644 index 000000000..0d933f20b --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/changed_non-null_to_null.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/changed_non-null_to_null.golden new file mode 100644 index 000000000..8ea0f409e --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/changed_null_to_empty.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/changed_null_to_empty.golden new file mode 100644 index 000000000..9589fbdf0 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/changed_null_to_non-null.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/changed_null_to_non-null.golden new file mode 100644 index 000000000..c6125570d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed.golden new file mode 100644 index 000000000..bce9459bf --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed_end.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed_end.golden new file mode 100644 index 000000000..b9b27b7bb --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed_end_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed_end_unordered.golden new file mode 100644 index 000000000..3d59d39ff --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed_front.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed_front.golden new file mode 100644 index 000000000..b166de593 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed_front_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed_front_unordered.golden new file mode 100644 index 000000000..b32adae12 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed_middle.golden new file mode 100644 index 000000000..43d40629c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/removed_middle_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/removed_middle_unordered.golden new file mode 100644 index 000000000..53f28a103 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/same_element_updated.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/same_element_updated.golden new file mode 100644 index 000000000..6e47be3c9 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/same_element_updated_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/same_element_updated_unordered.golden new file mode 100644 index 000000000..877874c48 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ tests: [ + + [1]: { + + nested : "val4" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[1]": map[string]interface{}{}, + "tests[2]": map[string]interface{}{"kind": "DELETE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled.golden new file mode 100644 index 000000000..b22444299 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_added_end.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_added_end.golden new file mode 100644 index 000000000..37ea56333 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_added_front.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_added_front.golden new file mode 100644 index 000000000..0f837543f --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_added_middle.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_added_middle.golden new file mode 100644 index 000000000..1eafb16ce --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_removed_end.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_removed_end.golden new file mode 100644 index 000000000..b7c1fcc2e --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_removed_front.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_removed_front.golden new file mode 100644 index 000000000..7f391ace8 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_removed_middle.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_removed_middle.golden new file mode 100644 index 000000000..a172a3cf2 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_unordered.golden new file mode 100644 index 000000000..d98c38179 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_with_duplicates.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_with_duplicates.golden new file mode 100644 index 000000000..09d74fe9c --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/shuffled_with_duplicates_unordered.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/shuffled_with_duplicates_unordered.golden new file mode 100644 index 000000000..1011e92c5 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/two_added.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added.golden new file mode 100644 index 000000000..245630f95 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/two_added_and_two_removed.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added_and_two_removed.golden new file mode 100644 index 000000000..7fb5ca1ca --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added_and_two_removed_shuffled,_no_overlaps.golden new file mode 100644 index 000000000..a2d950d91 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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: (update) + [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 update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[0]": map[string]interface{}{}, + "tests[1]": map[string]interface{}{}, + "tests[2]": map[string]interface{}{"kind": "DELETE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added_and_two_removed_shuffled,_one_overlaps.golden new file mode 100644 index 000000000..174d501cf --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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: (update) + [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 update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[1]": map[string]interface{}{}, + "tests[2].nested": map[string]interface{}{"kind": "UPDATE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_added_and_two_removed_shuffled,_with_duplicates.golden new file mode 100644 index 000000000..893609195 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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: (update) + [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 update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "tests[1]": map[string]interface{}{}, + "tests[2].nested": map[string]interface{}{"kind": "UPDATE"}, + "tests[3]": map[string]interface{}{"kind": "DELETE"}, + }, +} diff --git a/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_removed.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/two_removed.golden new file mode 100644 index 000000000..751e8ad77 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/unchanged_empty.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/unchanged_empty.golden new file mode 100644 index 000000000..7d07227be --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/unchanged_non-empty.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/unchanged_non-empty.golden new file mode 100644 index 000000000..a87f03643 --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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/TestDetailedDiffSet/block_force_new/unchanged_null.golden b/pkg/tests/testdata/TestDetailedDiffSet/block_force_new/unchanged_null.golden new file mode 100644 index 000000000..a53fac34d --- /dev/null +++ b/pkg/tests/testdata/TestDetailedDiffSet/block_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 +`}