From 60fee05158a115afb581711bdc68cb33ae3d6eb5 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 2 Feb 2024 14:12:08 -0500 Subject: [PATCH] Swap CtyInstanceState with PlanResourceChange flag (#3359) An experiment to see if PlanResourceChange can substitute for CtyInstanceState while still handling wafv2_web_acl resource correctly. See https://github.com/pulumi/pulumi-aws/issues/3361 --------- Co-authored-by: Ian Wahbe --- examples/examples_nodejs_test.go | 7 +++---- provider/resources.go | 10 ++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/examples_nodejs_test.go b/examples/examples_nodejs_test.go index 0bb21316e0b..72d359161d5 100644 --- a/examples/examples_nodejs_test.go +++ b/examples/examples_nodejs_test.go @@ -474,12 +474,11 @@ func TestAccWafV2(t *testing.T) { func TestRegress1423Ts(t *testing.T) { test := getJSBaseOptions(t). With(integration.ProgramTestOptions{ - Dir: filepath.Join(getCwd(t), "regress-1423"), - RunUpdateTest: false, + Dir: filepath.Join(getCwd(t), "regress-1423"), }) - test.ExpectRefreshChanges = false + // TODO[pulumi/pulumi-aws#3361] similarly to upstream this currently has a non-empty refresh + test.SkipRefresh = true test.Quick = false - test.SkipRefresh = false integration.ProgramTest(t, &test) } diff --git a/provider/resources.go b/provider/resources.go index f6ec2474316..86c9fbd2423 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -789,7 +789,12 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo { v2p := shimv2.NewProvider(upstreamProvider.SDKV2Provider, shimv2.WithDiffStrategy(shimv2.PlanState), shimv2.WithPlanResourceChange(func(s string) bool { - return s == "aws_ssm_document" + switch s { + case "aws_ssm_document", "aws_wafv2_web_acl": + return true + default: + return false + } })) p := pftfbridge.MuxShimWithDisjointgPF(ctx, v2p, upstreamProvider.PluginFrameworkProvider) @@ -6283,9 +6288,6 @@ $ pulumi import aws:networkfirewall/resourcePolicy:ResourcePolicy example arn:aw args.ExamplePath == "#/resources/aws:appsync/graphQLApi:GraphQLApi" } - // Fixes a spurious diff on repeat pulumi up for the aws_wafv2_web_acl resource (pulumi/pulumi#1423). - shimv2.SetInstanceStateStrategy(prov.P.ResourcesMap().Get("aws_wafv2_web_acl"), shimv2.CtyInstanceState) - setAutonaming(&prov) prov.MustApplyAutoAliases()