diff --git a/pkg/tests/diff_test/detailed_diff_map_test.go b/pkg/tests/diff_test/detailed_diff_map_test.go index f632f85b3..f7d0148d5 100644 --- a/pkg/tests/diff_test/detailed_diff_map_test.go +++ b/pkg/tests/diff_test/detailed_diff_map_test.go @@ -4,66 +4,34 @@ import ( "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 TestSDKv2DetailedDiffMap(t *testing.T) { t.Parallel() - res := schema.Resource{ - Schema: map[string]*schema.Schema{ - "map_prop": { - Type: schema.TypeMap, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - }, - } - - ctyVal := func(v map[string]string) map[string]cty.Value { - ctyMap := make(map[string]cty.Value) - + ctyMaker := func(v map[string]string) cty.Value { if len(v) == 0 { - return map[string]cty.Value{ - "map_prop": cty.MapValEmpty(cty.String), - } + return cty.MapValEmpty(cty.String) } - + ctyMap := make(map[string]cty.Value) for k, v := range v { ctyMap[k] = cty.StringVal(v) } - return map[string]cty.Value{ - "map_prop": cty.MapVal(ctyMap), - } + return cty.MapVal(ctyMap) } - scenarios := []struct { - name string - initialValue map[string]string - changeValue map[string]string - }{ - {"unchanged empty", map[string]string{}, map[string]string{}}, - {"unchanged non-empty", map[string]string{"key": "val"}, map[string]string{"key": "val"}}, - {"added", map[string]string{}, map[string]string{"key": "val"}}, - {"removed", map[string]string{"key": "val"}, map[string]string{}}, - {"value changed", map[string]string{"key": "val"}, map[string]string{"key": "val2"}}, - {"key changed", map[string]string{"key": "val"}, map[string]string{"key2": "val"}}, - } + var nilVal map[string]string + schemaValueMakerPairs, scenarios := generateBaseTests( + schema.TypeMap, &schema.Schema{Type: schema.TypeString}, ctyMaker, + map[string]string{"key": "val1"}, map[string]string{"key": "val2"}, + map[string]string{"key": "computedVal"}, map[string]string{"key": "defaultVal"}, nilVal) - 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, - }) - }) - } + scenarios = append(scenarios, diffScenario[map[string]string]{ + name: "key changed", + initialValue: ref(map[string]string{"key": "val1"}), + changeValue: ref(map[string]string{"key2": "val1"}), + }) + + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go index cf684ec93..5f2385b21 100644 --- a/pkg/tests/diff_test/detailed_diff_primitive_test.go +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -12,7 +12,7 @@ func TestSDKv2DetailedDiffString(t *testing.T) { var nilVal string schemaValueMakerPairs, scenarios := generateBaseTests( - schema.TypeString, cty.StringVal, "val1", "val2", "computed", "default", nilVal) + schema.TypeString, nil, cty.StringVal, "val1", "val2", "computed", "default", nilVal) runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } @@ -22,7 +22,7 @@ func TestSDKv2DetailedDiffBool(t *testing.T) { var nilVal bool schemaValueMakerPairs, scenarios := generateBaseTests( - schema.TypeBool, cty.BoolVal, true, false, true, false, nilVal) + schema.TypeBool, nil, cty.BoolVal, true, false, true, false, nilVal) runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } @@ -32,7 +32,7 @@ func TestSDKv2DetailedDiffInt(t *testing.T) { var nilVal int64 schemaValueMakerPairs, scenarios := generateBaseTests( - schema.TypeInt, cty.NumberIntVal, 1, 2, 3, 4, nilVal) + schema.TypeInt, nil, cty.NumberIntVal, 1, 2, 3, 4, nilVal) runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } @@ -42,7 +42,7 @@ func TestSDKv2DetailedDiffFloat(t *testing.T) { var nilVal float64 schemaValueMakerPairs, scenarios := generateBaseTests( - schema.TypeFloat, cty.NumberFloatVal, 1.0, 2.0, 3.0, 4.0, nilVal) + schema.TypeFloat, nil, cty.NumberFloatVal, 1.0, 2.0, 3.0, 4.0, nilVal) runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/added.golden similarity index 73% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/added.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/added.golden index cc55fbc40..9a561c17a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/added.golden @@ -1,6 +1,6 @@ tests.testOutput{ - initialValue: map[string]string{}, - changeValue: map[string]string{"key": "val"}, + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "val1"}, tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -10,9 +10,9 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - + map_prop = { - + "key" = "val" + id = "newid" + + prop = { + + "key" = "val1" } } @@ -25,12 +25,12 @@ 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] - + mapProp: { - + key: "val" + + prop: { + + key: "val1" } Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"mapProp": map[string]interface{}{}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/value_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/changed.golden similarity index 69% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/value_changed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/changed.golden index 3edd45c2c..ab640a690 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/value_changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/changed.golden @@ -1,8 +1,8 @@ tests.testOutput{ - initialValue: map[string]string{ - "key": "val", + initialValue: &map[string]string{ + "key": "val1", }, - changeValue: map[string]string{"key": "val2"}, + changeValue: &map[string]string{"key": "val2"}, tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -12,9 +12,9 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ map_prop = { - ~ "key" = "val" -> "val2" + id = "newid" + ~ prop = { + ~ "key" = "val1" -> "val2" } } @@ -27,12 +27,12 @@ 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] - ~ mapProp: { - ~ key: "val" => "val2" + ~ prop: { + ~ key: "val1" => "val2" } Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"mapProp.key": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/key_changed.golden similarity index 68% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/key_changed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/key_changed.golden index 2193f1ef6..82d0977ec 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/key_changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/key_changed.golden @@ -1,8 +1,8 @@ tests.testOutput{ - initialValue: map[string]string{ - "key": "val", + initialValue: &map[string]string{ + "key": "val1", }, - changeValue: map[string]string{"key2": "val"}, + changeValue: &map[string]string{"key2": "val1"}, tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -12,10 +12,10 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ map_prop = { - - "key" = "val" -> null - + "key2" = "val" + id = "newid" + ~ prop = { + - "key" = "val1" -> null + + "key2" = "val1" } } @@ -28,16 +28,16 @@ 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] - ~ mapProp: { - - key : "val" - + key2: "val" + ~ prop: { + - key : "val1" + + key2: "val1" } Resources: ~ 1 to update 1 unchanged `, detailedDiff: map[string]interface{}{ - "mapProp.key": map[string]interface{}{"kind": "DELETE"}, - "mapProp.key2": map[string]interface{}{}, + "prop.key": map[string]interface{}{"kind": "DELETE"}, + "prop.key2": map[string]interface{}{}, }, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/removed.golden similarity index 71% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/removed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/removed.golden index 34fbfc62c..8f7234fa5 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/removed.golden @@ -1,8 +1,8 @@ tests.testOutput{ - initialValue: map[string]string{ - "key": "val", + initialValue: &map[string]string{ + "key": "val1", }, - changeValue: map[string]string{}, + changeValue: &map[string]string{}, tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -12,9 +12,9 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ map_prop = { - - "key" = "val" -> null + id = "newid" + ~ prop = { + - "key" = "val1" -> null } } @@ -27,12 +27,12 @@ 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] - ~ mapProp: { - - key: "val" + ~ prop: { + - key: "val1" } Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"mapProp.key": map[string]interface{}{"kind": "DELETE"}}, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/unchanged_empty.golden similarity index 84% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/unchanged_empty.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/unchanged_empty.golden index 342ab2068..9247a8f3a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/unchanged_empty.golden @@ -1,6 +1,6 @@ tests.testOutput{ - initialValue: map[string]string{}, - changeValue: map[string]string{}, + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/unchanged_non-empty.golden similarity index 79% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/unchanged_non-empty.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/unchanged_non-empty.golden index 95f4be8e3..388878119 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/unchanged_non-empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optional/unchanged_non-empty.golden @@ -1,8 +1,8 @@ tests.testOutput{ - initialValue: map[string]string{ - "key": "val", + initialValue: &map[string]string{ + "key": "val1", }, - changeValue: map[string]string{"key": "val"}, + changeValue: &map[string]string{"key": "val1"}, tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/added.golden new file mode 100644 index 000000000..8c8e71567 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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" + ~ prop = { + ~ "key" = "computedVal" -> "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] + ~ prop: { + ~ key: "computedVal" => "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/changed.golden new file mode 100644 index 000000000..63ff21864 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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" + ~ prop = { + ~ "key" = "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] + ~ prop: { + ~ key: "val1" => "val2" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/key_changed.golden new file mode 100644 index 000000000..4c134cacc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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" + ~ prop = { + - "key" = "val1" -> null + + "key2" = "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] + ~ prop: { + - key : "val1" + + key2: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE"}, + "prop.key2": map[string]interface{}{}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/removed.golden new file mode 100644 index 000000000..df8e01379 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = { + - "key" = "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=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..384b90b2c --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/unchanged_empty.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = { + - "key" = "computedVal" -> 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=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key: "computedVal" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/TestSDKv2DetailedDiffMap/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..1fe50973e --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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) + ~ prop = { # forces replacement + ~ "key" = "computedVal" -> "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + ~ key: "computedVal" => "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..37e4dbaf2 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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) + ~ prop = { # forces replacement + ~ "key" = "val1" -> "val2" + } + } + +Plan: 1 to add, 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: { + ~ key: "val1" => "val2" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/key_changed.golden new file mode 100644 index 000000000..af3d935c1 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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) + ~ prop = { # forces replacement + - "key" = "val1" -> null + + "key2" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key : "val1" + + key2: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}, + "prop.key2": map[string]interface{}{"kind": "ADD_REPLACE"}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..fb487d69b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = { + - "key" = "val1" + } -> (known after apply) # 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: { + - key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..83ebc3c9a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = { + - "key" = "computedVal" + } -> (known after apply) # 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: { + - key: "computedVal" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/TestSDKv2DetailedDiffMap/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/added.golden new file mode 100644 index 000000000..9a561c17a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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 = { + + "key" = "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: { + + key: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/changed.golden new file mode 100644 index 000000000..ab640a690 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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" + ~ prop = { + ~ "key" = "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] + ~ prop: { + ~ key: "val1" => "val2" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/key_changed.golden new file mode 100644 index 000000000..82d0977ec --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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 = { + - "key" = "val1" -> null + + "key2" = "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: { + - key : "val1" + + key2: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE"}, + "prop.key2": map[string]interface{}{}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/removed.golden new file mode 100644 index 000000000..8f7234fa5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = { + - "key" = "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: { + - key: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..9247a8f3a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..f25695065 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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 = { # forces replacement + + "key" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: { + + key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..343e5fe5e --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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) + ~ prop = { # forces replacement + ~ "key" = "val1" -> "val2" + } + } + +Plan: 1 to add, 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: { + ~ key: "val1" => "val2" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/key_changed.golden new file mode 100644 index 000000000..8f6b3bad1 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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 = { # forces replacement + - "key" = "val1" -> null + + "key2" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key : "val1" + + key2: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}, + "prop.key2": map[string]interface{}{"kind": "ADD_REPLACE"}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..16ef25f0b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = { # forces replacement + - "key" = "val1" + } -> null + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..9247a8f3a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/TestSDKv2DetailedDiffMap/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/added.golden new file mode 100644 index 000000000..f25695065 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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 = { # forces replacement + + "key" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: { + + key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/changed.golden new file mode 100644 index 000000000..343e5fe5e --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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) + ~ prop = { # forces replacement + ~ "key" = "val1" -> "val2" + } + } + +Plan: 1 to add, 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: { + ~ key: "val1" => "val2" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/key_changed.golden new file mode 100644 index 000000000..8f6b3bad1 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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 = { # forces replacement + - "key" = "val1" -> null + + "key2" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key : "val1" + + key2: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}, + "prop.key2": map[string]interface{}{"kind": "ADD_REPLACE"}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/removed.golden new file mode 100644 index 000000000..16ef25f0b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = { # forces replacement + - "key" = "val1" + } -> null + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..9247a8f3a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/TestSDKv2DetailedDiffMap/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/added.golden new file mode 100644 index 000000000..9a561c17a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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 = { + + "key" = "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: { + + key: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/changed.golden new file mode 100644 index 000000000..ab640a690 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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" + ~ prop = { + ~ "key" = "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] + ~ prop: { + ~ key: "val1" => "val2" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/key_changed.golden new file mode 100644 index 000000000..82d0977ec --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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 = { + - "key" = "val1" -> null + + "key2" = "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: { + - key : "val1" + + key2: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE"}, + "prop.key2": map[string]interface{}{}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/removed.golden new file mode 100644 index 000000000..8f7234fa5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = { + - "key" = "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: { + - key: "val1" + } +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/unchanged_empty.golden new file mode 100644 index 000000000..9247a8f3a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/required/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/TestSDKv2DetailedDiffMap/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/added.golden new file mode 100644 index 000000000..f25695065 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/added.golden @@ -0,0 +1,36 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{"key": "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 = { # forces replacement + + "key" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: { + + key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "ADD_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/changed.golden new file mode 100644 index 000000000..343e5fe5e --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/changed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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) + ~ prop = { # forces replacement + ~ "key" = "val1" -> "val2" + } + } + +Plan: 1 to add, 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: { + ~ key: "val1" => "val2" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/key_changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/key_changed.golden new file mode 100644 index 000000000..8f6b3bad1 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/key_changed.golden @@ -0,0 +1,43 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key2": "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 = { # forces replacement + - "key" = "val1" -> null + + "key2" = "val1" + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key : "val1" + + key2: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{ + "prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}, + "prop.key2": map[string]interface{}{"kind": "ADD_REPLACE"}, + }, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/removed.golden new file mode 100644 index 000000000..16ef25f0b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/removed.golden @@ -0,0 +1,38 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{}, + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = { # forces replacement + - "key" = "val1" + } -> null + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: { + - key: "val1" + } +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop.key": map[string]interface{}{"kind": "DELETE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..9247a8f3a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: &map[string]string{}, + changeValue: &map[string]string{}, + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..388878119 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffMap/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,18 @@ +tests.testOutput{ + initialValue: &map[string]string{ + "key": "val1", + }, + changeValue: &map[string]string{"key": "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/value_makers.go b/pkg/tests/diff_test/value_makers.go index 50b2924f8..c907423df 100644 --- a/pkg/tests/diff_test/value_makers.go +++ b/pkg/tests/diff_test/value_makers.go @@ -59,7 +59,7 @@ func runSDKv2TestMatrix[T any]( } func generateBaseTests[T any]( - typ schema.ValueType, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, + typ schema.ValueType, elem any, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, ) ([]diffSchemaValueMakerPair[T], []diffScenario[T]) { valueOne := ref(val1) valueTwo := ref(val2) @@ -78,6 +78,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Optional: true, }, }, @@ -87,6 +88,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Optional: true, ForceNew: true, }, @@ -97,6 +99,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Required: true, }, }, @@ -106,6 +109,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, ForceNew: true, Required: true, }, @@ -126,6 +130,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Optional: true, Computed: true, }, @@ -141,6 +146,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Optional: true, Computed: true, ForceNew: true, @@ -157,6 +163,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Optional: true, Default: defaultVal, }, @@ -167,6 +174,7 @@ func generateBaseTests[T any]( Schema: map[string]*schema.Schema{ "prop": { Type: typ, + Elem: elem, Optional: true, Default: defaultVal, ForceNew: true,