Skip to content

Commit

Permalink
Swap CtyInstanceState with PlanResourceChange flag (#3359)
Browse files Browse the repository at this point in the history
An experiment to see if PlanResourceChange can substitute for
CtyInstanceState while still handling wafv2_web_acl resource correctly.
See #3361

---------

Co-authored-by: Ian Wahbe <[email protected]>
  • Loading branch information
t0yv0 and iwahbe authored Feb 2, 2024
1 parent 6958b62 commit 60fee05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 3 additions & 4 deletions examples/examples_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
10 changes: 6 additions & 4 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 60fee05

Please sign in to comment.