From 12cbc25405197c2fb22bb347266f8dc6c907d77d Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 14 Jan 2025 12:33:53 +0200 Subject: [PATCH 1/7] SDKv2 Diff tests for primitive types --- ...diff_test.go => detailed_diff_map_test.go} | 52 ----- .../diff_test/detailed_diff_primitive_test.go | 180 ++++++++++++++++++ 2 files changed, 180 insertions(+), 52 deletions(-) rename pkg/tests/diff_test/{detailed_diff_test.go => detailed_diff_map_test.go} (61%) create mode 100644 pkg/tests/diff_test/detailed_diff_primitive_test.go diff --git a/pkg/tests/diff_test/detailed_diff_test.go b/pkg/tests/diff_test/detailed_diff_map_test.go similarity index 61% rename from pkg/tests/diff_test/detailed_diff_test.go rename to pkg/tests/diff_test/detailed_diff_map_test.go index 309cc2170..f632f85b3 100644 --- a/pkg/tests/diff_test/detailed_diff_test.go +++ b/pkg/tests/diff_test/detailed_diff_map_test.go @@ -10,58 +10,6 @@ import ( crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) -func TestSDKv2DetailedDiffString(t *testing.T) { - t.Parallel() - - res := schema.Resource{ - Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, - Optional: true, - }, - }, - } - - valueOne := ref("val1") - valueTwo := ref("val2") - var noValue *string - - ctyVal := func(v *string) map[string]cty.Value { - if v == nil { - return map[string]cty.Value{} - } - return map[string]cty.Value{ - "string_prop": cty.StringVal(*v), - } - } - - scenarios := []struct { - name string - initialValue *string - changeValue *string - }{ - {"unchanged empty", noValue, noValue}, - {"unchanged non-empty", valueOne, valueOne}, - {"added", noValue, valueOne}, - {"removed", valueOne, noValue}, - {"changed", valueOne, valueTwo}, - } - - for _, scenario := range scenarios { - t.Run(scenario.name, func(t *testing.T) { - t.Parallel() - diff := crosstests.Diff(t, &res, ctyVal(scenario.initialValue), ctyVal(scenario.changeValue)) - autogold.ExpectFile(t, testOutput{ - initialValue: scenario.initialValue, - changeValue: scenario.changeValue, - tfOut: diff.TFOut, - pulumiOut: diff.PulumiOut, - detailedDiff: diff.PulumiDiff.DetailedDiff, - }) - }) - } -} - func TestSDKv2DetailedDiffMap(t *testing.T) { t.Parallel() diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go new file mode 100644 index 000000000..e4a1e7f0f --- /dev/null +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -0,0 +1,180 @@ +package tests + +import ( + "context" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hexops/autogold/v2" + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" + "github.com/zclconf/go-cty/cty" +) + +func TestSDKv2DetailedDiffString(t *testing.T) { + t.Parallel() + + optionalSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Optional: true, + }, + }, + } + + optionalForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + }, + } + + requiredSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Required: true, + }, + }, + } + + requiredForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + ForceNew: true, + Required: true, + }, + }, + } + + setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + if d.Get("string_prop") == nil { + err := d.Set("string_prop", "computed") + if err != nil { + return diag.FromErr(err) + } + } + return nil + } + + optionalComputedSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { + rd.SetId("id") + return setComputedFunc(ctx, rd, i) + }, + UpdateContext: setComputedFunc, + } + + optionalComputedForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { + rd.SetId("id") + return setComputedFunc(ctx, rd, i) + }, + UpdateContext: setComputedFunc, + } + + optionalDefaultSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Optional: true, + Default: "default", + }, + }, + } + + optionalDefaultForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "string_prop": { + Type: schema.TypeString, + Optional: true, + Default: "default", + ForceNew: true, + }, + }, + } + + valueOne := ref("val1") + valueTwo := ref("val2") + var noValue *string + + ctyVal := func(v *string) map[string]cty.Value { + if v == nil { + return map[string]cty.Value{} + } + return map[string]cty.Value{ + "string_prop": cty.StringVal(*v), + } + } + + schemaValueMakerPairs := []struct { + name string + schema schema.Resource + valueMaker func(v *string) map[string]cty.Value + }{ + {"optional", optionalSchema, ctyVal}, + {"optionalForceNew", optionalForceNewSchema, ctyVal}, + {"required", requiredSchema, ctyVal}, + {"requiredForceNew", requiredForceNewSchema, ctyVal}, + {"optionalComputed", optionalComputedSchema, ctyVal}, + {"optionalComputedForceNew", optionalComputedForceNewSchema, ctyVal}, + {"optionalDefault", optionalDefaultSchema, ctyVal}, + {"optionalDefaultForceNew", optionalDefaultForceNewSchema, ctyVal}, + } + + scenarios := []struct { + name string + initialValue *string + changeValue *string + }{ + {"unchanged empty", noValue, noValue}, + {"unchanged non-empty", valueOne, valueOne}, + {"added", noValue, valueOne}, + {"removed", valueOne, noValue}, + {"changed", valueOne, valueTwo}, + } + + 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) { + if strings.Contains(schemaValueMakerPair.name, "required") && + (scenario.initialValue == nil || scenario.changeValue == nil) { + t.Skip("Required fields cannot be unset") + } + t.Parallel() + diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + detailedDiff: diff.PulumiDiff.DetailedDiff, + }) + }) + } + }) + } +} From 7bc66e2848317f308ee13ae98e0d1f3e44555c4c Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 14 Jan 2025 12:34:03 +0200 Subject: [PATCH 2/7] recordings --- .../{ => optional}/added.golden | 0 .../{ => optional}/changed.golden | 0 .../{ => optional}/removed.golden | 0 .../{ => optional}/unchanged_empty.golden | 0 .../{ => optional}/unchanged_non-empty.golden | 0 .../optionalComputed/added.golden | 31 +++++++++++++++++++ .../optionalComputed/changed.golden | 31 +++++++++++++++++++ .../optionalComputed/removed.golden | 15 +++++++++ .../optionalComputed/unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalComputedForceNew/added.golden | 31 +++++++++++++++++++ .../optionalComputedForceNew/changed.golden | 31 +++++++++++++++++++ .../optionalComputedForceNew/removed.golden | 15 +++++++++ .../unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalDefault/added.golden | 31 +++++++++++++++++++ .../optionalDefault/changed.golden | 31 +++++++++++++++++++ .../optionalDefault/removed.golden | 31 +++++++++++++++++++ .../optionalDefault/unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalDefaultForceNew/added.golden | 31 +++++++++++++++++++ .../optionalDefaultForceNew/changed.golden | 31 +++++++++++++++++++ .../optionalDefaultForceNew/removed.golden | 31 +++++++++++++++++++ .../unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalForceNew/added.golden | 31 +++++++++++++++++++ .../optionalForceNew/changed.golden | 31 +++++++++++++++++++ .../optionalForceNew/removed.golden | 31 +++++++++++++++++++ .../optionalForceNew/unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../required/changed.golden | 31 +++++++++++++++++++ .../required/unchanged_non-empty.golden | 15 +++++++++ .../requiredForceNew/changed.golden | 31 +++++++++++++++++++ .../unchanged_non-empty.golden | 15 +++++++++ 34 files changed, 675 insertions(+) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/added.golden (100%) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/changed.golden (100%) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/removed.golden (100%) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/unchanged_empty.golden (100%) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/unchanged_non-empty.golden (100%) create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden similarity index 100% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/added.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden similarity index 100% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/changed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden similarity index 100% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/removed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden similarity index 100% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_empty.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_non-empty.golden similarity index 100% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_non-empty.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_non-empty.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden new file mode 100644 index 000000000..0aa91d284 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: nil, changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + + string_prop = "val1" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + stringProp: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden new file mode 100644 index 000000000..005d2837e --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ string_prop = "val1" -> "val2" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden new file mode 100644 index 000000000..70b2c0ae5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..53d2a9794 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: nil, changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..dc26b5024 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: nil, changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + + string_prop = "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + stringProp: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..552a8d8b9 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ string_prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..70b2c0ae5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..53d2a9794 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: nil, changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden new file mode 100644 index 000000000..a84c2c706 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: nil, changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ string_prop = "default" -> "val1" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "default" => "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden new file mode 100644 index 000000000..d32fc8650 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ string_prop = "val1" -> "val2" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden new file mode 100644 index 000000000..86cdb286d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: 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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ string_prop = "val1" -> "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] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "default" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..53d2a9794 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: nil, changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..30db3713f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: nil, changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ string_prop = "default" -> "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "default" => "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..fadba5320 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ string_prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..52d848fa6 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: 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: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ string_prop = "val1" -> "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] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "default" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..53d2a9794 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: nil, changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden new file mode 100644 index 000000000..49c6d9d18 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: nil, changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + string_prop = "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + stringProp: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden new file mode 100644 index 000000000..fadba5320 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ string_prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden new file mode 100644 index 000000000..fe77717fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: 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: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - string_prop = "val1" -> null # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - stringProp: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..53d2a9794 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: nil, changeValue: 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/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden new file mode 100644 index 000000000..d32fc8650 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ string_prop = "val1" -> "val2" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden new file mode 100644 index 000000000..fadba5320 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ string_prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ stringProp: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} From 3f29961a4f520176589f33343887e6cd140dc517 Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 14 Jan 2025 12:38:43 +0200 Subject: [PATCH 3/7] fix comptued tests --- pkg/tests/diff_test/detailed_diff_primitive_test.go | 5 +++-- .../optionalComputed/added.golden | 6 +++--- .../optionalComputedForceNew/added.golden | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go index e4a1e7f0f..927946d5a 100644 --- a/pkg/tests/diff_test/detailed_diff_primitive_test.go +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -8,8 +8,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hexops/autogold/v2" - crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" "github.com/zclconf/go-cty/cty" + + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) func TestSDKv2DetailedDiffString(t *testing.T) { @@ -54,7 +55,7 @@ func TestSDKv2DetailedDiffString(t *testing.T) { } setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - if d.Get("string_prop") == nil { + if _, ok := d.GetOk("string_prop"); !ok { err := d.Set("string_prop", "computed") if err != nil { return diag.FromErr(err) diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden index 0aa91d284..bee51356c 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden @@ -10,7 +10,7 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { id = "id" - + string_prop = "val1" + ~ string_prop = "computed" -> "val1" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=id] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - + stringProp: "val1" + ~ stringProp: "computed" => "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{}}, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden index dc26b5024..5e666e16a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden @@ -10,7 +10,7 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { ~ id = "id" -> (known after apply) - + string_prop = "val1" # forces replacement + ~ string_prop = "computed" -> "val1" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=id] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - + stringProp: "val1" + ~ stringProp: "computed" => "val1" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "ADD_REPLACE"}}, + detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } From 0bc780fb545f6af250ddf6e27bab7bba498594dd Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 14 Jan 2025 13:03:48 +0200 Subject: [PATCH 4/7] finish coverage for int, bool and float --- .../diff_test/detailed_diff_primitive_test.go | 201 +++++++++++++----- pkg/tests/diff_test/value_makers.go | 17 +- 2 files changed, 162 insertions(+), 56 deletions(-) diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go index 927946d5a..3e9ede799 100644 --- a/pkg/tests/diff_test/detailed_diff_primitive_test.go +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -13,13 +13,26 @@ import ( crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) -func TestSDKv2DetailedDiffString(t *testing.T) { - t.Parallel() +func generatePrimitiveSchemaValueMakerPairs[T any]( + typ schema.ValueType, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, +) ([]diffSchemaValueMakerPair[T], []diffScenario[T]) { + valueOne := ref(val1) + valueTwo := ref(val2) + noValue := ref(nilVal) + + ctyVal := func(v *T) map[string]cty.Value { + if v == nil { + return map[string]cty.Value{} + } + return map[string]cty.Value{ + "prop": ctyMaker(*v), + } + } optionalSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Optional: true, }, }, @@ -27,8 +40,8 @@ func TestSDKv2DetailedDiffString(t *testing.T) { optionalForceNewSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Optional: true, ForceNew: true, }, @@ -37,8 +50,8 @@ func TestSDKv2DetailedDiffString(t *testing.T) { requiredSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Required: true, }, }, @@ -46,8 +59,8 @@ func TestSDKv2DetailedDiffString(t *testing.T) { requiredForceNewSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, ForceNew: true, Required: true, }, @@ -55,8 +68,8 @@ func TestSDKv2DetailedDiffString(t *testing.T) { } setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - if _, ok := d.GetOk("string_prop"); !ok { - err := d.Set("string_prop", "computed") + if _, ok := d.GetOk("prop"); !ok { + err := d.Set("prop", computedVal) if err != nil { return diag.FromErr(err) } @@ -66,8 +79,8 @@ func TestSDKv2DetailedDiffString(t *testing.T) { optionalComputedSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Optional: true, Computed: true, }, @@ -81,8 +94,8 @@ func TestSDKv2DetailedDiffString(t *testing.T) { optionalComputedForceNewSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Optional: true, Computed: true, ForceNew: true, @@ -97,64 +110,142 @@ func TestSDKv2DetailedDiffString(t *testing.T) { optionalDefaultSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Optional: true, - Default: "default", + Default: defaultVal, }, }, } optionalDefaultForceNewSchema := schema.Resource{ Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, + "prop": { + Type: typ, Optional: true, - Default: "default", + Default: defaultVal, ForceNew: true, }, }, } - valueOne := ref("val1") - valueTwo := ref("val2") - var noValue *string - - ctyVal := func(v *string) map[string]cty.Value { - if v == nil { - return map[string]cty.Value{} - } - return map[string]cty.Value{ - "string_prop": cty.StringVal(*v), + return []diffSchemaValueMakerPair[T]{ + {"optional", optionalSchema, ctyVal}, + {"optionalForceNew", optionalForceNewSchema, ctyVal}, + {"required", requiredSchema, ctyVal}, + {"requiredForceNew", requiredForceNewSchema, ctyVal}, + {"optionalComputed", optionalComputedSchema, ctyVal}, + {"optionalComputedForceNew", optionalComputedForceNewSchema, ctyVal}, + {"optionalDefault", optionalDefaultSchema, ctyVal}, + {"optionalDefaultForceNew", optionalDefaultForceNewSchema, ctyVal}, + }, []diffScenario[T]{ + {"unchanged empty", noValue, noValue}, + {"unchanged non-empty", valueOne, valueOne}, + {"added", noValue, valueOne}, + {"removed", valueOne, noValue}, + {"changed", valueOne, valueTwo}, } +} + +func TestSDKv2DetailedDiffString(t *testing.T) { + t.Parallel() + + var nilVal string + schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schema.TypeString, cty.StringVal, "val1", "val2", "computed", "default", nilVal) + + 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) { + if strings.Contains(schemaValueMakerPair.name, "required") && + (scenario.initialValue == nil || scenario.changeValue == nil) { + t.Skip("Required fields cannot be unset") + } + t.Parallel() + diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + detailedDiff: diff.PulumiDiff.DetailedDiff, + }) + }) + } + }) } +} - schemaValueMakerPairs := []struct { - name string - schema schema.Resource - valueMaker func(v *string) map[string]cty.Value - }{ - {"optional", optionalSchema, ctyVal}, - {"optionalForceNew", optionalForceNewSchema, ctyVal}, - {"required", requiredSchema, ctyVal}, - {"requiredForceNew", requiredForceNewSchema, ctyVal}, - {"optionalComputed", optionalComputedSchema, ctyVal}, - {"optionalComputedForceNew", optionalComputedForceNewSchema, ctyVal}, - {"optionalDefault", optionalDefaultSchema, ctyVal}, - {"optionalDefaultForceNew", optionalDefaultForceNewSchema, ctyVal}, +func TestSDKv2DetailedDiffBool(t *testing.T) { + t.Parallel() + + var nilVal bool + schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schema.TypeBool, cty.BoolVal, true, false, true, false, nilVal) + + 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) { + if strings.Contains(schemaValueMakerPair.name, "required") && + (scenario.initialValue == nil || scenario.changeValue == nil) { + t.Skip("Required fields cannot be unset") + } + t.Parallel() + diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + detailedDiff: diff.PulumiDiff.DetailedDiff, + }) + }) + } + }) } +} + +func TestSDKv2DetailedDiffInt(t *testing.T) { + t.Parallel() - scenarios := []struct { - name string - initialValue *string - changeValue *string - }{ - {"unchanged empty", noValue, noValue}, - {"unchanged non-empty", valueOne, valueOne}, - {"added", noValue, valueOne}, - {"removed", valueOne, noValue}, - {"changed", valueOne, valueTwo}, + var nilVal int64 + schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schema.TypeInt, cty.NumberIntVal, 1, 2, 3, 4, nilVal) + + 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) { + if strings.Contains(schemaValueMakerPair.name, "required") && + (scenario.initialValue == nil || scenario.changeValue == nil) { + t.Skip("Required fields cannot be unset") + } + t.Parallel() + diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + detailedDiff: diff.PulumiDiff.DetailedDiff, + }) + }) + } + }) } +} + +func TestSDKv2DetailedDiffFloat(t *testing.T) { + t.Parallel() + + var nilVal float64 + schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schema.TypeFloat, cty.NumberFloatVal, 1.0, 2.0, 3.0, 4.0, nilVal) for _, schemaValueMakerPair := range schemaValueMakerPairs { t.Run(schemaValueMakerPair.name, func(t *testing.T) { diff --git a/pkg/tests/diff_test/value_makers.go b/pkg/tests/diff_test/value_makers.go index fcb44f6eb..26faccb51 100644 --- a/pkg/tests/diff_test/value_makers.go +++ b/pkg/tests/diff_test/value_makers.go @@ -1,11 +1,26 @@ package tests -import "github.com/zclconf/go-cty/cty" +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/zclconf/go-cty/cty" +) func ref[T any](v T) *T { return &v } +type diffSchemaValueMakerPair[T any] struct { + name string + schema schema.Resource + valueMaker func(v *T) map[string]cty.Value +} + +type diffScenario[T any] struct { + name string + initialValue *T + changeValue *T +} + func listValueMaker(arr *[]string) cty.Value { if arr == nil { return cty.NullVal(cty.DynamicPseudoType) From d64a945fca3dbfab13d3a94831b51e9ae1386e27 Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 14 Jan 2025 13:03:56 +0200 Subject: [PATCH 5/7] recordings --- .../optional/added.golden | 31 ++++++++++++++++++ .../optional/changed.golden | 31 ++++++++++++++++++ .../optional/removed.golden | 31 ++++++++++++++++++ .../optional/unchanged_empty.golden | 15 +++++++++ .../optional/unchanged_non-empty.golden | 15 +++++++++ .../optionalComputed/added.golden | 15 +++++++++ .../optionalComputed/changed.golden | 31 ++++++++++++++++++ .../optionalComputed/removed.golden | 31 ++++++++++++++++++ .../optionalComputed/unchanged_empty.golden | 31 ++++++++++++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalComputedForceNew/added.golden | 15 +++++++++ .../optionalComputedForceNew/changed.golden | 31 ++++++++++++++++++ .../optionalComputedForceNew/removed.golden | 31 ++++++++++++++++++ .../unchanged_empty.golden | 31 ++++++++++++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalDefault/added.golden | 31 ++++++++++++++++++ .../optionalDefault/changed.golden | 31 ++++++++++++++++++ .../optionalDefault/removed.golden | 31 ++++++++++++++++++ .../optionalDefault/unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalDefaultForceNew/added.golden | 31 ++++++++++++++++++ .../optionalDefaultForceNew/changed.golden | 31 ++++++++++++++++++ .../optionalDefaultForceNew/removed.golden | 31 ++++++++++++++++++ .../unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optionalForceNew/added.golden | 31 ++++++++++++++++++ .../optionalForceNew/changed.golden | 31 ++++++++++++++++++ .../optionalForceNew/removed.golden | 31 ++++++++++++++++++ .../optionalForceNew/unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../required/added.golden | 31 ++++++++++++++++++ .../required/changed.golden | 31 ++++++++++++++++++ .../required/removed.golden | 31 ++++++++++++++++++ .../required/unchanged_empty.golden | 15 +++++++++ .../required/unchanged_non-empty.golden | 15 +++++++++ .../requiredForceNew/added.golden | 31 ++++++++++++++++++ .../requiredForceNew/changed.golden | 31 ++++++++++++++++++ .../requiredForceNew/removed.golden | 31 ++++++++++++++++++ .../requiredForceNew/unchanged_empty.golden | 15 +++++++++ .../unchanged_non-empty.golden | 15 +++++++++ .../optional/added.golden | 32 +++++++++++++++++++ .../optional/changed.golden | 32 +++++++++++++++++++ .../optional/removed.golden | 32 +++++++++++++++++++ .../optional/unchanged_empty.golden | 16 ++++++++++ .../optional/unchanged_non-empty.golden | 16 ++++++++++ .../optionalComputed/added.golden | 32 +++++++++++++++++++ .../optionalComputed/changed.golden | 32 +++++++++++++++++++ .../optionalComputed/removed.golden | 32 +++++++++++++++++++ .../optionalComputed/unchanged_empty.golden | 32 +++++++++++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalComputedForceNew/added.golden | 32 +++++++++++++++++++ .../optionalComputedForceNew/changed.golden | 32 +++++++++++++++++++ .../optionalComputedForceNew/removed.golden | 32 +++++++++++++++++++ .../unchanged_empty.golden | 32 +++++++++++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalDefault/added.golden | 32 +++++++++++++++++++ .../optionalDefault/changed.golden | 32 +++++++++++++++++++ .../optionalDefault/removed.golden | 32 +++++++++++++++++++ .../optionalDefault/unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalDefaultForceNew/added.golden | 32 +++++++++++++++++++ .../optionalDefaultForceNew/changed.golden | 32 +++++++++++++++++++ .../optionalDefaultForceNew/removed.golden | 32 +++++++++++++++++++ .../unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalForceNew/added.golden | 32 +++++++++++++++++++ .../optionalForceNew/changed.golden | 32 +++++++++++++++++++ .../optionalForceNew/removed.golden | 32 +++++++++++++++++++ .../optionalForceNew/unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../required/added.golden | 32 +++++++++++++++++++ .../required/changed.golden | 32 +++++++++++++++++++ .../required/removed.golden | 32 +++++++++++++++++++ .../required/unchanged_empty.golden | 16 ++++++++++ .../required/unchanged_non-empty.golden | 16 ++++++++++ .../requiredForceNew/added.golden | 32 +++++++++++++++++++ .../requiredForceNew/changed.golden | 32 +++++++++++++++++++ .../requiredForceNew/removed.golden | 32 +++++++++++++++++++ .../requiredForceNew/unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optional/added.golden | 32 +++++++++++++++++++ .../optional/changed.golden | 32 +++++++++++++++++++ .../optional/removed.golden | 32 +++++++++++++++++++ .../optional/unchanged_empty.golden | 16 ++++++++++ .../optional/unchanged_non-empty.golden | 16 ++++++++++ .../optionalComputed/added.golden | 32 +++++++++++++++++++ .../optionalComputed/changed.golden | 32 +++++++++++++++++++ .../optionalComputed/removed.golden | 32 +++++++++++++++++++ .../optionalComputed/unchanged_empty.golden | 32 +++++++++++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalComputedForceNew/added.golden | 32 +++++++++++++++++++ .../optionalComputedForceNew/changed.golden | 32 +++++++++++++++++++ .../optionalComputedForceNew/removed.golden | 32 +++++++++++++++++++ .../unchanged_empty.golden | 32 +++++++++++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalDefault/added.golden | 32 +++++++++++++++++++ .../optionalDefault/changed.golden | 32 +++++++++++++++++++ .../optionalDefault/removed.golden | 32 +++++++++++++++++++ .../optionalDefault/unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalDefaultForceNew/added.golden | 32 +++++++++++++++++++ .../optionalDefaultForceNew/changed.golden | 32 +++++++++++++++++++ .../optionalDefaultForceNew/removed.golden | 32 +++++++++++++++++++ .../unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optionalForceNew/added.golden | 32 +++++++++++++++++++ .../optionalForceNew/changed.golden | 32 +++++++++++++++++++ .../optionalForceNew/removed.golden | 32 +++++++++++++++++++ .../optionalForceNew/unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../required/added.golden | 32 +++++++++++++++++++ .../required/changed.golden | 32 +++++++++++++++++++ .../required/removed.golden | 32 +++++++++++++++++++ .../required/unchanged_empty.golden | 16 ++++++++++ .../required/unchanged_non-empty.golden | 16 ++++++++++ .../requiredForceNew/added.golden | 32 +++++++++++++++++++ .../requiredForceNew/changed.golden | 32 +++++++++++++++++++ .../requiredForceNew/removed.golden | 32 +++++++++++++++++++ .../requiredForceNew/unchanged_empty.golden | 16 ++++++++++ .../unchanged_non-empty.golden | 16 ++++++++++ .../optional/added.golden | 10 +++--- .../optional/changed.golden | 8 ++--- .../optional/removed.golden | 10 +++--- .../optional/unchanged_empty.golden | 2 +- .../optionalComputed/added.golden | 10 +++--- .../optionalComputed/changed.golden | 8 ++--- .../optionalComputed/removed.golden | 2 +- .../optionalComputed/unchanged_empty.golden | 2 +- .../optionalComputedForceNew/added.golden | 10 +++--- .../optionalComputedForceNew/changed.golden | 8 ++--- .../optionalComputedForceNew/removed.golden | 2 +- .../unchanged_empty.golden | 2 +- .../optionalDefault/added.golden | 10 +++--- .../optionalDefault/changed.golden | 8 ++--- .../optionalDefault/removed.golden | 10 +++--- .../optionalDefault/unchanged_empty.golden | 2 +- .../optionalDefaultForceNew/added.golden | 10 +++--- .../optionalDefaultForceNew/changed.golden | 8 ++--- .../optionalDefaultForceNew/removed.golden | 10 +++--- .../unchanged_empty.golden | 2 +- .../optionalForceNew/added.golden | 10 +++--- .../optionalForceNew/changed.golden | 8 ++--- .../optionalForceNew/removed.golden | 10 +++--- .../optionalForceNew/unchanged_empty.golden | 2 +- .../required/added.golden | 31 ++++++++++++++++++ .../required/changed.golden | 8 ++--- .../required/removed.golden | 31 ++++++++++++++++++ .../required/unchanged_empty.golden | 15 +++++++++ .../requiredForceNew/added.golden | 31 ++++++++++++++++++ .../requiredForceNew/changed.golden | 8 ++--- .../requiredForceNew/removed.golden | 31 ++++++++++++++++++ .../requiredForceNew/unchanged_empty.golden | 15 +++++++++ 152 files changed, 3340 insertions(+), 90 deletions(-) create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden new file mode 100644 index 000000000..cf38f6a37 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = false -> true + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden new file mode 100644 index 000000000..c4701d306 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden new file mode 100644 index 000000000..5f507c6b3 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden new file mode 100644 index 000000000..5f507c6b3 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..faa41da3d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..c4701d306 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..20b509a2c --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..20b509a2c --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..21e7d83be --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden new file mode 100644 index 000000000..cf38f6a37 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = false -> true + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..15dcbecee --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = false -> true # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden new file mode 100644 index 000000000..15dcbecee --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = false -> true # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden new file mode 100644 index 000000000..cf38f6a37 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = false -> true + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden new file mode 100644 index 000000000..15dcbecee --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = false -> true # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden new file mode 100644 index 000000000..cfad67fbc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden new file mode 100644 index 000000000..198764dfe --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden new file mode 100644 index 000000000..04796494b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden new file mode 100644 index 000000000..7ecf8f96a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden new file mode 100644 index 000000000..301fd66fc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden new file mode 100644 index 000000000..f7df7690b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..203f3e467 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..8d95a4556 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..31c7358fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..a27e88235 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..0e58c49fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden new file mode 100644 index 000000000..cfad67fbc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden new file mode 100644 index 000000000..198764dfe --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden new file mode 100644 index 000000000..04796494b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..0aa06cbd0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..330e15834 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..42cd5eb89 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden new file mode 100644 index 000000000..0aa06cbd0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden new file mode 100644 index 000000000..330e15834 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden new file mode 100644 index 000000000..42cd5eb89 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden new file mode 100644 index 000000000..cfad67fbc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden new file mode 100644 index 000000000..198764dfe --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden new file mode 100644 index 000000000..04796494b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden new file mode 100644 index 000000000..0aa06cbd0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden new file mode 100644 index 000000000..330e15834 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden new file mode 100644 index 000000000..42cd5eb89 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden new file mode 100644 index 000000000..eb372e44d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden new file mode 100644 index 000000000..f0564af44 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden new file mode 100644 index 000000000..32ac766b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden new file mode 100644 index 000000000..094ac1be0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden new file mode 100644 index 000000000..8143d2da5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden new file mode 100644 index 000000000..2a33bbd30 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..5450a0ee5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..8100f7b6f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..186276491 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..d94315fd4 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..6710e22dd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden new file mode 100644 index 000000000..eb372e44d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden new file mode 100644 index 000000000..f0564af44 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden new file mode 100644 index 000000000..32ac766b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..57bb555b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..553434587 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..4f9a5c0fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden new file mode 100644 index 000000000..57bb555b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden new file mode 100644 index 000000000..553434587 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden new file mode 100644 index 000000000..4f9a5c0fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden new file mode 100644 index 000000000..eb372e44d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden new file mode 100644 index 000000000..f0564af44 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden new file mode 100644 index 000000000..32ac766b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden new file mode 100644 index 000000000..57bb555b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden new file mode 100644 index 000000000..553434587 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden new file mode 100644 index 000000000..4f9a5c0fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden index 94ba38c16..020e01e29 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - + string_prop = "val1" + id = "newid" + + prop = "val1" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - + stringProp: "val1" + + prop: "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden index d32fc8650..3f412d2d5 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ string_prop = "val1" -> "val2" + id = "newid" + ~ prop = "val1" -> "val2" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden index e57708505..6d6cd3873 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - - string_prop = "val1" -> null + id = "newid" + - prop = "val1" -> null } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - - stringProp: "val1" + - prop: "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "DELETE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden index bee51356c..b81c5b64c 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "id" - ~ string_prop = "computed" -> "val1" + id = "id" + ~ prop = "computed" -> "val1" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=id] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "computed" => "val1" + ~ prop: "computed" => "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden index 005d2837e..c0073f39b 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "id" - ~ string_prop = "val1" -> "val2" + id = "id" + ~ prop = "val1" -> "val2" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=id] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden index 70b2c0ae5..8a0ae1c46 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden index 5e666e16a..360c94faa 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "id" -> (known after apply) - ~ string_prop = "computed" -> "val1" # forces replacement + ~ id = "id" -> (known after apply) + ~ prop = "computed" -> "val1" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=id] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "computed" => "val1" + ~ prop: "computed" => "val1" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden index 552a8d8b9..81ed8eb9b 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "id" -> (known after apply) - ~ string_prop = "val1" -> "val2" # forces replacement + ~ id = "id" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=id] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden index 70b2c0ae5..8a0ae1c46 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden index a84c2c706..020e01e29 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ string_prop = "default" -> "val1" + id = "newid" + + prop = "val1" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "default" => "val1" + + prop: "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden index d32fc8650..3f412d2d5 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ string_prop = "val1" -> "val2" + id = "newid" + ~ prop = "val1" -> "val2" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden index 86cdb286d..6d6cd3873 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ string_prop = "val1" -> "default" + id = "newid" + - prop = "val1" -> null } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "default" + - prop: "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden index 30db3713f..009b6d471 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - ~ string_prop = "default" -> "val1" # forces replacement + ~ id = "newid" -> (known after apply) + + prop = "val1" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "default" => "val1" + + prop: "val1" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden index fadba5320..58402aee8 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - ~ string_prop = "val1" -> "val2" # forces replacement + ~ id = "newid" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden index 52d848fa6..deef631dd 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - ~ string_prop = "val1" -> "default" # forces replacement + ~ id = "newid" -> (known after apply) + - prop = "val1" -> null # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "default" + - prop: "val1" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden index 49c6d9d18..009b6d471 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - + string_prop = "val1" # forces replacement + ~ id = "newid" -> (known after apply) + + prop = "val1" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - + stringProp: "val1" + + prop: "val1" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "ADD_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden index fadba5320..58402aee8 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - ~ string_prop = "val1" -> "val2" # forces replacement + ~ id = "newid" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden index fe77717fd..deef631dd 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - - string_prop = "val1" -> null # forces replacement + ~ id = "newid" -> (known after apply) + - prop = "val1" -> null # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - - stringProp: "val1" + - prop: "val1" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "DELETE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden new file mode 100644 index 000000000..020e01e29 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + prop = "val1" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden index d32fc8650..3f412d2d5 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ string_prop = "val1" -> "val2" + id = "newid" + ~ prop = "val1" -> "val2" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden new file mode 100644 index 000000000..6d6cd3873 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + - prop = "val1" -> 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] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden new file mode 100644 index 000000000..009b6d471 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + prop = "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden index fadba5320..58402aee8 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example must be replaced +/- resource "crossprovider_test_res" "example" { - ~ id = "newid" -> (known after apply) - ~ string_prop = "val1" -> "val2" # forces replacement + ~ id = "newid" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement } Plan: 1 to add, 0 to change, 1 to destroy. @@ -22,10 +22,10 @@ Plan: 1 to add, 0 to change, 1 to destroy. +-crossprovider:index/testRes:TestRes: (replace) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: +-1 to replace 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden new file mode 100644 index 000000000..deef631dd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = "val1" -> null # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + 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 +`, +} From 6058e946d8d47622c27d3c91f161f17ae19b6f0d Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 14 Jan 2025 13:41:22 +0200 Subject: [PATCH 6/7] move and rename test generation function --- .../diff_test/detailed_diff_primitive_test.go | 144 +----------------- pkg/tests/diff_test/value_makers.go | 137 +++++++++++++++++ 2 files changed, 141 insertions(+), 140 deletions(-) diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go index 3e9ede799..adcc50412 100644 --- a/pkg/tests/diff_test/detailed_diff_primitive_test.go +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -1,11 +1,9 @@ package tests import ( - "context" "strings" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hexops/autogold/v2" "github.com/zclconf/go-cty/cty" @@ -13,145 +11,11 @@ import ( crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) -func generatePrimitiveSchemaValueMakerPairs[T any]( - typ schema.ValueType, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, -) ([]diffSchemaValueMakerPair[T], []diffScenario[T]) { - valueOne := ref(val1) - valueTwo := ref(val2) - noValue := ref(nilVal) - - ctyVal := func(v *T) map[string]cty.Value { - if v == nil { - return map[string]cty.Value{} - } - return map[string]cty.Value{ - "prop": ctyMaker(*v), - } - } - - optionalSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Optional: true, - }, - }, - } - - optionalForceNewSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Optional: true, - ForceNew: true, - }, - }, - } - - requiredSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Required: true, - }, - }, - } - - requiredForceNewSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - ForceNew: true, - Required: true, - }, - }, - } - - setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - if _, ok := d.GetOk("prop"); !ok { - err := d.Set("prop", computedVal) - if err != nil { - return diag.FromErr(err) - } - } - return nil - } - - optionalComputedSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Optional: true, - Computed: true, - }, - }, - CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { - rd.SetId("id") - return setComputedFunc(ctx, rd, i) - }, - UpdateContext: setComputedFunc, - } - - optionalComputedForceNewSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { - rd.SetId("id") - return setComputedFunc(ctx, rd, i) - }, - UpdateContext: setComputedFunc, - } - - optionalDefaultSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Optional: true, - Default: defaultVal, - }, - }, - } - - optionalDefaultForceNewSchema := schema.Resource{ - Schema: map[string]*schema.Schema{ - "prop": { - Type: typ, - Optional: true, - Default: defaultVal, - ForceNew: true, - }, - }, - } - - return []diffSchemaValueMakerPair[T]{ - {"optional", optionalSchema, ctyVal}, - {"optionalForceNew", optionalForceNewSchema, ctyVal}, - {"required", requiredSchema, ctyVal}, - {"requiredForceNew", requiredForceNewSchema, ctyVal}, - {"optionalComputed", optionalComputedSchema, ctyVal}, - {"optionalComputedForceNew", optionalComputedForceNewSchema, ctyVal}, - {"optionalDefault", optionalDefaultSchema, ctyVal}, - {"optionalDefaultForceNew", optionalDefaultForceNewSchema, ctyVal}, - }, []diffScenario[T]{ - {"unchanged empty", noValue, noValue}, - {"unchanged non-empty", valueOne, valueOne}, - {"added", noValue, valueOne}, - {"removed", valueOne, noValue}, - {"changed", valueOne, valueTwo}, - } -} - func TestSDKv2DetailedDiffString(t *testing.T) { t.Parallel() var nilVal string - schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeString, cty.StringVal, "val1", "val2", "computed", "default", nilVal) for _, schemaValueMakerPair := range schemaValueMakerPairs { @@ -182,7 +46,7 @@ func TestSDKv2DetailedDiffBool(t *testing.T) { t.Parallel() var nilVal bool - schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeBool, cty.BoolVal, true, false, true, false, nilVal) for _, schemaValueMakerPair := range schemaValueMakerPairs { @@ -213,7 +77,7 @@ func TestSDKv2DetailedDiffInt(t *testing.T) { t.Parallel() var nilVal int64 - schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeInt, cty.NumberIntVal, 1, 2, 3, 4, nilVal) for _, schemaValueMakerPair := range schemaValueMakerPairs { @@ -244,7 +108,7 @@ func TestSDKv2DetailedDiffFloat(t *testing.T) { t.Parallel() var nilVal float64 - schemaValueMakerPairs, scenarios := generatePrimitiveSchemaValueMakerPairs( + schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeFloat, cty.NumberFloatVal, 1.0, 2.0, 3.0, 4.0, nilVal) for _, schemaValueMakerPair := range schemaValueMakerPairs { diff --git a/pkg/tests/diff_test/value_makers.go b/pkg/tests/diff_test/value_makers.go index 26faccb51..4c80ed90f 100644 --- a/pkg/tests/diff_test/value_makers.go +++ b/pkg/tests/diff_test/value_makers.go @@ -1,6 +1,9 @@ package tests import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/zclconf/go-cty/cty" ) @@ -21,6 +24,140 @@ type diffScenario[T any] struct { changeValue *T } +func generateBaseTests[T any]( + typ schema.ValueType, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, +) ([]diffSchemaValueMakerPair[T], []diffScenario[T]) { + valueOne := ref(val1) + valueTwo := ref(val2) + noValue := ref(nilVal) + + ctyVal := func(v *T) map[string]cty.Value { + if v == nil { + return map[string]cty.Value{} + } + return map[string]cty.Value{ + "prop": ctyMaker(*v), + } + } + + optionalSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + }, + }, + } + + optionalForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + ForceNew: true, + }, + }, + } + + requiredSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Required: true, + }, + }, + } + + requiredForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + ForceNew: true, + Required: true, + }, + }, + } + + setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + if _, ok := d.GetOk("prop"); !ok { + err := d.Set("prop", computedVal) + if err != nil { + return diag.FromErr(err) + } + } + return nil + } + + optionalComputedSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Computed: true, + }, + }, + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { + rd.SetId("id") + return setComputedFunc(ctx, rd, i) + }, + UpdateContext: setComputedFunc, + } + + optionalComputedForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { + rd.SetId("id") + return setComputedFunc(ctx, rd, i) + }, + UpdateContext: setComputedFunc, + } + + optionalDefaultSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Default: defaultVal, + }, + }, + } + + optionalDefaultForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Default: defaultVal, + ForceNew: true, + }, + }, + } + + return []diffSchemaValueMakerPair[T]{ + {"optional", optionalSchema, ctyVal}, + {"optionalForceNew", optionalForceNewSchema, ctyVal}, + {"required", requiredSchema, ctyVal}, + {"requiredForceNew", requiredForceNewSchema, ctyVal}, + {"optionalComputed", optionalComputedSchema, ctyVal}, + {"optionalComputedForceNew", optionalComputedForceNewSchema, ctyVal}, + {"optionalDefault", optionalDefaultSchema, ctyVal}, + {"optionalDefaultForceNew", optionalDefaultForceNewSchema, ctyVal}, + }, []diffScenario[T]{ + {"unchanged empty", noValue, noValue}, + {"unchanged non-empty", valueOne, valueOne}, + {"added", noValue, valueOne}, + {"removed", valueOne, noValue}, + {"changed", valueOne, valueTwo}, + } +} + func listValueMaker(arr *[]string) cty.Value { if arr == nil { return cty.NullVal(cty.DynamicPseudoType) From 05799fe81e09b1c8fb4db3859fc8cee63e1112a5 Mon Sep 17 00:00:00 2001 From: Venelin Date: Wed, 15 Jan 2025 13:59:50 +0200 Subject: [PATCH 7/7] factor out a runTestMatrix function --- .../diff_test/detailed_diff_primitive_test.go | 96 +------------------ pkg/tests/diff_test/value_makers.go | 34 +++++++ 2 files changed, 38 insertions(+), 92 deletions(-) diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go index adcc50412..cf684ec93 100644 --- a/pkg/tests/diff_test/detailed_diff_primitive_test.go +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -1,14 +1,10 @@ package tests import ( - "strings" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hexops/autogold/v2" "github.com/zclconf/go-cty/cty" - - crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) func TestSDKv2DetailedDiffString(t *testing.T) { @@ -18,28 +14,7 @@ func TestSDKv2DetailedDiffString(t *testing.T) { schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeString, cty.StringVal, "val1", "val2", "computed", "default", nilVal) - 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) { - if strings.Contains(schemaValueMakerPair.name, "required") && - (scenario.initialValue == nil || scenario.changeValue == nil) { - t.Skip("Required fields cannot be unset") - } - t.Parallel() - diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) - autogold.ExpectFile(t, testOutput{ - initialValue: scenario.initialValue, - changeValue: scenario.changeValue, - tfOut: diff.TFOut, - pulumiOut: diff.PulumiOut, - detailedDiff: diff.PulumiDiff.DetailedDiff, - }) - }) - } - }) - } + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } func TestSDKv2DetailedDiffBool(t *testing.T) { @@ -49,28 +24,7 @@ func TestSDKv2DetailedDiffBool(t *testing.T) { schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeBool, cty.BoolVal, true, false, true, false, nilVal) - 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) { - if strings.Contains(schemaValueMakerPair.name, "required") && - (scenario.initialValue == nil || scenario.changeValue == nil) { - t.Skip("Required fields cannot be unset") - } - t.Parallel() - diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) - autogold.ExpectFile(t, testOutput{ - initialValue: scenario.initialValue, - changeValue: scenario.changeValue, - tfOut: diff.TFOut, - pulumiOut: diff.PulumiOut, - detailedDiff: diff.PulumiDiff.DetailedDiff, - }) - }) - } - }) - } + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } func TestSDKv2DetailedDiffInt(t *testing.T) { @@ -80,28 +34,7 @@ func TestSDKv2DetailedDiffInt(t *testing.T) { schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeInt, cty.NumberIntVal, 1, 2, 3, 4, nilVal) - 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) { - if strings.Contains(schemaValueMakerPair.name, "required") && - (scenario.initialValue == nil || scenario.changeValue == nil) { - t.Skip("Required fields cannot be unset") - } - t.Parallel() - diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) - autogold.ExpectFile(t, testOutput{ - initialValue: scenario.initialValue, - changeValue: scenario.changeValue, - tfOut: diff.TFOut, - pulumiOut: diff.PulumiOut, - detailedDiff: diff.PulumiDiff.DetailedDiff, - }) - }) - } - }) - } + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } func TestSDKv2DetailedDiffFloat(t *testing.T) { @@ -111,26 +44,5 @@ func TestSDKv2DetailedDiffFloat(t *testing.T) { schemaValueMakerPairs, scenarios := generateBaseTests( schema.TypeFloat, cty.NumberFloatVal, 1.0, 2.0, 3.0, 4.0, nilVal) - 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) { - if strings.Contains(schemaValueMakerPair.name, "required") && - (scenario.initialValue == nil || scenario.changeValue == nil) { - t.Skip("Required fields cannot be unset") - } - t.Parallel() - diff := crosstests.Diff(t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), schemaValueMakerPair.valueMaker(scenario.changeValue)) - autogold.ExpectFile(t, testOutput{ - initialValue: scenario.initialValue, - changeValue: scenario.changeValue, - tfOut: diff.TFOut, - pulumiOut: diff.PulumiOut, - detailedDiff: diff.PulumiDiff.DetailedDiff, - }) - }) - } - }) - } + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } diff --git a/pkg/tests/diff_test/value_makers.go b/pkg/tests/diff_test/value_makers.go index 4c80ed90f..50b2924f8 100644 --- a/pkg/tests/diff_test/value_makers.go +++ b/pkg/tests/diff_test/value_makers.go @@ -2,10 +2,15 @@ package tests import ( "context" + "strings" + "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hexops/autogold/v2" "github.com/zclconf/go-cty/cty" + + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) func ref[T any](v T) *T { @@ -24,6 +29,35 @@ type diffScenario[T any] struct { changeValue *T } +func runSDKv2TestMatrix[T any]( + t *testing.T, schemaValueMakerPairs []diffSchemaValueMakerPair[T], scenarios []diffScenario[T], +) { + 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() + if strings.Contains(schemaValueMakerPair.name, "required") && + (scenario.initialValue == nil || scenario.changeValue == nil) { + t.Skip("Required fields cannot be unset") + } + diff := crosstests.Diff( + t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), + schemaValueMakerPair.valueMaker(scenario.changeValue)) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + detailedDiff: diff.PulumiDiff.DetailedDiff, + }) + }) + } + }) + } +} + func generateBaseTests[T any]( typ schema.ValueType, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, ) ([]diffSchemaValueMakerPair[T], []diffScenario[T]) {