From 317d4b819f12d4bc66adc5fb248bfb77a3cc7ba7 Mon Sep 17 00:00:00 2001 From: VenelinMartinov Date: Thu, 14 Nov 2024 12:07:39 +0000 Subject: [PATCH] Plugin Framework bridge cross tests (#2592) This is a test-only PR - it adds cross-tests for Diff for the plugin framework for the existing behaviour. Each test defines a set of schemas and a set of scenarios and the full matrix of schemas X scenarios is run in cross-tests. For each of these test cases both pulumi and TF are run with the initial input then a preview is run with the second set of inputs and the outcome of the preview is compared. We also record the stdout for both pulumi and TF for manual comparison of the preview output. The recordings also contain the inputs in order to make spot-checking them easier. The full test plan is available in https://github.com/pulumi/pulumi-terraform-bridge/issues/2597 fixes https://github.com/pulumi/pulumi-terraform-bridge/issues/2297 fixes https://github.com/pulumi/pulumi-terraform-bridge/issues/2597 --- pkg/pf/tests/diff_list_test.go | 233 +++++++++++ pkg/pf/tests/diff_map_test.go | 187 +++++++++ pkg/pf/tests/diff_object_test.go | 362 ++++++++++++++++++ pkg/pf/tests/diff_set_test.go | 242 ++++++++++++ pkg/pf/tests/diff_test.go | 158 +++++++- pkg/pf/tests/internal/cross-tests/diff.go | 3 +- .../attribute_no_replace/added.golden | 35 ++ .../attribute_no_replace/added_end.golden | 46 +++ .../attribute_no_replace/added_front.golden | 46 +++ .../attribute_no_replace/added_middle.golden | 46 +++ .../changed_empty_to_null.golden | 30 ++ .../changed_non-empty.golden | 37 ++ .../changed_null_to_empty.golden | 30 ++ .../attribute_no_replace/element_added.golden | 42 ++ .../element_removed.golden | 40 ++ .../non-null_to_null.golden | 36 ++ .../null_to_non-null.golden | 36 ++ .../null_unchanged.golden | 11 + .../attribute_no_replace/removed.golden | 37 ++ .../attribute_no_replace/removed_end.golden | 46 +++ .../attribute_no_replace/removed_front.golden | 46 +++ .../removed_middle.golden | 46 +++ .../unchanged_non-empty.golden | 18 + .../attribute_requires_replace/added.golden | 36 ++ .../added_end.golden | 47 +++ .../added_front.golden | 47 +++ .../added_middle.golden | 47 +++ .../changed_empty_to_null.golden | 31 ++ .../changed_non-empty.golden | 38 ++ .../changed_null_to_empty.golden | 31 ++ .../element_added.golden | 43 +++ .../element_removed.golden | 41 ++ .../non-null_to_null.golden | 37 ++ .../null_to_non-null.golden | 37 ++ .../null_unchanged.golden | 11 + .../attribute_requires_replace/removed.golden | 38 ++ .../removed_end.golden | 47 +++ .../removed_front.golden | 47 +++ .../removed_middle.golden | 47 +++ .../unchanged_non-empty.golden | 18 + .../added.golden | 39 ++ .../added_end.golden | 54 +++ .../added_front.golden | 58 +++ .../added_middle.golden | 57 +++ .../changed_empty_to_null.golden | 15 + .../changed_non-empty.golden | 41 ++ .../changed_null_to_empty.golden | 15 + .../element_added.golden | 49 +++ .../element_removed.golden | 46 +++ .../non-null_to_null.golden | 39 ++ .../null_to_non-null.golden | 40 ++ .../null_unchanged.golden | 11 + .../removed.golden | 40 ++ .../removed_end.golden | 53 +++ .../removed_front.golden | 58 +++ .../removed_middle.golden | 57 +++ .../unchanged_non-empty.golden | 18 + .../block_no_replace/added.golden | 38 ++ .../block_no_replace/added_end.golden | 53 +++ .../block_no_replace/added_front.golden | 57 +++ .../block_no_replace/added_middle.golden | 56 +++ .../changed_empty_to_null.golden | 15 + .../block_no_replace/changed_non-empty.golden | 40 ++ .../changed_null_to_empty.golden | 15 + .../block_no_replace/element_added.golden | 48 +++ .../block_no_replace/element_removed.golden | 46 +++ .../block_no_replace/non-null_to_null.golden | 39 ++ .../block_no_replace/null_to_non-null.golden | 39 ++ .../block_no_replace/null_unchanged.golden | 11 + .../block_no_replace/removed.golden | 40 ++ .../block_no_replace/removed_end.golden | 53 +++ .../block_no_replace/removed_front.golden | 57 +++ .../block_no_replace/removed_middle.golden | 56 +++ .../unchanged_non-empty.golden | 18 + .../block_requires_replace/added.golden | 39 ++ .../block_requires_replace/added_end.golden | 54 +++ .../block_requires_replace/added_front.golden | 58 +++ .../added_middle.golden | 57 +++ .../changed_empty_to_null.golden | 15 + .../changed_non-empty.golden | 41 ++ .../changed_null_to_empty.golden | 15 + .../element_added.golden | 49 +++ .../element_removed.golden | 47 +++ .../non-null_to_null.golden | 40 ++ .../null_to_non-null.golden | 40 ++ .../null_unchanged.golden | 11 + .../block_requires_replace/removed.golden | 41 ++ .../block_requires_replace/removed_end.golden | 54 +++ .../removed_front.golden | 58 +++ .../removed_middle.golden | 57 +++ .../unchanged_non-empty.golden | 18 + .../added.golden | 40 ++ .../added_end.golden | 54 +++ .../added_front.golden | 59 +++ .../added_middle.golden | 57 +++ .../changed_empty_to_null.golden | 30 ++ .../changed_non-empty.golden | 42 ++ .../changed_null_to_empty.golden | 30 ++ .../element_added.golden | 49 +++ .../element_removed.golden | 46 +++ .../non-null_to_null.golden | 40 ++ .../null_to_non-null.golden | 41 ++ .../null_unchanged.golden | 11 + .../removed.golden | 41 ++ .../removed_end.golden | 53 +++ .../removed_front.golden | 59 +++ .../removed_middle.golden | 57 +++ .../unchanged_non-empty.golden | 18 + .../nested_attribute_no_replace/added.golden | 39 ++ .../added_end.golden | 53 +++ .../added_front.golden | 58 +++ .../added_middle.golden | 56 +++ .../changed_empty_to_null.golden | 30 ++ .../changed_non-empty.golden | 41 ++ .../changed_null_to_empty.golden | 30 ++ .../element_added.golden | 48 +++ .../element_removed.golden | 46 +++ .../non-null_to_null.golden | 40 ++ .../null_to_non-null.golden | 40 ++ .../null_unchanged.golden | 11 + .../removed.golden | 41 ++ .../removed_end.golden | 53 +++ .../removed_front.golden | 58 +++ .../removed_middle.golden | 56 +++ .../unchanged_non-empty.golden | 18 + .../added.golden | 40 ++ .../added_end.golden | 54 +++ .../added_front.golden | 59 +++ .../added_middle.golden | 57 +++ .../changed_empty_to_null.golden | 31 ++ .../changed_non-empty.golden | 42 ++ .../changed_null_to_empty.golden | 31 ++ .../element_added.golden | 49 +++ .../element_removed.golden | 47 +++ .../non-null_to_null.golden | 41 ++ .../null_to_non-null.golden | 41 ++ .../null_unchanged.golden | 11 + .../removed.golden | 42 ++ .../removed_end.golden | 54 +++ .../removed_front.golden | 59 +++ .../removed_middle.golden | 57 +++ .../unchanged_non-empty.golden | 18 + .../attribute_no_replace/added_empty.golden | 30 ++ .../added_non-empty.golden | 36 ++ .../changed_value_non-null.golden | 37 ++ .../changed_value_non-null_to_null.golden | 33 ++ .../changed_value_null_to_non-null.golden | 37 ++ .../attribute_no_replace/removed_empty.golden | 30 ++ .../removed_non-empty.golden | 36 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../unchanged_null_value.golden | 18 + .../added_empty.golden | 31 ++ .../added_non-empty.golden | 37 ++ .../changed_value_non-null.golden | 38 ++ .../changed_value_non-null_to_null.golden | 35 ++ .../changed_value_null_to_non-null.golden | 38 ++ .../removed_empty.golden | 31 ++ .../removed_non-empty.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../unchanged_null_value.golden | 18 + .../added_empty.golden | 30 ++ .../added_non-empty.golden | 41 ++ .../changed_value_non-null.golden | 42 ++ .../changed_value_non-null_to_null.golden | 35 ++ .../changed_value_null_to_non-null.golden | 42 ++ .../removed_empty.golden | 30 ++ .../removed_non-empty.golden | 40 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../unchanged_null_value.golden | 18 + .../added_empty.golden | 30 ++ .../added_non-empty.golden | 40 ++ .../changed_value_non-null.golden | 41 ++ .../changed_value_non-null_to_null.golden | 35 ++ .../changed_value_null_to_non-null.golden | 41 ++ .../removed_empty.golden | 30 ++ .../removed_non-empty.golden | 40 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../unchanged_null_value.golden | 18 + .../added_empty.golden | 31 ++ .../added_non-empty.golden | 41 ++ .../changed_value_non-null.golden | 42 ++ .../changed_value_non-null_to_null.golden | 37 ++ .../changed_value_null_to_non-null.golden | 42 ++ .../removed_empty.golden | 31 ++ .../removed_non-empty.golden | 41 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../unchanged_null_value.golden | 18 + .../attribute_default_no_replace/added.golden | 36 ++ .../changed_value_non-null.golden | 37 ++ .../removed.golden | 36 ++ .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../attribute_default_replace/added.golden | 37 ++ .../changed_value_non-null.golden | 38 ++ .../attribute_default_replace/removed.golden | 37 ++ .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../attribute_no_replace/added.golden | 36 ++ .../changed_value_non-null.golden | 37 ++ .../attribute_no_replace/removed.golden | 36 ++ .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 36 ++ .../changed_value_non-null.golden | 37 ++ .../removed.golden | 17 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 37 ++ .../changed_value_non-null.golden | 38 ++ .../removed.golden | 17 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../attribute_requires_replace/added.golden | 37 ++ .../changed_value_non-null.golden | 38 ++ .../attribute_requires_replace/removed.golden | 37 ++ .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 38 ++ .../changed_empty_to_non-empty.golden | 37 ++ .../changed_non-empty_to_empty.golden | 39 ++ .../changed_value_non-null.golden | 39 ++ .../removed.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 37 ++ .../changed_empty_to_non-empty.golden | 36 ++ .../changed_non-empty_to_empty.golden | 38 ++ .../changed_value_non-null.golden | 38 ++ .../removed.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../nested_block_default_replace/added.golden | 38 ++ .../changed_empty_to_non-empty.golden | 37 ++ .../changed_non-empty_to_empty.golden | 39 ++ .../changed_value_non-null.golden | 39 ++ .../removed.golden | 38 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 38 ++ .../changed_empty_to_non-empty.golden | 37 ++ .../changed_non-empty_to_empty.golden | 39 ++ .../changed_value_non-null.golden | 39 ++ .../removed.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../nested_block_no_replace/added.golden | 37 ++ .../changed_empty_to_non-empty.golden | 36 ++ .../changed_non-empty_to_empty.golden | 38 ++ .../changed_value_non-null.golden | 38 ++ .../nested_block_no_replace/removed.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 37 ++ .../changed_empty_to_non-empty.golden | 36 ++ .../changed_non-empty_to_empty.golden | 18 + .../changed_value_non-null.golden | 38 ++ .../removed.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 38 ++ .../changed_empty_to_non-empty.golden | 37 ++ .../changed_non-empty_to_empty.golden | 18 + .../changed_value_non-null.golden | 39 ++ .../removed.golden | 37 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 38 ++ .../changed_empty_to_non-empty.golden | 37 ++ .../changed_non-empty_to_empty.golden | 39 ++ .../changed_value_non-null.golden | 39 ++ .../removed.golden | 38 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../attribute_no_replace/added.golden | 35 ++ .../attribute_no_replace/added_end.golden | 45 +++ .../added_end_unordered.golden | 45 +++ .../attribute_no_replace/added_front.golden | 45 +++ .../added_front_unordered.golden | 45 +++ .../attribute_no_replace/added_middle.golden | 45 +++ .../added_middle_unordered.golden | 45 +++ .../changed_empty_to_null.golden | 30 ++ .../changed_non-null.golden | 38 ++ .../changed_non-null_to_null.golden | 36 ++ .../changed_null_to_empty.golden | 30 ++ .../changed_null_to_non-null.golden | 36 ++ .../attribute_no_replace/removed.golden | 37 ++ .../attribute_no_replace/removed_end.golden | 45 +++ .../removed_end_unordered.golden | 45 +++ .../attribute_no_replace/removed_front.golden | 45 +++ .../removed_front_unordered.golden | 45 +++ .../removed_middle.golden | 45 +++ .../removed_middle_unordered.golden | 45 +++ .../attribute_no_replace/shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../attribute_requires_replace/added.golden | 36 ++ .../added_end.golden | 46 +++ .../added_end_unordered.golden | 46 +++ .../added_front.golden | 46 +++ .../added_front_unordered.golden | 46 +++ .../added_middle.golden | 46 +++ .../added_middle_unordered.golden | 46 +++ .../changed_empty_to_null.golden | 31 ++ .../changed_non-null.golden | 39 ++ .../changed_non-null_to_null.golden | 37 ++ .../changed_null_to_empty.golden | 31 ++ .../changed_null_to_non-null.golden | 37 ++ .../attribute_requires_replace/removed.golden | 38 ++ .../removed_end.golden | 46 +++ .../removed_end_unordered.golden | 46 +++ .../removed_front.golden | 46 +++ .../removed_front_unordered.golden | 46 +++ .../removed_middle.golden | 46 +++ .../removed_middle_unordered.golden | 46 +++ .../shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 39 ++ .../added_end.golden | 54 +++ .../added_end_unordered.golden | 54 +++ .../added_front.golden | 54 +++ .../added_front_unordered.golden | 54 +++ .../added_middle.golden | 54 +++ .../added_middle_unordered.golden | 54 +++ .../changed_empty_to_null.golden | 15 + .../changed_non-null.golden | 44 +++ .../changed_non-null_to_null.golden | 39 ++ .../changed_null_to_empty.golden | 15 + .../changed_null_to_non-null.golden | 40 ++ .../removed.golden | 40 ++ .../removed_end.golden | 53 +++ .../removed_end_unordered.golden | 54 +++ .../removed_front.golden | 54 +++ .../removed_front_unordered.golden | 54 +++ .../removed_middle.golden | 54 +++ .../removed_middle_unordered.golden | 54 +++ .../shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../block_no_replace/added.golden | 38 ++ .../block_no_replace/added_end.golden | 53 +++ .../added_end_unordered.golden | 53 +++ .../block_no_replace/added_front.golden | 53 +++ .../added_front_unordered.golden | 53 +++ .../block_no_replace/added_middle.golden | 53 +++ .../added_middle_unordered.golden | 53 +++ .../changed_empty_to_null.golden | 15 + .../block_no_replace/changed_non-null.golden | 43 +++ .../changed_non-null_to_null.golden | 39 ++ .../changed_null_to_empty.golden | 15 + .../changed_null_to_non-null.golden | 39 ++ .../block_no_replace/removed.golden | 40 ++ .../block_no_replace/removed_end.golden | 53 +++ .../removed_end_unordered.golden | 53 +++ .../block_no_replace/removed_front.golden | 53 +++ .../removed_front_unordered.golden | 53 +++ .../block_no_replace/removed_middle.golden | 53 +++ .../removed_middle_unordered.golden | 53 +++ .../block_no_replace/shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../block_no_replace/unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../block_no_replace/unchanged_null.golden | 11 + .../block_requires_replace/added.golden | 39 ++ .../block_requires_replace/added_end.golden | 54 +++ .../added_end_unordered.golden | 54 +++ .../block_requires_replace/added_front.golden | 54 +++ .../added_front_unordered.golden | 54 +++ .../added_middle.golden | 54 +++ .../added_middle_unordered.golden | 54 +++ .../changed_empty_to_null.golden | 15 + .../changed_non-null.golden | 44 +++ .../changed_non-null_to_null.golden | 40 ++ .../changed_null_to_empty.golden | 15 + .../changed_null_to_non-null.golden | 40 ++ .../block_requires_replace/removed.golden | 41 ++ .../block_requires_replace/removed_end.golden | 54 +++ .../removed_end_unordered.golden | 54 +++ .../removed_front.golden | 54 +++ .../removed_front_unordered.golden | 54 +++ .../removed_middle.golden | 54 +++ .../removed_middle_unordered.golden | 54 +++ .../block_requires_replace/shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 40 ++ .../added_end.golden | 54 +++ .../added_end_unordered.golden | 54 +++ .../added_front.golden | 54 +++ .../added_front_unordered.golden | 54 +++ .../added_middle.golden | 54 +++ .../added_middle_unordered.golden | 54 +++ .../changed_empty_to_null.golden | 30 ++ .../changed_non-null.golden | 45 +++ .../changed_non-null_to_null.golden | 40 ++ .../changed_null_to_empty.golden | 30 ++ .../changed_null_to_non-null.golden | 41 ++ .../removed.golden | 41 ++ .../removed_end.golden | 53 +++ .../removed_end_unordered.golden | 54 +++ .../removed_front.golden | 54 +++ .../removed_front_unordered.golden | 54 +++ .../removed_middle.golden | 54 +++ .../removed_middle_unordered.golden | 54 +++ .../shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../nested_attribute_no_replace/added.golden | 39 ++ .../added_end.golden | 53 +++ .../added_end_unordered.golden | 53 +++ .../added_front.golden | 53 +++ .../added_front_unordered.golden | 53 +++ .../added_middle.golden | 53 +++ .../added_middle_unordered.golden | 53 +++ .../changed_empty_to_null.golden | 30 ++ .../changed_non-null.golden | 44 +++ .../changed_non-null_to_null.golden | 40 ++ .../changed_null_to_empty.golden | 30 ++ .../changed_null_to_non-null.golden | 40 ++ .../removed.golden | 41 ++ .../removed_end.golden | 53 +++ .../removed_end_unordered.golden | 53 +++ .../removed_front.golden | 53 +++ .../removed_front_unordered.golden | 53 +++ .../removed_middle.golden | 53 +++ .../removed_middle_unordered.golden | 53 +++ .../shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../added.golden | 40 ++ .../added_end.golden | 54 +++ .../added_end_unordered.golden | 54 +++ .../added_front.golden | 54 +++ .../added_front_unordered.golden | 54 +++ .../added_middle.golden | 54 +++ .../added_middle_unordered.golden | 54 +++ .../changed_empty_to_null.golden | 31 ++ .../changed_non-null.golden | 45 +++ .../changed_non-null_to_null.golden | 41 ++ .../changed_null_to_empty.golden | 31 ++ .../changed_null_to_non-null.golden | 41 ++ .../removed.golden | 42 ++ .../removed_end.golden | 54 +++ .../removed_end_unordered.golden | 54 +++ .../removed_front.golden | 54 +++ .../removed_front_unordered.golden | 54 +++ .../removed_middle.golden | 54 +++ .../removed_middle_unordered.golden | 54 +++ .../shuffled.golden | 24 ++ .../shuffled_unordered.golden | 24 ++ .../unchanged_empty.golden | 16 + .../unchanged_non-empty.golden | 18 + .../unchanged_null.golden | 11 + .../default/added.golden | 30 ++ .../default/changed.golden | 31 ++ .../default/removed.golden | 30 ++ .../default/unchanged.golden | 16 + .../default_replace/added.golden | 31 ++ .../default_replace/changed.golden | 32 ++ .../default_replace/removed.golden | 31 ++ .../default_replace/unchanged.golden | 16 + .../no_replace/added.golden | 30 ++ .../no_replace/changed.golden | 31 ++ .../no_replace/removed.golden | 30 ++ .../no_replace/unchanged.golden | 16 + .../plan_modifier_default/added.golden | 30 ++ .../plan_modifier_default/changed.golden | 31 ++ .../plan_modifier_default/removed.golden | 15 + .../plan_modifier_default/unchanged.golden | 16 + .../added.golden | 31 ++ .../changed.golden | 32 ++ .../removed.golden | 15 + .../unchanged.golden | 16 + .../replace/added.golden | 31 ++ .../replace/changed.golden | 32 ++ .../replace/removed.golden | 31 ++ .../replace/unchanged.golden | 16 + 507 files changed, 19210 insertions(+), 5 deletions(-) create mode 100644 pkg/pf/tests/diff_list_test.go create mode 100644 pkg/pf/tests/diff_map_test.go create mode 100644 pkg/pf/tests/diff_object_test.go create mode 100644 pkg/pf/tests/diff_set_test.go create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null_value.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null_value.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null_value.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null_value.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null_value.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_empty_to_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_non-empty_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_value_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/changed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/changed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/changed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/changed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/changed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/unchanged.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/changed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/unchanged.golden diff --git a/pkg/pf/tests/diff_list_test.go b/pkg/pf/tests/diff_list_test.go new file mode 100644 index 000000000..b5de36c91 --- /dev/null +++ b/pkg/pf/tests/diff_list_test.go @@ -0,0 +1,233 @@ +package tfbridgetests + +import ( + "testing" + + rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hexops/autogold/v2" + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tests/internal/cross-tests" + "github.com/zclconf/go-cty/cty" +) + +func TestDetailedDiffList(t *testing.T) { + t.Parallel() + + attributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + }, + }, + } + + attributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedAttributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ListNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + }, + }, + } + + nestedAttributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ListNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + }, + }, + }, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedAttributeNestedReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ListNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + }, + } + + blockSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.ListNestedBlock{ + NestedObject: rschema.NestedBlockObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + }, + }, + } + + blockReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.ListNestedBlock{ + NestedObject: rschema.NestedBlockObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + }, + } + + blockNestedReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.ListNestedBlock{ + NestedObject: rschema.NestedBlockObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + }, + } + + attrList := func(arr *[]string) cty.Value { + if arr == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + slice := make([]cty.Value, len(*arr)) + for i, v := range *arr { + slice[i] = cty.StringVal(v) + } + if len(slice) == 0 { + return cty.ListValEmpty(cty.String) + } + return cty.ListVal(slice) + } + + nestedAttrList := func(arr *[]string) cty.Value { + if arr == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + slice := make([]cty.Value, len(*arr)) + for i, v := range *arr { + slice[i] = cty.ObjectVal( + map[string]cty.Value{ + "nested": cty.StringVal(v), + }, + ) + } + if len(slice) == 0 { + return cty.ListValEmpty(cty.Object(map[string]cty.Type{"nested": cty.String})) + } + return cty.ListVal(slice) + } + + schemaValueMakerPairs := []struct { + name string + schema rschema.Schema + valueMaker func(*[]string) cty.Value + }{ + {"attribute no replace", attributeSchema, attrList}, + {"attribute requires replace", attributeReplaceSchema, attrList}, + {"nested attribute no replace", nestedAttributeSchema, nestedAttrList}, + {"nested attribute requires replace", nestedAttributeReplaceSchema, nestedAttrList}, + {"nested attribute nested requires replace", nestedAttributeNestedReplaceSchema, nestedAttrList}, + {"block no replace", blockSchema, nestedAttrList}, + {"block requires replace", blockReplaceSchema, nestedAttrList}, + {"block nested requires replace", blockNestedReplaceSchema, nestedAttrList}, + } + + scenarios := []struct { + name string + initialValue *[]string + changeValue *[]string + }{ + {"unchanged non-empty", &[]string{"value"}, &[]string{"value"}}, + {"changed non-empty", &[]string{"value"}, &[]string{"value1"}}, + {"added", &[]string{}, &[]string{"value"}}, + {"removed", &[]string{"value"}, &[]string{}}, + {"null unchanged", nil, nil}, + {"null to non-null", nil, &[]string{"value"}}, + {"non-null to null", &[]string{"value"}, nil}, + {"changed null to empty", nil, &[]string{}}, + {"changed empty to null", &[]string{}, nil}, + {"element added", &[]string{"value"}, &[]string{"value", "value1"}}, + {"element removed", &[]string{"value", "value1"}, &[]string{"value"}}, + {"removed front", &[]string{"val1", "val2", "val3"}, &[]string{"val2", "val3"}}, + {"removed middle", &[]string{"val1", "val2", "val3"}, &[]string{"val1", "val3"}}, + {"removed end", &[]string{"val1", "val2", "val3"}, &[]string{"val1", "val2"}}, + {"added front", &[]string{"val2", "val3"}, &[]string{"val1", "val2", "val3"}}, + {"added middle", &[]string{"val1", "val3"}, &[]string{"val1", "val2", "val3"}}, + {"added end", &[]string{"val1", "val2"}, &[]string{"val1", "val2", "val3"}}, + } + + type testOutput struct { + initialValue *[]string + changeValue *[]string + tfOut string + pulumiOut string + } + + for _, schemaValueMakerPair := range schemaValueMakerPairs { + t.Run(schemaValueMakerPair.name, func(t *testing.T) { + t.Parallel() + for _, scenario := range scenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + initialValue := schemaValueMakerPair.valueMaker(scenario.initialValue) + changeValue := schemaValueMakerPair.valueMaker(scenario.changeValue) + + diff := crosstests.Diff( + t, schemaValueMakerPair.schema, map[string]cty.Value{"key": initialValue}, map[string]cty.Value{"key": changeValue}) + + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + }) + }) + } + }) + } +} diff --git a/pkg/pf/tests/diff_map_test.go b/pkg/pf/tests/diff_map_test.go new file mode 100644 index 000000000..6638e7502 --- /dev/null +++ b/pkg/pf/tests/diff_map_test.go @@ -0,0 +1,187 @@ +package tfbridgetests + +import ( + "testing" + + rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hexops/autogold/v2" + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tests/internal/cross-tests" + "github.com/zclconf/go-cty/cty" +) + +func TestDetailedDiffMap(t *testing.T) { + t.Parallel() + + attributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.MapAttribute{ + Optional: true, + ElementType: types.StringType, + }, + }, + } + + attributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.MapAttribute{ + Optional: true, + ElementType: types.StringType, + PlanModifiers: []planmodifier.Map{ + mapplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedAttributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.MapNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + }, + }, + } + + nestedAttributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.MapNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + PlanModifiers: []planmodifier.Map{ + mapplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedAttributeNestedReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.MapNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + }, + } + + attrMap := func(m *map[string]*string) cty.Value { + if m == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + if len(*m) == 0 { + return cty.MapValEmpty(cty.String) + } + values := make(map[string]cty.Value, len(*m)) + for k, v := range *m { + if v == nil { + values[k] = cty.NullVal(cty.String) + } else { + values[k] = cty.StringVal(*v) + } + } + return cty.MapVal(values) + } + + nestedAttrMap := func(m *map[string]*string) cty.Value { + if m == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + if len(*m) == 0 { + return cty.MapValEmpty(cty.Object(map[string]cty.Type{"nested": cty.String})) + } + values := make(map[string]cty.Value, len(*m)) + for k, v := range *m { + if v == nil { + values[k] = cty.NullVal(cty.DynamicPseudoType) + } else { + values[k] = cty.MapVal(map[string]cty.Value{ + "nested": cty.StringVal(*v), + }) + } + } + return cty.MapVal(values) + } + + schemaValueMakerPairs := []struct { + name string + schema rschema.Schema + valueMaker func(*map[string]*string) cty.Value + }{ + {"attribute no replace", attributeSchema, attrMap}, + {"attribute requires replace", attributeReplaceSchema, attrMap}, + {"nested attribute no replace", nestedAttributeSchema, nestedAttrMap}, + {"nested attribute requires replace", nestedAttributeReplaceSchema, nestedAttrMap}, + {"nested attribute nested requires replace", nestedAttributeNestedReplaceSchema, nestedAttrMap}, + } + + scenarios := []struct { + name string + initialValue *map[string]*string + changeValue *map[string]*string + }{ + {"unchanged null", nil, nil}, + {"unchanged empty", &map[string]*string{}, &map[string]*string{}}, + {"unchanged non-empty", &map[string]*string{"k": ref("value")}, &map[string]*string{"k": ref("value")}}, + {"added empty", nil, &map[string]*string{}}, + {"removed empty", &map[string]*string{}, nil}, + {"added non-empty", nil, &map[string]*string{"k": ref("value")}}, + {"removed non-empty", &map[string]*string{"k": ref("value")}, nil}, + {"unchanged null value", &map[string]*string{"k": nil}, &map[string]*string{"k": nil}}, + {"changed value non-null", &map[string]*string{"k": ref("value")}, &map[string]*string{"k": ref("value1")}}, + + // TODO[pulumi/pulumi-terraform-bridge#752]: Non-deterministic output + // {"changed value null to non-null", &map[string]*string{"k": nil}, &map[string]*string{"k": ref("value")}}, + // TODO[pulumi/pulumi-terraform-bridge#752]: We do not correctly identify the replace here. + // see pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null_to_null.golden + // {"changed value non-null to null", &map[string]*string{"k": ref("value")}, &map[string]*string{"k": nil}}, + } + + type testOutput struct { + initialValue *map[string]*string + changeValue *map[string]*string + tfOut string + pulumiOut string + } + + for _, schemaValueMakerPair := range schemaValueMakerPairs { + t.Run(schemaValueMakerPair.name, func(t *testing.T) { + t.Parallel() + for _, scenario := range scenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + initialValue := schemaValueMakerPair.valueMaker(scenario.initialValue) + changeValue := schemaValueMakerPair.valueMaker(scenario.changeValue) + + diff := crosstests.Diff(t, schemaValueMakerPair.schema, map[string]cty.Value{"key": initialValue}, map[string]cty.Value{"key": changeValue}) + + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + }) + }) + } + }) + } +} diff --git a/pkg/pf/tests/diff_object_test.go b/pkg/pf/tests/diff_object_test.go new file mode 100644 index 000000000..92a97a0be --- /dev/null +++ b/pkg/pf/tests/diff_object_test.go @@ -0,0 +1,362 @@ +package tfbridgetests + +import ( + "context" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-framework/attr" + rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/defaults" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hexops/autogold/v2" + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tests/internal/cross-tests" + "github.com/zclconf/go-cty/cty" +) + +type objectDefault basetypes.ObjectValue + +var _ defaults.Object = objectDefault{} + +func (o objectDefault) DefaultObject(ctx context.Context, req defaults.ObjectRequest, resp *defaults.ObjectResponse) { + resp.PlanValue = basetypes.ObjectValue(o) +} + +func (o objectDefault) PlanModifyObject(ctx context.Context, req planmodifier.ObjectRequest, resp *planmodifier.ObjectResponse) { + if req.PlanValue.IsNull() || req.PlanValue.IsUnknown() { + resp.PlanValue = basetypes.ObjectValue(o) + } +} + +func (o objectDefault) Description(ctx context.Context) string { + return "description" +} + +func (o objectDefault) MarkdownDescription(ctx context.Context) string { + return "markdown description" +} + +func TestDetailedDiffObject(t *testing.T) { + t.Parallel() + + attributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ObjectAttribute{ + Optional: true, + AttributeTypes: map[string]attr.Type{ + "nested": types.StringType, + }, + }, + }, + } + + attributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ObjectAttribute{ + Optional: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplace(), + }, + AttributeTypes: map[string]attr.Type{ + "nested": types.StringType, + }, + }, + }, + } + + objDef := basetypes.NewObjectValueMust(map[string]attr.Type{ + "nested": types.StringType, + }, map[string]attr.Value{ + "nested": basetypes.NewStringValue("default"), + }) + + attributeSchemaWithDefault := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ObjectAttribute{ + Optional: true, + Computed: true, + AttributeTypes: map[string]attr.Type{ + "nested": types.StringType, + }, + Default: objectDefault(objDef), + }, + }, + } + + attributeSchemaWithDefaultReplace := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ObjectAttribute{ + Optional: true, + Computed: true, + Default: objectDefault(objDef), + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplace(), + }, + AttributeTypes: map[string]attr.Type{ + "nested": types.StringType, + }, + }, + }, + } + + attributeSchemaWithPlanModifier := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ObjectAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectDefault(objDef), + }, + AttributeTypes: map[string]attr.Type{ + "nested": types.StringType, + }, + }, + }, + } + + attributeSchemaWithPlanModifierReplace := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.ObjectAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplace(), + objectDefault(objDef), + }, + AttributeTypes: map[string]attr.Type{ + "nested": types.StringType, + }, + }, + }, + } + + nestedBlockSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + }, + } + + nestedBlockReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + }, + }, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedBlockNestedReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + } + + nestedBlockWithDefaultSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + Computed: true, + Default: stringDefault("default"), + }, + }, + }, + }, + } + + nestedBlockWithDefaultReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + Computed: true, + Default: stringDefault("default"), + }, + }, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedBlockWithDefaultNestedReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + Computed: true, + Default: stringDefault("default"), + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + } + + nestedBlockWithPlanModifierSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringDefault("default"), + }, + }, + }, + }, + }, + } + + nestedBlockWithPlanModifierReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SingleNestedBlock{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringDefault("default"), + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + } + + makeValue := func(v *map[string]string) cty.Value { + if v == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + values := make(map[string]cty.Value, len(*v)) + for k, v := range *v { + values[k] = cty.StringVal(v) + } + return cty.ObjectVal(values) + } + + type namedSchema struct { + name string + schema rschema.Schema + } + + attrSchemas := []namedSchema{ + {"attribute no replace", attributeSchema}, + {"attribute requires replace", attributeReplaceSchema}, + {"attribute default no replace", attributeSchemaWithDefault}, + {"attribute default replace", attributeSchemaWithDefaultReplace}, + {"attribute plan modifier default", attributeSchemaWithPlanModifier}, + {"attribute plan modifier default replace", attributeSchemaWithPlanModifierReplace}, + } + + blockSchemas := []namedSchema{ + {"nested block no replace", nestedBlockSchema}, + {"nested block requires replace", nestedBlockReplaceSchema}, + {"nested block nested requires replace", nestedBlockNestedReplaceSchema}, + {"nested block default no replace", nestedBlockWithDefaultSchema}, + {"nested block default replace", nestedBlockWithDefaultReplaceSchema}, + {"nested block default nested replace", nestedBlockWithDefaultNestedReplaceSchema}, + {"nested block plan modifier no replace", nestedBlockWithPlanModifierSchema}, + {"nested block plan modifier replace", nestedBlockWithPlanModifierReplaceSchema}, + } + + schemas := append(attrSchemas, blockSchemas...) + + scenarios := []struct { + name string + initialValue *map[string]string + changeValue *map[string]string + }{ + {"unchanged null", nil, nil}, + {"unchanged non-empty", &map[string]string{"nested": "value"}, &map[string]string{"nested": "value"}}, + {"changed value non-null", &map[string]string{"nested": "value"}, &map[string]string{"nested": "changed"}}, + {"added", nil, &map[string]string{"nested": "value"}}, + {"removed", &map[string]string{"nested": "value"}, nil}, + } + + // Attribute objects can't be empty, but block objects can. + emptyBlockScenarios := []struct { + name string + initialValue *map[string]string + changeValue *map[string]string + }{ + {"unchanged empty", &map[string]string{}, &map[string]string{}}, + {"changed empty to non-empty", &map[string]string{}, &map[string]string{"nested": "value"}}, + {"changed non-empty to empty", &map[string]string{"nested": "value"}, &map[string]string{}}, + } + + type testOutput struct { + initialValue *map[string]string + changeValue *map[string]string + tfOut string + pulumiOut string + } + + for _, schema := range schemas { + t.Run(schema.name, func(t *testing.T) { + t.Parallel() + for _, scenario := range scenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + initialValue := map[string]cty.Value{"key": makeValue(scenario.initialValue)} + changeValue := map[string]cty.Value{"key": makeValue(scenario.changeValue)} + diff := crosstests.Diff(t, schema.schema, initialValue, changeValue) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + }) + }) + } + + if strings.Contains(schema.name, "block") { + for _, scenario := range emptyBlockScenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + initialValue := map[string]cty.Value{"key": makeValue(scenario.initialValue)} + changeValue := map[string]cty.Value{"key": makeValue(scenario.changeValue)} + diff := crosstests.Diff(t, schema.schema, initialValue, changeValue) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + }) + }) + } + } + }) + } +} diff --git a/pkg/pf/tests/diff_set_test.go b/pkg/pf/tests/diff_set_test.go new file mode 100644 index 000000000..a35f164db --- /dev/null +++ b/pkg/pf/tests/diff_set_test.go @@ -0,0 +1,242 @@ +package tfbridgetests + +import ( + "testing" + + rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hexops/autogold/v2" + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tests/internal/cross-tests" + "github.com/zclconf/go-cty/cty" +) + +func TestDetailedDiffSet(t *testing.T) { + t.Parallel() + + attributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetAttribute{ + Optional: true, + ElementType: types.StringType, + }, + }, + } + + attributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetAttribute{ + Optional: true, + ElementType: types.StringType, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedAttributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + }, + }, + } + + nestedAttributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.RequiresReplace(), + }, + }, + }, + } + + nestedAttributeNestedReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetNestedAttribute{ + Optional: true, + NestedObject: rschema.NestedAttributeObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + }, + } + + blockSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SetNestedBlock{ + NestedObject: rschema.NestedBlockObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{Optional: true}, + }, + }, + }, + }, + } + + blockReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SetNestedBlock{ + NestedObject: rschema.NestedBlockObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + }, + }, + }, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.RequiresReplace(), + }, + }, + }, + } + + blockNestedReplaceSchema := rschema.Schema{ + Blocks: map[string]rschema.Block{ + "key": rschema.SetNestedBlock{ + NestedObject: rschema.NestedBlockObject{ + Attributes: map[string]rschema.Attribute{ + "nested": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + }, + }, + }, + }, + } + + attrList := func(arr *[]string) cty.Value { + if arr == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + slice := make([]cty.Value, len(*arr)) + for i, v := range *arr { + slice[i] = cty.StringVal(v) + } + if len(slice) == 0 { + return cty.ListValEmpty(cty.String) + } + return cty.ListVal(slice) + } + + nestedAttrList := func(arr *[]string) cty.Value { + if arr == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + slice := make([]cty.Value, len(*arr)) + for i, v := range *arr { + slice[i] = cty.ObjectVal( + map[string]cty.Value{ + "nested": cty.StringVal(v), + }, + ) + } + if len(slice) == 0 { + return cty.ListValEmpty(cty.Object(map[string]cty.Type{"nested": cty.String})) + } + return cty.ListVal(slice) + } + + schemaValueMakerPairs := []struct { + name string + schema rschema.Schema + valueMaker func(*[]string) cty.Value + }{ + {"attribute no replace", attributeSchema, attrList}, + {"attribute requires replace", attributeReplaceSchema, attrList}, + {"nested attribute no replace", nestedAttributeSchema, nestedAttrList}, + {"nested attribute requires replace", nestedAttributeReplaceSchema, nestedAttrList}, + {"nested attribute nested requires replace", nestedAttributeNestedReplaceSchema, nestedAttrList}, + {"block no replace", blockSchema, nestedAttrList}, + {"block requires replace", blockReplaceSchema, nestedAttrList}, + {"block nested requires replace", blockNestedReplaceSchema, nestedAttrList}, + } + + scenarios := []struct { + name string + initialValue *[]string + changeValue *[]string + }{ + {"unchanged non-empty", &[]string{"value"}, &[]string{"value"}}, + {"unchanged empty", &[]string{}, &[]string{}}, + {"unchanged null", nil, nil}, + + {"changed non-null", &[]string{"value"}, &[]string{"value1"}}, + {"changed null to non-null", nil, &[]string{"value"}}, + {"changed non-null to null", &[]string{"value"}, nil}, + {"changed null to empty", nil, &[]string{}}, + {"changed empty to null", &[]string{}, nil}, + {"added", &[]string{}, &[]string{"value"}}, + {"removed", &[]string{"value"}, &[]string{}}, + {"removed front", &[]string{"val1", "val2", "val3"}, &[]string{"val2", "val3"}}, + {"removed front unordered", &[]string{"val2", "val3", "val1"}, &[]string{"val3", "val1"}}, + {"removed middle", &[]string{"val1", "val2", "val3"}, &[]string{"val1", "val3"}}, + {"removed middle unordered", &[]string{"val3", "val1", "val2"}, &[]string{"val3", "val1"}}, + {"removed end", &[]string{"val1", "val2", "val3"}, &[]string{"val1", "val2"}}, + {"removed end unordered", &[]string{"val2", "val3", "val1"}, &[]string{"val2", "val3"}}, + {"added front", &[]string{"val2", "val3"}, &[]string{"val1", "val2", "val3"}}, + {"added front unordered", &[]string{"val3", "val1"}, &[]string{"val2", "val3", "val1"}}, + {"added middle", &[]string{"val1", "val3"}, &[]string{"val1", "val2", "val3"}}, + {"added middle unordered", &[]string{"val2", "val1"}, &[]string{"val2", "val3", "val1"}}, + {"added end", &[]string{"val1", "val2"}, &[]string{"val1", "val2", "val3"}}, + {"added end unordered", &[]string{"val2", "val3"}, &[]string{"val2", "val3", "val1"}}, + {"shuffled", &[]string{"val1", "val2", "val3"}, &[]string{"val3", "val1", "val2"}}, + {"shuffled unordered", &[]string{"val2", "val3", "val1"}, &[]string{"val3", "val1", "val2"}}, + } + + type testOutput struct { + initialValue *[]string + changeValue *[]string + tfOut string + pulumiOut string + } + + for _, schemaValueMakerPair := range schemaValueMakerPairs { + t.Run(schemaValueMakerPair.name, func(t *testing.T) { + t.Parallel() + for _, scenario := range scenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + initialValue := schemaValueMakerPair.valueMaker(scenario.initialValue) + changeValue := schemaValueMakerPair.valueMaker(scenario.changeValue) + + diff := crosstests.Diff(t, schemaValueMakerPair.schema, map[string]cty.Value{"key": initialValue}, map[string]cty.Value{"key": changeValue}) + + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + }) + }) + } + }) + } + + // Both pulumi and TF do not allow duplicates in sets, so we don't test that here. +} diff --git a/pkg/pf/tests/diff_test.go b/pkg/pf/tests/diff_test.go index a3813e0d6..df4b83272 100644 --- a/pkg/pf/tests/diff_test.go +++ b/pkg/pf/tests/diff_test.go @@ -1,14 +1,21 @@ package tfbridgetests import ( + "context" "testing" rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/defaults" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hexops/autogold/v2" crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tests/internal/cross-tests" "github.com/zclconf/go-cty/cty" ) +func ref[T any](t T) *T { return &t } + func TestSimpleNoDiff(t *testing.T) { t.Parallel() @@ -40,12 +47,155 @@ Plan: 0 to add, 1 to change, 0 to destroy. `).Equal(t, res.TFOut) autogold.Expect(`Previewing update (test): - - ~ testprovider:index:Test p update [diff: ~key] - pulumi:pulumi:Stack project-test + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: "value" => "value1" Resources: ~ 1 to update 1 unchanged - `).Equal(t, res.PulumiOut) } + +type stringDefault string + +var _ defaults.String = stringDefault("default") + +func (s stringDefault) DefaultString(ctx context.Context, req defaults.StringRequest, resp *defaults.StringResponse) { + resp.PlanValue = basetypes.NewStringValue(string(s)) +} + +func (s stringDefault) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse) { + if req.PlanValue.IsNull() || req.PlanValue.IsUnknown() { + resp.PlanValue = basetypes.NewStringValue(string(s)) + } +} + +func (s stringDefault) Description(ctx context.Context) string { + return "description" +} + +func (s stringDefault) MarkdownDescription(ctx context.Context) string { + return "markdown description" +} + +func TestDetailedDiffStringAttribute(t *testing.T) { + t.Parallel() + + attributeSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.StringAttribute{Optional: true}, + }, + } + + attributeReplaceSchema := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + }, + }, + } + + attributeSchemaWithDefault := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.StringAttribute{ + Optional: true, + Computed: true, + Default: stringDefault("default"), + }, + }, + } + + attributeSchemaWithDefaultReplace := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.StringAttribute{ + Optional: true, + Computed: true, + Default: stringDefault("default"), + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + }, + }, + } + + attributeSchemaWitPlanModifierDefault := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{stringDefault("default")}, + }, + }, + } + + attributeSchemaWithPlanModifierDefaultReplace := rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{stringDefault("default"), stringplanmodifier.RequiresReplace()}, + }, + }, + } + + schemas := []struct { + name string + schema rschema.Schema + }{ + {"no replace", attributeSchema}, + {"replace", attributeReplaceSchema}, + {"default", attributeSchemaWithDefault}, + {"default replace", attributeSchemaWithDefaultReplace}, + {"plan modifier default", attributeSchemaWitPlanModifierDefault}, + {"plan modifier default replace", attributeSchemaWithPlanModifierDefaultReplace}, + } + + makeValue := func(s *string) cty.Value { + if s == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + return cty.StringVal(*s) + } + + scenarios := []struct { + name string + initialValue *string + changeValue *string + }{ + {"unchanged", ref("value"), ref("value")}, + {"changed", ref("value"), ref("value1")}, + {"added", nil, ref("value")}, + {"removed", ref("value"), nil}, + } + + type testOutput struct { + initialValue *string + changeValue *string + tfOut string + pulumiOut string + } + + for _, schema := range schemas { + t.Run(schema.name, func(t *testing.T) { + t.Parallel() + for _, scenario := range scenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + initialValue := makeValue(scenario.initialValue) + changeValue := makeValue(scenario.changeValue) + + res := crosstests.Diff(t, schema.schema, map[string]cty.Value{"key": initialValue}, map[string]cty.Value{"key": changeValue}) + + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: res.TFOut, + pulumiOut: res.PulumiOut, + }) + }) + } + }) + } +} diff --git a/pkg/pf/tests/internal/cross-tests/diff.go b/pkg/pf/tests/internal/cross-tests/diff.go index 4e6ea86cd..e4cf0595b 100644 --- a/pkg/pf/tests/internal/cross-tests/diff.go +++ b/pkg/pf/tests/internal/cross-tests/diff.go @@ -26,6 +26,7 @@ import ( "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tests/tfcheck" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info" + "github.com/pulumi/pulumi/sdk/v3/go/auto/optpreview" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/require" "github.com/zclconf/go-cty/cty" @@ -120,7 +121,7 @@ func Diff(t T, schema rschema.Schema, tfConfig1, tfConfig2 map[string]cty.Value, t.Logf("Pulumi.yaml:\n%s", string(bytes)) pt.WritePulumiYaml(t, string(bytes)) - previewRes := pt.Preview(t) + previewRes := pt.Preview(t, optpreview.Diff()) pulumiRes := pt.Up(t) diffResponse := crosstestsimpl.GetPulumiDiffResponse(t, pt.GrpcLog(t).Entries) diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added.golden new file mode 100644 index 000000000..080a4f237 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added.golden @@ -0,0 +1,35 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "value", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + + [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_end.golden new file mode 100644 index 000000000..81aa14abb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_end.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + # (1 unchanged element hidden) + "val2", + + "val3", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + [1]: "val2" + + [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_front.golden new file mode 100644 index 000000000..b4464760a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_front.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val1", + "val2", + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "val2" => "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_middle.golden new file mode 100644 index 000000000..f7853c7cc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/added_middle.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + "val1", + + "val2", + "val3", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..4d91bebc2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_empty_to_null.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_non-empty.golden new file mode 100644 index 000000000..af378f99c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + ~ "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "value" => "value1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..44360d62e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/changed_null_to_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_added.golden new file mode 100644 index 000000000..b39b417fb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_added.golden @@ -0,0 +1,42 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + "value", + + "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "value" + + [1]: "value1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_removed.golden new file mode 100644 index 000000000..1e116158e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/element_removed.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + changeValue: &[]string{"value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + "value", + - "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "value" + - [1]: "value1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/non-null_to_null.golden new file mode 100644 index 000000000..5785c8a5a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/non-null_to_null.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [ + - "value", + ] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_to_non-null.golden new file mode 100644 index 000000000..3197da8a2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_to_non-null.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [ + + "value", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [ + + [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed.golden new file mode 100644 index 000000000..caa6105c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "value", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_end.golden new file mode 100644 index 000000000..69cd5e3de --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_end.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + # (1 unchanged element hidden) + "val2", + - "val3", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + [1]: "val2" + - [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_front.golden new file mode 100644 index 000000000..4f2338830 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_front.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val1", + "val2", + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "val1" => "val2" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_middle.golden new file mode 100644 index 000000000..9ab50cff8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/removed_middle.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + "val1", + - "val2", + "val3", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added.golden new file mode 100644 index 000000000..b8147007b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added.golden @@ -0,0 +1,36 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_end.golden new file mode 100644 index 000000000..fae76654c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_end.golden @@ -0,0 +1,47 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + # (1 unchanged element hidden) + "val2", + + "val3", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + [1]: "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_front.golden new file mode 100644 index 000000000..9d4eb8866 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_front.golden @@ -0,0 +1,47 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val1", + "val2", + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "val2" => "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_middle.golden new file mode 100644 index 000000000..e9fcedec9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/added_middle.golden @@ -0,0 +1,47 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + "val1", + + "val2", + "val3", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..0efdba8c2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: &[]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [] -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_non-empty.golden new file mode 100644 index 000000000..1057614a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_non-empty.golden @@ -0,0 +1,38 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + ~ "value" -> "value1", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "value" => "value1" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..cd9cd38c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [] # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_added.golden new file mode 100644 index 000000000..f04e33b65 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_added.golden @@ -0,0 +1,43 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + "value", + + "value1", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "value" + + [1]: "value1" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_removed.golden new file mode 100644 index 000000000..3ae4b2f59 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/element_removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + "value", + - "value1", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "value" + - [1]: "value1" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/non-null_to_null.golden new file mode 100644 index 000000000..11161947b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/non-null_to_null.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [ # forces replacement + - "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [ + - [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_to_non-null.golden new file mode 100644 index 000000000..46264c13f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_to_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [ # forces replacement + + "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [ + + [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed.golden new file mode 100644 index 000000000..9df0f82a3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed.golden @@ -0,0 +1,38 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_end.golden new file mode 100644 index 000000000..01ad8f543 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_end.golden @@ -0,0 +1,47 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + # (1 unchanged element hidden) + "val2", + - "val3", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + [1]: "val2" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_front.golden new file mode 100644 index 000000000..27ef1d278 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_front.golden @@ -0,0 +1,47 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val1", + "val2", + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "val1" => "val2" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_middle.golden new file mode 100644 index 000000000..ad2d65387 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/removed_middle.golden @@ -0,0 +1,47 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + "val1", + - "val2", + "val3", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added.golden new file mode 100644 index 000000000..731b0675d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_end.golden new file mode 100644 index 000000000..d2e9664ab --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "val3" # forces replacement + } + + # (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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_front.golden new file mode 100644 index 000000000..11d8277ad --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_front.golden @@ -0,0 +1,58 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "val2" -> "val1" # forces replacement + } + ~ key { + ~ nested = "val3" -> "val2" # forces replacement + } + + key { + + nested = "val3" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_middle.golden new file mode 100644 index 000000000..e53c3c804 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/added_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "val3" -> "val2" # forces replacement + } + + key { + + nested = "val3" # forces replacement + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_non-empty.golden new file mode 100644 index 000000000..78496a5c0 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_non-empty.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "value" -> "value1" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..9cc2b128c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_added.golden new file mode 100644 index 000000000..164d3c7c8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_added.golden @@ -0,0 +1,49 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "value1" # forces replacement + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "value" + } + + [1]: { + + nested: "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_removed.golden new file mode 100644 index 000000000..271cc828c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/element_removed.golden @@ -0,0 +1,46 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + changeValue: &[]string{"value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value1" -> null + } + + # (1 unchanged block 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "value" + } + - [1]: { + - nested: "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/non-null_to_null.golden new file mode 100644 index 000000000..9f47e3a45 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/non-null_to_null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_to_non-null.golden new file mode 100644 index 000000000..b121f3912 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_to_non-null.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed.golden new file mode 100644 index 000000000..69321472e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_end.golden new file mode 100644 index 000000000..18b194f94 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val3" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_front.golden new file mode 100644 index 000000000..01f7e7d6d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_front.golden @@ -0,0 +1,58 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "val1" -> "val2" # forces replacement + } + ~ key { + ~ nested = "val2" -> "val3" # forces replacement + } + - key { + - nested = "val3" -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_middle.golden new file mode 100644 index 000000000..cdb9c9749 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/removed_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "val2" -> "val3" # forces replacement + } + - key { + - nested = "val3" -> null + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_nested_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added.golden new file mode 100644 index 000000000..a1a22e6cd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_end.golden new file mode 100644 index 000000000..cd5a85f19 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val3" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_front.golden new file mode 100644 index 000000000..fc3442057 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_front.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "val2" -> "val1" + } + ~ key { + ~ nested = "val3" -> "val2" + } + + key { + + nested = "val3" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_middle.golden new file mode 100644 index 000000000..34e6f4aec --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/added_middle.golden @@ -0,0 +1,56 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "val3" -> "val2" + } + + key { + + nested = "val3" + } + + # (1 unchanged block 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_non-empty.golden new file mode 100644 index 000000000..c2154626c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_non-empty.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..9cc2b128c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_added.golden new file mode 100644 index 000000000..ebcfcc2db --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_added.golden @@ -0,0 +1,48 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value1" + } + + # (1 unchanged block 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "value" + } + + [1]: { + + nested: "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_removed.golden new file mode 100644 index 000000000..271cc828c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/element_removed.golden @@ -0,0 +1,46 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + changeValue: &[]string{"value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value1" -> null + } + + # (1 unchanged block 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "value" + } + - [1]: { + - nested: "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/non-null_to_null.golden new file mode 100644 index 000000000..9f47e3a45 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/non-null_to_null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_to_non-null.golden new file mode 100644 index 000000000..e30c0dc9d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_to_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed.golden new file mode 100644 index 000000000..69321472e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_end.golden new file mode 100644 index 000000000..18b194f94 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val3" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_front.golden new file mode 100644 index 000000000..fe7d2ba9b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_front.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "val1" -> "val2" + } + ~ key { + ~ nested = "val2" -> "val3" + } + - key { + - nested = "val3" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_middle.golden new file mode 100644 index 000000000..4cd21a773 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/removed_middle.golden @@ -0,0 +1,56 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "val2" -> "val3" + } + - key { + - nested = "val3" -> null + } + + # (1 unchanged block 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added.golden new file mode 100644 index 000000000..4e6ad2ab5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_end.golden new file mode 100644 index 000000000..baccadb25 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_front.golden new file mode 100644 index 000000000..28b139b58 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_front.golden @@ -0,0 +1,58 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "val2" -> "val1" + } + ~ key { # forces replacement + ~ nested = "val3" -> "val2" + } + + key { # forces replacement + + nested = "val3" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_middle.golden new file mode 100644 index 000000000..6671644d1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/added_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "val3" -> "val2" + } + + key { # forces replacement + + nested = "val3" + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_non-empty.golden new file mode 100644 index 000000000..d9694c5fb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_non-empty.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "value" -> "value1" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..9cc2b128c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_added.golden new file mode 100644 index 000000000..8c4366545 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_added.golden @@ -0,0 +1,49 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # forces replacement + + nested = "value1" + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "value" + } + + [1]: { + + nested: "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_removed.golden new file mode 100644 index 000000000..441893afc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/element_removed.golden @@ -0,0 +1,47 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # forces replacement + - nested = "value1" -> null + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "value" + } + - [1]: { + - nested: "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/non-null_to_null.golden new file mode 100644 index 000000000..2e10a3e5a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/non-null_to_null.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_to_non-null.golden new file mode 100644 index 000000000..774cb199e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_to_non-null.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed.golden new file mode 100644 index 000000000..62a1435e6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_end.golden new file mode 100644 index 000000000..73754b83e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_front.golden new file mode 100644 index 000000000..56c90cc5a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_front.golden @@ -0,0 +1,58 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "val1" -> "val2" + } + ~ key { # forces replacement + ~ nested = "val2" -> "val3" + } + - key { # forces replacement + - nested = "val3" -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_middle.golden new file mode 100644 index 000000000..f31924cf1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/removed_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "val2" -> "val3" + } + - key { # forces replacement + - nested = "val3" -> null + } + + # (1 unchanged block 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/block_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added.golden new file mode 100644 index 000000000..22c3a47c6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_end.golden new file mode 100644 index 000000000..4758124de --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { + + nested = "val3" # forces replacement + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_front.golden new file mode 100644 index 000000000..a0afaa4bb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_front.golden @@ -0,0 +1,59 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + ~ { + ~ nested = "val2" -> "val1" # forces replacement + }, + ~ { + ~ nested = "val3" -> "val2" # forces replacement + }, + + { + + nested = "val3" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_middle.golden new file mode 100644 index 000000000..866a2d48a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/added_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + ~ { + ~ nested = "val3" -> "val2" # forces replacement + }, + + { + + nested = "val3" # forces replacement + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..4d91bebc2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_non-empty.golden new file mode 100644 index 000000000..8914ec411 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_non-empty.golden @@ -0,0 +1,42 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + ~ { + ~ nested = "value" -> "value1" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..44360d62e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_added.golden new file mode 100644 index 000000000..a59e6b2b7 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_added.golden @@ -0,0 +1,49 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { + + nested = "value1" # forces replacement + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "value" + } + + [1]: { + + nested: "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_removed.golden new file mode 100644 index 000000000..18fc5eaf9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/element_removed.golden @@ -0,0 +1,46 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + changeValue: &[]string{"value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value1" -> null + }, + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "value" + } + - [1]: { + - nested: "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/non-null_to_null.golden new file mode 100644 index 000000000..2d98e760f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/non-null_to_null.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [ + - { + - nested = "value" -> null + }, + ] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_to_non-null.golden new file mode 100644 index 000000000..dd32f5d43 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_to_non-null.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [ + + { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed.golden new file mode 100644 index 000000000..7e301fcb5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value" -> null + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_end.golden new file mode 100644 index 000000000..ae2534f61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val3" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_front.golden new file mode 100644 index 000000000..18a808fa9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_front.golden @@ -0,0 +1,59 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + ~ { + ~ nested = "val1" -> "val2" # forces replacement + }, + ~ { + ~ nested = "val2" -> "val3" # forces replacement + }, + - { + - nested = "val3" -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_middle.golden new file mode 100644 index 000000000..bec246c28 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/removed_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + ~ { + ~ nested = "val2" -> "val3" # forces replacement + }, + - { + - nested = "val3" -> null + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_nested_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added.golden new file mode 100644 index 000000000..f9ba01bd3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "value" + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_end.golden new file mode 100644 index 000000000..24a045a3b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val3" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_front.golden new file mode 100644 index 000000000..e46a1da38 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_front.golden @@ -0,0 +1,58 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + ~ { + ~ nested = "val2" -> "val1" + }, + ~ { + ~ nested = "val3" -> "val2" + }, + + { + + nested = "val3" + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_middle.golden new file mode 100644 index 000000000..05702818c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/added_middle.golden @@ -0,0 +1,56 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + ~ { + ~ nested = "val3" -> "val2" + }, + + { + + nested = "val3" + }, + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..4d91bebc2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_empty_to_null.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_non-empty.golden new file mode 100644 index 000000000..4c78736c6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_non-empty.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + ~ { + ~ nested = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..44360d62e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/changed_null_to_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_added.golden new file mode 100644 index 000000000..75d9a5845 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_added.golden @@ -0,0 +1,48 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "value1" + }, + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "value" + } + + [1]: { + + nested: "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_removed.golden new file mode 100644 index 000000000..18fc5eaf9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/element_removed.golden @@ -0,0 +1,46 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + changeValue: &[]string{"value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value1" -> null + }, + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "value" + } + - [1]: { + - nested: "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/non-null_to_null.golden new file mode 100644 index 000000000..2d98e760f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/non-null_to_null.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [ + - { + - nested = "value" -> null + }, + ] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_to_non-null.golden new file mode 100644 index 000000000..e229a0d48 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_to_non-null.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [ + + { + + nested = "value" + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed.golden new file mode 100644 index 000000000..7e301fcb5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value" -> null + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_end.golden new file mode 100644 index 000000000..ae2534f61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val3" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_front.golden new file mode 100644 index 000000000..70a38c679 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_front.golden @@ -0,0 +1,58 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + ~ { + ~ nested = "val1" -> "val2" + }, + ~ { + ~ nested = "val2" -> "val3" + }, + - { + - nested = "val3" -> null + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_middle.golden new file mode 100644 index 000000000..c31923f46 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/removed_middle.golden @@ -0,0 +1,56 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + ~ { + ~ nested = "val2" -> "val3" + }, + - { + - nested = "val3" -> null + }, + # (1 unchanged element 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added.golden new file mode 100644 index 000000000..2ecb284c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_end.golden new file mode 100644 index 000000000..7dcf9e038 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + { + + nested = "val3" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_front.golden new file mode 100644 index 000000000..17eeca8e9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_front.golden @@ -0,0 +1,59 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + ~ { + ~ nested = "val2" -> "val1" + }, + ~ { + ~ nested = "val3" -> "val2" + }, + + { + + nested = "val3" + }, + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_middle.golden new file mode 100644 index 000000000..b98154199 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/added_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + ~ { + ~ nested = "val3" -> "val2" + }, + + { + + nested = "val3" + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..0efdba8c2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: &[]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [] -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_non-empty.golden new file mode 100644 index 000000000..67ebdf219 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_non-empty.golden @@ -0,0 +1,42 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + ~ { + ~ nested = "value" -> "value1" + }, + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..cd9cd38c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [] # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_added.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_added.golden new file mode 100644 index 000000000..086a124aa --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_added.golden @@ -0,0 +1,49 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + changeValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + { + + nested = "value1" + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "value" + } + + [1]: { + + nested: "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_removed.golden new file mode 100644 index 000000000..112a92cec --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/element_removed.golden @@ -0,0 +1,47 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + "value1", + }, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - { + - nested = "value1" -> null + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "value" + } + - [1]: { + - nested: "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/non-null_to_null.golden new file mode 100644 index 000000000..5dbc23d04 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/non-null_to_null.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [ # forces replacement + - { + - nested = "value" -> null + }, + ] -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_to_non-null.golden new file mode 100644 index 000000000..5879ba814 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_to_non-null.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [ # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_unchanged.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/null_unchanged.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed.golden new file mode 100644 index 000000000..39cd9ea0a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed.golden @@ -0,0 +1,42 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_end.golden new file mode 100644 index 000000000..aef0fe63f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - { + - nested = "val3" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_front.golden new file mode 100644 index 000000000..9d0738c81 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_front.golden @@ -0,0 +1,59 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + ~ { + ~ nested = "val1" -> "val2" + }, + ~ { + ~ nested = "val2" -> "val3" + }, + - { + - nested = "val3" -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_middle.golden new file mode 100644 index 000000000..edc3fac9a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/removed_middle.golden @@ -0,0 +1,57 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + ~ { + ~ nested = "val2" -> "val3" + }, + - { + - nested = "val3" -> null + }, + # (1 unchanged element 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffList/nested_attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_empty.golden new file mode 100644 index 000000000..d208c03ce --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = {} + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: {} +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_non-empty.golden new file mode 100644 index 000000000..f2bd6ed61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/added_non-empty.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = { + + "k" = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + k: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..5c7c603d3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ "k" = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ k: "value" => "value1" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null_to_null.golden new file mode 100644 index 000000000..889154047 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_non-null_to_null.golden @@ -0,0 +1,33 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": nil}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ "k" = "value" -> null + } + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + + ~ testprovider:index:Test p update [diff: ~key] + pulumi:pulumi:Stack project-test +Resources: + ~ 1 to update + 1 unchanged + +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_null_to_non-null.golden new file mode 100644 index 000000000..99d404e10 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/changed_value_null_to_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": valast.Ptr("value")}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ "k" = null -> "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + + k: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_empty.golden new file mode 100644 index 000000000..7e8a0c39f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = {} -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: {} +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_non-empty.golden new file mode 100644 index 000000000..3f4393363 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/removed_non-empty.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = { + - "k" = "value" + } -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - k: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..69b62f222 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + changeValue: &map[string]*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/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..d5d9e02ac --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null_value.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null_value.golden new file mode 100644 index 000000000..f0ca34969 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_no_replace/unchanged_null_value.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": nil}, + 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/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_empty.golden new file mode 100644 index 000000000..0a461ceef --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = {} # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: {} +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_non-empty.golden new file mode 100644 index 000000000..a3a55786d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/added_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{ + "k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = { # forces replacement + + "k" = "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + k: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null.golden new file mode 100644 index 000000000..a078b5455 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("value1")}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ "k" = "value" -> "value1" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ k: "value" => "value1" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null_to_null.golden new file mode 100644 index 000000000..e7de015ef --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_non-null_to_null.golden @@ -0,0 +1,35 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": nil}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ "k" = "value" -> null + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + + ++ testprovider:index:Test p create replacement [diff: ~key] + +- testprovider:index:Test p replace [diff: ~key] + -- testprovider:index:Test p delete original [diff: ~key] + pulumi:pulumi:Stack project-test +Resources: + +-1 to replace + 1 unchanged + +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_null_to_non-null.golden new file mode 100644 index 000000000..902daa075 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/changed_value_null_to_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ "k" = null -> "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + + k: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_empty.golden new file mode 100644 index 000000000..b10bc9747 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = {} -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: {} +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_non-empty.golden new file mode 100644 index 000000000..b773a5d7a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/removed_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = { # forces replacement + - "k" = "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: { + - k: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..69b62f222 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + changeValue: &map[string]*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/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..d5d9e02ac --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null_value.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null_value.golden new file mode 100644 index 000000000..f0ca34969 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/attribute_requires_replace/unchanged_null_value.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": nil}, + 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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_empty.golden new file mode 100644 index 000000000..d208c03ce --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = {} + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: {} +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_non-empty.golden new file mode 100644 index 000000000..bf5f75b2a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/added_non-empty.golden @@ -0,0 +1,41 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{ + "k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = { + + "k" = { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + k: { + + nested: "value" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null.golden new file mode 100644 index 000000000..18f3aa548 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null.golden @@ -0,0 +1,42 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("value1")}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { + ~ "k" = { + ~ nested = "value" -> "value1" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ k: { + ~ nested: "value" => "value1" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null_to_null.golden new file mode 100644 index 000000000..076858b2a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_non-null_to_null.golden @@ -0,0 +1,35 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": nil}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { + ~ "k" = { + - nested = "value" -> null # forces replacement + }, + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + + ~ testprovider:index:Test p update [diff: ~key] + pulumi:pulumi:Stack project-test +Resources: + ~ 1 to update + 1 unchanged + +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_null_to_non-null.golden new file mode 100644 index 000000000..f8e8480ff --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/changed_value_null_to_non-null.golden @@ -0,0 +1,42 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { + + "k" = { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + + k: { + + nested: "value" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_empty.golden new file mode 100644 index 000000000..7e8a0c39f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = {} -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: {} +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_non-empty.golden new file mode 100644 index 000000000..20277086c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/removed_non-empty.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = { + - "k" = { + - nested = "value" -> null + }, + } -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - k: { + - nested: "value" + } + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..69b62f222 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + changeValue: &map[string]*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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..d5d9e02ac --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null_value.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null_value.golden new file mode 100644 index 000000000..f0ca34969 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_nested_requires_replace/unchanged_null_value.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": nil}, + 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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_empty.golden new file mode 100644 index 000000000..d208c03ce --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = {} + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: {} +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_non-empty.golden new file mode 100644 index 000000000..eec2af501 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/added_non-empty.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = { + + "k" = { + + nested = "value" + }, + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + k: { + + nested: "value" + } + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..f2c927093 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null.golden @@ -0,0 +1,41 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ "k" = { + ~ nested = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ k: { + ~ nested: "value" => "value1" + } + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null_to_null.golden new file mode 100644 index 000000000..28e44796e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_non-null_to_null.golden @@ -0,0 +1,35 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": nil}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ "k" = { + - nested = "value" -> null + }, + } + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + + ~ testprovider:index:Test p update [diff: ~key] + pulumi:pulumi:Stack project-test +Resources: + ~ 1 to update + 1 unchanged + +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_null_to_non-null.golden new file mode 100644 index 000000000..ef0dadc34 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/changed_value_null_to_non-null.golden @@ -0,0 +1,41 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": valast.Ptr("value")}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + + "k" = { + + nested = "value" + }, + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + + k: { + + nested: "value" + } + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_empty.golden new file mode 100644 index 000000000..7e8a0c39f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = {} -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: {} +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_non-empty.golden new file mode 100644 index 000000000..20277086c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/removed_non-empty.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = { + - "k" = { + - nested = "value" -> null + }, + } -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - k: { + - nested: "value" + } + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..69b62f222 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + changeValue: &map[string]*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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..d5d9e02ac --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null_value.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null_value.golden new file mode 100644 index 000000000..f0ca34969 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_no_replace/unchanged_null_value.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": nil}, + 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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_empty.golden new file mode 100644 index 000000000..799585edf --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = {} + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: {} +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_non-empty.golden new file mode 100644 index 000000000..15704df4a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/added_non-empty.golden @@ -0,0 +1,41 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]*string{ + "k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = { + + "k" = { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + k: { + + nested: "value" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null.golden new file mode 100644 index 000000000..463cd0483 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null.golden @@ -0,0 +1,42 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("value1")}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { + ~ "k" = { # forces replacement + ~ nested = "value" -> "value1" + }, + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ k: { + ~ nested: "value" => "value1" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null_to_null.golden new file mode 100644 index 000000000..80cc084e1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_non-null_to_null.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": nil}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { + ~ "k" = { # forces replacement + - nested = "value" -> null + }, + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + + ++ testprovider:index:Test p create replacement [diff: ~key] + +- testprovider:index:Test p replace [diff: ~key] + -- testprovider:index:Test p delete original [diff: ~key] + pulumi:pulumi:Stack project-test +Resources: + +-1 to replace + 1 unchanged + +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_null_to_non-null.golden new file mode 100644 index 000000000..ed5899f8f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/changed_value_null_to_non-null.golden @@ -0,0 +1,42 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { + + "k" = { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + + k: { + + nested: "value" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_empty.golden new file mode 100644 index 000000000..3074f7982 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = {} -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: {} +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_non-empty.golden new file mode 100644 index 000000000..d536353b2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/removed_non-empty.golden @@ -0,0 +1,41 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = { + - "k" = { # forces replacement + - nested = "value" -> null + }, + } -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: { + - k: { + - nested: "value" + } + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..69b62f222 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{}, + changeValue: &map[string]*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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..d5d9e02ac --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": valast.Ptr("value"), + }, + changeValue: &map[string]*string{"k": valast.Ptr("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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null_value.golden b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null_value.golden new file mode 100644 index 000000000..f0ca34969 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffMap/nested_attribute_requires_replace/unchanged_null_value.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]*string{ + "k": nil, + }, + changeValue: &map[string]*string{"k": nil}, + 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/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/added.golden new file mode 100644 index 000000000..c1252e51f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/added.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ nested = "default" -> "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..fababf92b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/changed_value_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ nested = "value" -> "changed" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/removed.golden new file mode 100644 index 000000000..b9fc14244 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/removed.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ nested = "value" -> "default" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/added.golden new file mode 100644 index 000000000..2023ceb39 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/added.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ nested = "default" -> "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "default" => "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/changed_value_non-null.golden new file mode 100644 index 000000000..875569edd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ nested = "value" -> "changed" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/removed.golden new file mode 100644 index 000000000..104d9e233 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ nested = "value" -> "default" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "default" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_default_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/added.golden new file mode 100644 index 000000000..560096bfe --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/added.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..fababf92b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/changed_value_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ nested = "value" -> "changed" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/removed.golden new file mode 100644 index 000000000..b4055abb5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/removed.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = { + - nested = "value" + } -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/added.golden new file mode 100644 index 000000000..c1252e51f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/added.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ nested = "default" -> "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/changed_value_non-null.golden new file mode 100644 index 000000000..fababf92b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/changed_value_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = { + ~ nested = "value" -> "changed" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/removed.golden new file mode 100644 index 000000000..e60cc6fdd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/removed.golden @@ -0,0 +1,17 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/added.golden new file mode 100644 index 000000000..2023ceb39 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/added.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ nested = "default" -> "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "default" => "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/changed_value_non-null.golden new file mode 100644 index 000000000..875569edd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ nested = "value" -> "changed" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/removed.golden new file mode 100644 index 000000000..e60cc6fdd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/removed.golden @@ -0,0 +1,17 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_plan_modifier_default_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/added.golden new file mode 100644 index 000000000..14d2b9272 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/added.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/changed_value_non-null.golden new file mode 100644 index 000000000..875569edd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = { # forces replacement + ~ nested = "value" -> "changed" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/removed.golden new file mode 100644 index 000000000..83778d4aa --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: { + - nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/attribute_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/added.golden new file mode 100644 index 000000000..88c28a8f6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..892b92473 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "default" -> "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "default" => "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..937cfa806 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "value" -> "default" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "default" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_value_non-null.golden new file mode 100644 index 000000000..38ebda758 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/changed_value_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "value" -> "changed" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/removed.golden new file mode 100644 index 000000000..a9a9d4a6c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_nested_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/added.golden new file mode 100644 index 000000000..e4750edf7 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/added.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..fa98aa877 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "default" -> "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..568c21cc1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "value" -> "default" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..8b54d4b2c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "value" -> "changed" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/removed.golden new file mode 100644 index 000000000..a9a9d4a6c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/added.golden new file mode 100644 index 000000000..13c880297 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..0ca76f549 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "default" -> "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "default" => "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..7afa72a50 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "value" -> "default" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "default" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_value_non-null.golden new file mode 100644 index 000000000..4b9e50587 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/changed_value_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "value" -> "changed" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/removed.golden new file mode 100644 index 000000000..ce09c71f5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/removed.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: { + - nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_default_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/added.golden new file mode 100644 index 000000000..88c28a8f6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..f07dd4f1a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..7bfbdd7ce --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + - nested = "value" -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + - nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_value_non-null.golden new file mode 100644 index 000000000..38ebda758 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/changed_value_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "value" -> "changed" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/removed.golden new file mode 100644 index 000000000..a9a9d4a6c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_nested_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/added.golden new file mode 100644 index 000000000..e4750edf7 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/added.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..f980a43ea --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..15b565881 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..8b54d4b2c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "value" -> "changed" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/removed.golden new file mode 100644 index 000000000..a9a9d4a6c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/added.golden new file mode 100644 index 000000000..e4750edf7 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/added.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..fa98aa877 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "value"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "default" -> "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + + nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..03ff0bb32 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_value_non-null.golden new file mode 100644 index 000000000..8b54d4b2c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/changed_value_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + ~ key { + ~ nested = "value" -> "changed" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/removed.golden new file mode 100644 index 000000000..a9a9d4a6c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/added.golden new file mode 100644 index 000000000..88c28a8f6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { + + nested = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..892b92473 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "default" -> "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "default" => "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..03ff0bb32 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_value_non-null.golden new file mode 100644 index 000000000..38ebda758 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/changed_value_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { + ~ nested = "value" -> "changed" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/removed.golden new file mode 100644 index 000000000..a9a9d4a6c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: { + - nested: "value" + } +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_plan_modifier_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/added.golden new file mode 100644 index 000000000..13c880297 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + changeValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_empty_to_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_empty_to_non-empty.golden new file mode 100644 index 000000000..0f5e14aeb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_empty_to_non-empty.golden @@ -0,0 +1,37 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + + nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_non-empty_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_non-empty_to_empty.golden new file mode 100644 index 000000000..ea47984d4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_non-empty_to_empty.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + - nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_value_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_value_non-null.golden new file mode 100644 index 000000000..4b9e50587 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/changed_value_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "changed"}, + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + ~ key { # forces replacement + ~ nested = "value" -> "changed" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: { + ~ nested: "value" => "changed" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/removed.golden new file mode 100644 index 000000000..ce09c71f5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/removed.golden @@ -0,0 +1,38 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: { + - nested: "value" + } +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..656fcd005 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]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/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..607ddd7a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.testOutput{ + initialValue: &map[string]string{ + "nested": "value", + }, + changeValue: &map[string]string{"nested": "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/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffObject/nested_block_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added.golden new file mode 100644 index 000000000..080a4f237 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added.golden @@ -0,0 +1,35 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "value", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + + [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end.golden new file mode 100644 index 000000000..7ccf6fab5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val3", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + [1]: "val2" + + [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end_unordered.golden new file mode 100644 index 000000000..906c8d3fb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_end_unordered.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val1", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val2" + [1]: "val3" + + [2]: "val1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front.golden new file mode 100644 index 000000000..470c6dfc5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val1", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "val2" => "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front_unordered.golden new file mode 100644 index 000000000..81a40f49c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_front_unordered.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val2", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "val3" => "val2" + ~ [1]: "val1" => "val3" + + [2]: "val1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle.golden new file mode 100644 index 000000000..5420a4f62 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val2", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle_unordered.golden new file mode 100644 index 000000000..f714d3971 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/added_middle_unordered.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + "val3", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val2" + ~ [1]: "val1" => "val3" + + [2]: "val1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..4d91bebc2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_empty_to_null.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null.golden new file mode 100644 index 000000000..69e027b27 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null.golden @@ -0,0 +1,38 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "value", + + "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "value" => "value1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..5785c8a5a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_non-null_to_null.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [ + - "value", + ] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..44360d62e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..3197da8a2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/changed_null_to_non-null.golden @@ -0,0 +1,36 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [ + + "value", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [ + + [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed.golden new file mode 100644 index 000000000..caa6105c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "value", + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: "value" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end.golden new file mode 100644 index 000000000..d1bb765eb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val3", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + [1]: "val2" + - [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end_unordered.golden new file mode 100644 index 000000000..a119081b4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_end_unordered.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val1", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val2" + [1]: "val3" + - [2]: "val1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front.golden new file mode 100644 index 000000000..f669b9535 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val1", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "val1" => "val2" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front_unordered.golden new file mode 100644 index 000000000..1572faa4f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_front_unordered.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val2", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: "val2" => "val3" + ~ [1]: "val3" => "val1" + - [2]: "val1" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle.golden new file mode 100644 index 000000000..9c755e00e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val2", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val1" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..1913f8822 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/removed_middle_unordered.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - "val2", + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: "val3" + [1]: "val1" + - [2]: "val2" + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added.golden new file mode 100644 index 000000000..b8147007b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added.golden @@ -0,0 +1,36 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end.golden new file mode 100644 index 000000000..6b2b078ed --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val3", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + [1]: "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end_unordered.golden new file mode 100644 index 000000000..849b0d725 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_end_unordered.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val1", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "val2" => "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front.golden new file mode 100644 index 000000000..8a0406393 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val1", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "val2" => "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front_unordered.golden new file mode 100644 index 000000000..c29272eef --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_front_unordered.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val2", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle.golden new file mode 100644 index 000000000..fd281cc29 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val2", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val3" => "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle_unordered.golden new file mode 100644 index 000000000..f0eb25620 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/added_middle_unordered.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + + "val3", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + [1]: "val2" + + [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..0efdba8c2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: &[]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [] -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null.golden new file mode 100644 index 000000000..5c1258311 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "value", + + "value1", + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "value" => "value1" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..11161947b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_non-null_to_null.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [ # forces replacement + - "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [ + - [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..cd9cd38c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [] # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..46264c13f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/changed_null_to_non-null.golden @@ -0,0 +1,37 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [ # forces replacement + + "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [ + + [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed.golden new file mode 100644 index 000000000..9df0f82a3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed.golden @@ -0,0 +1,38 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: "value" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end.golden new file mode 100644 index 000000000..45cb9b98a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val3", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + [1]: "val2" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end_unordered.golden new file mode 100644 index 000000000..6eb90f23b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_end_unordered.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val1", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "val1" => "val2" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front.golden new file mode 100644 index 000000000..bbb0857ed --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val1", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: "val1" => "val2" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front_unordered.golden new file mode 100644 index 000000000..bb2a8f1cd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_front_unordered.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val2", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle.golden new file mode 100644 index 000000000..084a5f4ff --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val2", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..5ad45cf8f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/removed_middle_unordered.golden @@ -0,0 +1,46 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ # forces replacement + - "val2", + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: "val1" + ~ [1]: "val2" => "val3" + - [2]: "val3" + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added.golden new file mode 100644 index 000000000..4e6ad2ab5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end.golden new file mode 100644 index 000000000..baccadb25 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end_unordered.golden new file mode 100644 index 000000000..5f2667de9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front.golden new file mode 100644 index 000000000..d494fec1a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front_unordered.golden new file mode 100644 index 000000000..b9ffa4674 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle.golden new file mode 100644 index 000000000..3be6033f8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle_unordered.golden new file mode 100644 index 000000000..932c10404 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/added_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null.golden new file mode 100644 index 000000000..b1c5a40ee --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null.golden @@ -0,0 +1,44 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # forces replacement + - nested = "value" -> null + } + + key { # forces replacement + + nested = "value1" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..9f47e3a45 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_non-null_to_null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..9cc2b128c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..774cb199e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/changed_null_to_non-null.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed.golden new file mode 100644 index 000000000..69321472e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end.golden new file mode 100644 index 000000000..18b194f94 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val3" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end_unordered.golden new file mode 100644 index 000000000..e8a27fcc3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front.golden new file mode 100644 index 000000000..67e0b6cde --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front_unordered.golden new file mode 100644 index 000000000..dfab2fb61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle.golden new file mode 100644 index 000000000..52268133a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..0217bd86f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/removed_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_nested_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added.golden new file mode 100644 index 000000000..a1a22e6cd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added.golden @@ -0,0 +1,38 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end.golden new file mode 100644 index 000000000..cd5a85f19 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val3" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end_unordered.golden new file mode 100644 index 000000000..c21075962 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_end_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val1" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val2" + } + [1]: { + nested: "val3" + } + + [2]: { + + nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front.golden new file mode 100644 index 000000000..0885bbc4c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val1" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front_unordered.golden new file mode 100644 index 000000000..ad2e67f21 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_front_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val2" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val3" => "val2" + } + ~ [1]: { + ~ nested: "val1" => "val3" + } + + [2]: { + + nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle.golden new file mode 100644 index 000000000..0fe0fcba3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val2" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle_unordered.golden new file mode 100644 index 000000000..f6473df60 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/added_middle_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "val3" + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val2" + } + ~ [1]: { + ~ nested: "val1" => "val3" + } + + [2]: { + + nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null.golden new file mode 100644 index 000000000..90ff7b8ed --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null.golden @@ -0,0 +1,43 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + + key { + + 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..9f47e3a45 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_non-null_to_null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..9cc2b128c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..e30c0dc9d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/changed_null_to_non-null.golden @@ -0,0 +1,39 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + + key { + + nested = "value" + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed.golden new file mode 100644 index 000000000..69321472e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "value" -> null + } + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end.golden new file mode 100644 index 000000000..18b194f94 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val3" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end_unordered.golden new file mode 100644 index 000000000..5b3ba35bd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_end_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val1" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val2" + } + [1]: { + nested: "val3" + } + - [2]: { + - nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front.golden new file mode 100644 index 000000000..14432c685 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val1" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front_unordered.golden new file mode 100644 index 000000000..5313deb5d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_front_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val2" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val3" + } + ~ [1]: { + ~ nested: "val3" => "val1" + } + - [2]: { + - nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle.golden new file mode 100644 index 000000000..5d9648920 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val2" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..4d07fab0a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/removed_middle_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + - key { + - nested = "val2" -> null + } + + # (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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val3" + } + [1]: { + nested: "val1" + } + - [2]: { + - nested: "val2" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added.golden new file mode 100644 index 000000000..4e6ad2ab5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end.golden new file mode 100644 index 000000000..baccadb25 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end_unordered.golden new file mode 100644 index 000000000..5f2667de9 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front.golden new file mode 100644 index 000000000..d494fec1a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front_unordered.golden new file mode 100644 index 000000000..b9ffa4674 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle.golden new file mode 100644 index 000000000..3be6033f8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle_unordered.golden new file mode 100644 index 000000000..932c10404 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/added_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null.golden new file mode 100644 index 000000000..b1c5a40ee --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null.golden @@ -0,0 +1,44 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # forces replacement + - nested = "value" -> null + } + + key { # forces replacement + + nested = "value1" + } + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..2e10a3e5a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_non-null_to_null.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..9cc2b128c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,15 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..774cb199e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/changed_null_to_non-null.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + + key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed.golden new file mode 100644 index 000000000..62a1435e6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end.golden new file mode 100644 index 000000000..73754b83e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end_unordered.golden new file mode 100644 index 000000000..e8a27fcc3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front.golden new file mode 100644 index 000000000..67e0b6cde --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front_unordered.golden new file mode 100644 index 000000000..dfab2fb61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle.golden new file mode 100644 index 000000000..52268133a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..0217bd86f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/removed_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + - key { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/block_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added.golden new file mode 100644 index 000000000..c879f76c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end.golden new file mode 100644 index 000000000..94ee47a68 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val3" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end_unordered.golden new file mode 100644 index 000000000..ea919c982 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val1" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front.golden new file mode 100644 index 000000000..7850dd046 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val1" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front_unordered.golden new file mode 100644 index 000000000..52e232af4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val2" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle.golden new file mode 100644 index 000000000..0032f4397 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val2" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle_unordered.golden new file mode 100644 index 000000000..235aec97d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/added_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val3" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..4d91bebc2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null.golden new file mode 100644 index 000000000..d11eeb52f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "value" -> null + }, + + { # forces replacement + + nested = "value1" + }, + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..2d98e760f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_non-null_to_null.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [ + - { + - nested = "value" -> null + }, + ] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..44360d62e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..402ec3020 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/changed_null_to_non-null.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [ + + { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed.golden new file mode 100644 index 000000000..7e301fcb5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value" -> null + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end.golden new file mode 100644 index 000000000..ae2534f61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val3" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end_unordered.golden new file mode 100644 index 000000000..3684414a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val1" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front.golden new file mode 100644 index 000000000..63cd22e5d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val1" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front_unordered.golden new file mode 100644 index 000000000..8d740de93 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle.golden new file mode 100644 index 000000000..c6d6e8c29 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..29e2cc032 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/removed_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_nested_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added.golden new file mode 100644 index 000000000..f9ba01bd3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added.golden @@ -0,0 +1,39 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "value" + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end.golden new file mode 100644 index 000000000..24a045a3b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val3" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end_unordered.golden new file mode 100644 index 000000000..47c79209f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_end_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val1" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val2" + } + [1]: { + nested: "val3" + } + + [2]: { + + nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front.golden new file mode 100644 index 000000000..9e5ae0673 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val1" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front_unordered.golden new file mode 100644 index 000000000..e6857a3ce --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_front_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val2" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val3" => "val2" + } + ~ [1]: { + ~ nested: "val1" => "val3" + } + + [2]: { + + nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle.golden new file mode 100644 index 000000000..8fb91efdc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val2" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle_unordered.golden new file mode 100644 index 000000000..6db7a66ce --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/added_middle_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + + { + + nested = "val3" + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val2" + } + ~ [1]: { + ~ nested: "val1" => "val3" + } + + [2]: { + + nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..4d91bebc2 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_empty_to_null.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null.golden new file mode 100644 index 000000000..3c577bca3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null.golden @@ -0,0 +1,44 @@ +tfbridgetests.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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value" -> null + }, + + { + + 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..2d98e760f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_non-null_to_null.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + initialValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = [ + - { + - nested = "value" -> null + }, + ] -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..44360d62e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_empty.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{}, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..e229a0d48 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/changed_null_to_non-null.golden @@ -0,0 +1,40 @@ +tfbridgetests.testOutput{ + changeValue: &[]string{ + "value", + }, + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = [ + + { + + nested = "value" + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed.golden new file mode 100644 index 000000000..7e301fcb5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "value" -> null + }, + ] + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end.golden new file mode 100644 index 000000000..ae2534f61 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val3" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end_unordered.golden new file mode 100644 index 000000000..cf6eefd3c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_end_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val1" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val2" + } + [1]: { + nested: "val3" + } + - [2]: { + - nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front.golden new file mode 100644 index 000000000..0c5207d38 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val1" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front_unordered.golden new file mode 100644 index 000000000..d834dfb7e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_front_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val3" + } + ~ [1]: { + ~ nested: "val3" => "val1" + } + - [2]: { + - nested: "val1" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle.golden new file mode 100644 index 000000000..3aaaff0a4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..136c0ea68 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/removed_middle_unordered.golden @@ -0,0 +1,53 @@ +tfbridgetests.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: + ~ update in-place + +Terraform will perform the following actions: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = [ + - { + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ keys: [ + [0]: { + nested: "val3" + } + [1]: { + nested: "val1" + } + - [2]: { + - nested: "val2" + } + ] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_no_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added.golden new file mode 100644 index 000000000..c879f76c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added.golden @@ -0,0 +1,40 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end.golden new file mode 100644 index 000000000..94ee47a68 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val3" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end_unordered.golden new file mode 100644 index 000000000..ea919c982 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val1" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front.golden new file mode 100644 index 000000000..7850dd046 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val1" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val2" => "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front_unordered.golden new file mode 100644 index 000000000..52e232af4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val2" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle.golden new file mode 100644 index 000000000..0032f4397 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val2" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val3" => "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle_unordered.golden new file mode 100644 index 000000000..235aec97d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/added_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + + { # forces replacement + + nested = "val3" + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + + [2]: { + + nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..fee94631d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_empty_to_null.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: &[]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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [] -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null.golden new file mode 100644 index 000000000..d11eeb52f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null.golden @@ -0,0 +1,45 @@ +tfbridgetests.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: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "value" -> null + }, + + { # forces replacement + + nested = "value1" + }, + ] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "value" => "value1" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..99f663984 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_non-null_to_null.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = [ + - { # forces replacement + - nested = "value" -> null + }, + ] -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..e600c1038 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [] + } + +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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..402ec3020 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/changed_null_to_non-null.golden @@ -0,0 +1,41 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = [ + + { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + keys: [ + + [0]: { + + nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed.golden new file mode 100644 index 000000000..519670600 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed.golden @@ -0,0 +1,42 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + - [0]: { + - nested: "value" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end.golden new file mode 100644 index 000000000..e523cde14 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val3" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + [1]: { + nested: "val2" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end_unordered.golden new file mode 100644 index 000000000..3684414a1 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_end_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val1" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front.golden new file mode 100644 index 000000000..63cd22e5d --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val1" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + ~ [0]: { + ~ nested: "val1" => "val2" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front_unordered.golden new file mode 100644 index 000000000..8d740de93 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_front_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle.golden new file mode 100644 index 000000000..c6d6e8c29 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..29e2cc032 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/removed_middle_unordered.golden @@ -0,0 +1,54 @@ +tfbridgetests.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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = [ + - { # forces replacement + - nested = "val2" -> null + }, + # (2 unchanged elements 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ keys: [ + [0]: { + nested: "val1" + } + ~ [1]: { + ~ nested: "val2" => "val3" + } + - [2]: { + - nested: "val3" + } + ] +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/shuffled_unordered.golden @@ -0,0 +1,24 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_empty.golden @@ -0,0 +1,16 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/nested_attribute_requires_replace/unchanged_null.golden @@ -0,0 +1,11 @@ +tfbridgetests.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/pf/tests/testdata/TestDetailedDiffStringAttribute/default/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/added.golden new file mode 100644 index 000000000..5f6bb3907 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/added.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: valast.Ptr("value"), + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = "default" -> "value" + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: "value" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/changed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/changed.golden new file mode 100644 index 000000000..023aad9ea --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/changed.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: "value" => "value1" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/removed.golden new file mode 100644 index 000000000..0b06434ed --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/removed.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = "value" -> "default" + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: "value" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/unchanged.golden new file mode 100644 index 000000000..81f624b9e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default/unchanged.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/added.golden new file mode 100644 index 000000000..fcfd8dac8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/added.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + changeValue: valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = "default" -> "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: "default" => "value" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/changed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/changed.golden new file mode 100644 index 000000000..0249956a6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/changed.golden @@ -0,0 +1,32 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("value1"), + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = "value" -> "value1" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: "value" => "value1" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/removed.golden new file mode 100644 index 000000000..bccb0d4bb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/removed.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = "value" -> "default" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: "value" => "default" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/unchanged.golden new file mode 100644 index 000000000..81f624b9e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/default_replace/unchanged.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/added.golden new file mode 100644 index 000000000..0bec01698 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/added.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: valast.Ptr("value"), + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + + key = "value" + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: "value" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/changed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/changed.golden new file mode 100644 index 000000000..023aad9ea --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/changed.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: "value" => "value1" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/removed.golden new file mode 100644 index 000000000..0814ae906 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/removed.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + - key = "value" -> null + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + - key: "value" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/unchanged.golden new file mode 100644 index 000000000..81f624b9e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/no_replace/unchanged.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/added.golden new file mode 100644 index 000000000..5f6bb3907 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/added.golden @@ -0,0 +1,30 @@ +tfbridgetests.testOutput{ + changeValue: valast.Ptr("value"), + 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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = "default" -> "value" + } + +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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + + key: "value" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/changed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/changed.golden new file mode 100644 index 000000000..023aad9ea --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/changed.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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: + + # testprovider_test.res will be updated in-place + ~ resource "testprovider_test" "res" { + id = "test-id" + ~ key = "value" -> "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] + ~ testprovider:index/test:Test: (update) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ key: "value" => "value1" +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/removed.golden new file mode 100644 index 000000000..1c7c6f3a0 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/removed.golden @@ -0,0 +1,15 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/unchanged.golden new file mode 100644 index 000000000..81f624b9e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default/unchanged.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/added.golden new file mode 100644 index 000000000..fcfd8dac8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/added.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + changeValue: valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = "default" -> "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: "default" => "value" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/changed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/changed.golden new file mode 100644 index 000000000..0249956a6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/changed.golden @@ -0,0 +1,32 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("value1"), + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = "value" -> "value1" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: "value" => "value1" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/removed.golden new file mode 100644 index 000000000..1c7c6f3a0 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/removed.golden @@ -0,0 +1,15 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/unchanged.golden new file mode 100644 index 000000000..81f624b9e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/plan_modifier_default_replace/unchanged.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/added.golden new file mode 100644 index 000000000..966e5c53b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/added.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + changeValue: valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + + key = "value" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + + key: "value" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/changed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/changed.golden new file mode 100644 index 000000000..0249956a6 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/changed.golden @@ -0,0 +1,32 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("value1"), + 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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + ~ key = "value" -> "value1" # 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + ~ key: "value" => "value1" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/removed.golden new file mode 100644 index 000000000..33a6ced23 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/removed.golden @@ -0,0 +1,31 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("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: + + # testprovider_test.res must be replaced ++/- resource "testprovider_test" "res" { + ~ id = "test-id" -> (known after apply) + - key = "value" -> 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] + +-testprovider:index/test:Test: (replace) + [id=test-id] + [urn=urn:pulumi:test::project::testprovider:index/test:Test::p] + ~ id : "test-id" => output + - key: "value" +Resources: + +-1 to replace + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/unchanged.golden b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/unchanged.golden new file mode 100644 index 000000000..81f624b9e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffStringAttribute/replace/unchanged.golden @@ -0,0 +1,16 @@ +tfbridgetests.testOutput{ + initialValue: valast.Ptr("value"), + changeValue: valast.Ptr("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 +`, +}