From fd5a1e85659a60960bb8f5e017b04f1539227f79 Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 19 Nov 2024 18:39:41 +0000 Subject: [PATCH] PF cross-tests for computed set attributes --- pkg/pf/tests/diff_set_test.go | 106 +++++++++++++++--- .../added.golden | 35 ++++++ .../added_end.golden | 45 ++++++++ .../added_end_unordered.golden | 45 ++++++++ .../added_front.golden | 45 ++++++++ .../added_front_unordered.golden | 45 ++++++++ .../added_middle.golden | 45 ++++++++ .../added_middle_unordered.golden | 45 ++++++++ .../changed_empty_to_null.golden | 15 +++ .../changed_non-null.golden | 38 +++++++ .../changed_non-null_to_null.golden | 17 +++ .../changed_null_to_empty.golden | 32 ++++++ .../changed_null_to_non-null.golden | 17 +++ .../removed.golden | 37 ++++++ .../removed_end.golden | 45 ++++++++ .../removed_end_unordered.golden | 45 ++++++++ .../removed_front.golden | 45 ++++++++ .../removed_front_unordered.golden | 45 ++++++++ .../removed_middle.golden | 45 ++++++++ .../removed_middle_unordered.golden | 45 ++++++++ .../shuffled.golden | 24 ++++ .../shuffled_unordered.golden | 24 ++++ .../unchanged_empty.golden | 16 +++ .../unchanged_non-empty.golden | 18 +++ .../unchanged_null.golden | 11 ++ .../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 | 15 +++ .../changed_non-null.golden | 39 +++++++ .../changed_non-null_to_null.golden | 17 +++ .../changed_null_to_empty.golden | 35 ++++++ .../changed_null_to_non-null.golden | 17 +++ .../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 ++ 49 files changed, 1758 insertions(+), 14 deletions(-) create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/unchanged_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_empty_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_non-null_to_null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_null_to_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_null_to_non-null.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_end.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_end_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_front.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_front_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_middle.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_middle_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/shuffled.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/shuffled_unordered.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/unchanged_empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/unchanged_non-empty.golden create mode 100644 pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/unchanged_null.golden diff --git a/pkg/pf/tests/diff_set_test.go b/pkg/pf/tests/diff_set_test.go index d93b5068e..c28511491 100644 --- a/pkg/pf/tests/diff_set_test.go +++ b/pkg/pf/tests/diff_set_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" @@ -151,7 +152,80 @@ func TestDetailedDiffSet(t *testing.T) { }, }) - computedCreateFunc := func(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + computedAttributeCreateFunc := func(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + type ObjectModel struct { + ID types.String `tfsdk:"id"` + Keys types.Set `tfsdk:"key"` + } + reqVal := ObjectModel{} + diags := req.Plan.Get(ctx, &reqVal) + contract.Assertf(diags.ErrorsCount() == 0, "failed to get attribute: %v", diags) + + respVal := ObjectModel{ + ID: types.StringValue("test-id"), + } + if reqVal.Keys.IsUnknown() { + respVal.Keys = types.SetValueMust(types.StringType, []attr.Value{ + types.StringValue("value"), + }) + } else { + respVal.Keys = reqVal.Keys + } + + diags = resp.State.Set(ctx, &respVal) + contract.Assertf(diags.ErrorsCount() == 0, "failed to set attribute: %v", diags) + } + + computedAttributeUpdateFunc := func(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + createResp := resource.CreateResponse{ + State: resp.State, + Diagnostics: resp.Diagnostics, + } + computedAttributeCreateFunc(ctx, resource.CreateRequest{ + Plan: req.Plan, + Config: req.Config, + ProviderMeta: req.ProviderMeta, + }, &createResp) + resp.State = createResp.State + resp.Diagnostics = createResp.Diagnostics + } + + computedSetAttributeSchema := pb.NewResource(pb.NewResourceArgs{ + ResourceSchema: rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetAttribute{ + Optional: true, + ElementType: types.StringType, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + }, + }, + }, + CreateFunc: computedAttributeCreateFunc, + UpdateFunc: computedAttributeUpdateFunc, + }) + + computedSetAttributeReplaceSchema := pb.NewResource(pb.NewResourceArgs{ + ResourceSchema: rschema.Schema{ + Attributes: map[string]rschema.Attribute{ + "key": rschema.SetAttribute{ + Optional: true, + ElementType: types.StringType, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.RequiresReplace(), + setplanmodifier.UseStateForUnknown(), + }, + }, + }, + }, + CreateFunc: computedAttributeCreateFunc, + UpdateFunc: computedAttributeUpdateFunc, + }) + + computedBlockCreateFunc := func(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { type Nested struct { Nested types.String `tfsdk:"nested"` Computed types.String `tfsdk:"computed"` @@ -192,12 +266,12 @@ func TestDetailedDiffSet(t *testing.T) { contract.Assertf(diags.ErrorsCount() == 0, "failed to set attribute: %v", diags) } - computedUpdateFunc := func(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + computedBlockUpdateFunc := func(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { createResp := resource.CreateResponse{ State: resp.State, Diagnostics: resp.Diagnostics, } - computedCreateFunc(ctx, resource.CreateRequest{ + computedBlockCreateFunc(ctx, resource.CreateRequest{ Plan: req.Plan, Config: req.Config, ProviderMeta: req.ProviderMeta, @@ -226,8 +300,8 @@ func TestDetailedDiffSet(t *testing.T) { }, }, }, - CreateFunc: computedCreateFunc, - UpdateFunc: computedUpdateFunc, + CreateFunc: computedBlockCreateFunc, + UpdateFunc: computedBlockUpdateFunc, }) blockSchemaWithComputedNoStateForUnknown := pb.NewResource(pb.NewResourceArgs{ @@ -246,8 +320,8 @@ func TestDetailedDiffSet(t *testing.T) { }, }, }, - CreateFunc: computedCreateFunc, - UpdateFunc: computedUpdateFunc, + CreateFunc: computedBlockCreateFunc, + UpdateFunc: computedBlockUpdateFunc, }) blockSchemaWithComputedReplace := pb.NewResource(pb.NewResourceArgs{ @@ -272,8 +346,8 @@ func TestDetailedDiffSet(t *testing.T) { }, }, }, - CreateFunc: computedCreateFunc, - UpdateFunc: computedUpdateFunc, + CreateFunc: computedBlockCreateFunc, + UpdateFunc: computedBlockUpdateFunc, }) blockSchemaWithComputedNestedReplace := pb.NewResource(pb.NewResourceArgs{ @@ -300,8 +374,8 @@ func TestDetailedDiffSet(t *testing.T) { }, }, }, - CreateFunc: computedCreateFunc, - UpdateFunc: computedUpdateFunc, + CreateFunc: computedBlockCreateFunc, + UpdateFunc: computedBlockUpdateFunc, }) blockSchemaWithComputedComputedRequiresReplace := pb.NewResource(pb.NewResourceArgs{ @@ -324,8 +398,8 @@ func TestDetailedDiffSet(t *testing.T) { }, }, }, - CreateFunc: computedCreateFunc, - UpdateFunc: computedUpdateFunc, + CreateFunc: computedBlockCreateFunc, + UpdateFunc: computedBlockUpdateFunc, }) attrList := func(arr *[]string) cty.Value { @@ -393,7 +467,11 @@ func TestDetailedDiffSet(t *testing.T) { {"block requires replace", blockReplaceSchema, nestedAttrList}, {"block nested requires replace", blockNestedReplaceSchema, nestedAttrList}, - // Computed, each state we test both the behaviour when the computed value is specified in the program and when it is not. + // Computed attributes + {"attribute with computed no replace", computedSetAttributeSchema, attrList}, + {"attribute with computed requires replace", computedSetAttributeReplaceSchema, attrList}, + + // Computed blocks, each state we test both the behaviour when the computed value is specified in the program and when it is not. {"block with computed no replace computed", blockSchemaWithComputed, nestedAttrList}, {"block with computed no replace computed specified in program", blockSchemaWithComputed, nestedAttrListWithComputedSpecified}, {"block with computed requires replace", blockSchemaWithComputedReplace, nestedAttrList}, diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added.golden new file mode 100644 index 000000000..080a4f237 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_end.golden new file mode 100644 index 000000000..7ccf6fab5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_end_unordered.golden new file mode 100644 index 000000000..906c8d3fb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_front.golden new file mode 100644 index 000000000..470c6dfc5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_front_unordered.golden new file mode 100644 index 000000000..81a40f49c --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_middle.golden new file mode 100644 index 000000000..5420a4f62 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/added_middle_unordered.golden new file mode 100644 index 000000000..f714d3971 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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/attribute_with_computed_no_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_non-null.golden new file mode 100644 index 000000000..69e027b27 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..74022ca51 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_non-null_to_null.golden @@ -0,0 +1,17 @@ +tfbridgetests.testOutput{ + initialValue: &[]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_with_computed_no_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..d4baaf763 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_empty.golden @@ -0,0 +1,32 @@ +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 = [ + - "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: [] +Resources: + ~ 1 to update + 1 unchanged +`, +} diff --git a/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..28bf51453 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/changed_null_to_non-null.golden @@ -0,0 +1,17 @@ +tfbridgetests.testOutput{ + 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_with_computed_no_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed.golden new file mode 100644 index 000000000..caa6105c4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_end.golden new file mode 100644 index 000000000..d1bb765eb --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_end_unordered.golden new file mode 100644 index 000000000..a119081b4 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_front.golden new file mode 100644 index 000000000..f669b9535 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_front_unordered.golden new file mode 100644 index 000000000..1572faa4f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_middle.golden new file mode 100644 index 000000000..9c755e00e --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..1913f8822 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_no_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_no_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added.golden new file mode 100644 index 000000000..b8147007b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_end.golden new file mode 100644 index 000000000..6b2b078ed --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_end_unordered.golden new file mode 100644 index 000000000..849b0d725 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_front.golden new file mode 100644 index 000000000..8a0406393 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_front_unordered.golden new file mode 100644 index 000000000..c29272eef --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_middle.golden new file mode 100644 index 000000000..fd281cc29 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/added_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/added_middle_unordered.golden new file mode 100644 index 000000000..f0eb25620 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/changed_empty_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_empty_to_null.golden new file mode 100644 index 000000000..7fb29dc92 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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/attribute_with_computed_requires_replace/changed_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_non-null.golden new file mode 100644 index 000000000..5c1258311 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/changed_non-null_to_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_non-null_to_null.golden new file mode 100644 index 000000000..74022ca51 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_non-null_to_null.golden @@ -0,0 +1,17 @@ +tfbridgetests.testOutput{ + initialValue: &[]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_with_computed_requires_replace/changed_null_to_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_null_to_empty.golden new file mode 100644 index 000000000..460a570c8 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_null_to_empty.golden @@ -0,0 +1,35 @@ +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 + - "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_with_computed_requires_replace/changed_null_to_non-null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_null_to_non-null.golden new file mode 100644 index 000000000..28bf51453 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/changed_null_to_non-null.golden @@ -0,0 +1,17 @@ +tfbridgetests.testOutput{ + 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_with_computed_requires_replace/removed.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed.golden new file mode 100644 index 000000000..9df0f82a3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/removed_end.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_end.golden new file mode 100644 index 000000000..45cb9b98a --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/removed_end_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_end_unordered.golden new file mode 100644 index 000000000..6eb90f23b --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/removed_front.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_front.golden new file mode 100644 index 000000000..bbb0857ed --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/removed_front_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_front_unordered.golden new file mode 100644 index 000000000..bb2a8f1cd --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/removed_middle.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_middle.golden new file mode 100644 index 000000000..084a5f4ff --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/removed_middle_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/removed_middle_unordered.golden new file mode 100644 index 000000000..5ad45cf8f --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/shuffled.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/shuffled.golden new file mode 100644 index 000000000..40cc0f9fc --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/shuffled_unordered.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/shuffled_unordered.golden new file mode 100644 index 000000000..158e21676 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/unchanged_empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/unchanged_empty.golden new file mode 100644 index 000000000..0ccb908d5 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/unchanged_non-empty.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/unchanged_non-empty.golden new file mode 100644 index 000000000..ccbeefd86 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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_with_computed_requires_replace/unchanged_null.golden b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_requires_replace/unchanged_null.golden new file mode 100644 index 000000000..78b0aa1b3 --- /dev/null +++ b/pkg/pf/tests/testdata/TestDetailedDiffSet/attribute_with_computed_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 +`}