From 7dd77efb44b43e0a1a7673d4d05a100d341bac12 Mon Sep 17 00:00:00 2001 From: VenelinMartinov Date: Mon, 28 Oct 2024 12:50:34 -0700 Subject: [PATCH] Re-record forceNew collection interactions with unknowns under detailed diff v2 (#2516) This re-records the tests in https://github.com/pulumi/pulumi-terraform-bridge/pull/2515 under detailed diff v2 to show the changes. The new behaviour is more correct: When the parent of a known property with ForceNew is changed to unknown we now mark the resource for replacement. Both are guesses to the actual effect of the changes but this one seems more likely. stacked on https://github.com/pulumi/pulumi-terraform-bridge/pull/2515\ related to https://github.com/pulumi/pulumi-terraform-bridge/pull/2496#discussion_r1806835980 --- pkg/tests/schema_pulumi_test.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/tests/schema_pulumi_test.go b/pkg/tests/schema_pulumi_test.go index a2e15f709..1666a5fa3 100644 --- a/pkg/tests/schema_pulumi_test.go +++ b/pkg/tests/schema_pulumi_test.go @@ -4163,7 +4163,8 @@ func TestMakeTerraformResultNilVsEmptyMap(t *testing.T) { func TestUnknownCollectionForceNewDetailedDiff(t *testing.T) { // TODO: Remove this once accurate bridge previews are rolled out - t.Setenv("PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW", "false") + t.Setenv("PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW", "true") + collectionForceNewResource := func(typ schema.ValueType) *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -4383,7 +4384,7 @@ Resources: [urn=urn:pulumi:test::test::pulumi:pulumi:Stack::test-test] + prov:index/aux:Aux: (create) [urn=urn:pulumi:test::test::prov:index/aux:Aux::auxRes] - ~ prov:index/test:Test: (update) + +-prov:index/test:Test: (replace) [id=newid] [urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] ~ tests: [ @@ -4394,7 +4395,7 @@ Resources: ] Resources: + 1 to create - ~ 1 to update + +-1 to replace 2 changes. 1 unchanged `)) }) @@ -4406,7 +4407,7 @@ Resources: [urn=urn:pulumi:test::test::pulumi:pulumi:Stack::test-test] + prov:index/aux:Aux: (create) [urn=urn:pulumi:test::test::prov:index/aux:Aux::auxRes] - ~ prov:index/test:Test: (update) + +-prov:index/test:Test: (replace) [id=newid] [urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] - tests: [ @@ -4417,7 +4418,7 @@ Resources: + tests: output Resources: + 1 to create - ~ 1 to update + +-1 to replace 2 changes. 1 unchanged `)) }) @@ -4545,7 +4546,7 @@ Resources: [urn=urn:pulumi:test::test::pulumi:pulumi:Stack::test-test] + prov:index/aux:Aux: (create) [urn=urn:pulumi:test::test::prov:index/aux:Aux::auxRes] - ~ prov:index/test:Test: (update) + +-prov:index/test:Test: (replace) [id=newid] [urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] ~ tests: [ @@ -4556,7 +4557,7 @@ Resources: ] Resources: + 1 to create - ~ 1 to update + +-1 to replace 2 changes. 1 unchanged `)) }) @@ -4568,7 +4569,7 @@ Resources: [urn=urn:pulumi:test::test::pulumi:pulumi:Stack::test-test] + prov:index/aux:Aux: (create) [urn=urn:pulumi:test::test::prov:index/aux:Aux::auxRes] - ~ prov:index/test:Test: (update) + +-prov:index/test:Test: (replace) [id=newid] [urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] - tests: [ @@ -4579,7 +4580,7 @@ Resources: + tests: output Resources: + 1 to create - ~ 1 to update + +-1 to replace 2 changes. 1 unchanged `)) })