pulumi / pulumi-aws

An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Apache License 2.0
446 stars 154 forks source link

Panic when modifying `customerEventData` of a flex match config object #4239

Closed stooj closed 1 month ago

stooj commented 1 month ago

Describe what happened

Getting a panic when trying to modify the customEventData of a flex match config object in aws PulumiAws v6.44.0 (latest)

Sample program

new MatchmakingConfiguration($"{cfg.Region.RegionShortName}-{serviceNamePrefix}-{name}FlexMatchConfig", new MatchmakingConfigurationArgs
            {
                AcceptanceRequired = false,
                FlexMatchMode = "STANDALONE",
                Name = GetAwsResourceName(cfg, $"CubeMatchmaker-{name}-v{ApplicationVersion.Current}-{DataVersion.Current}"),
                RuleSetName = ruleSetName,
                RequestTimeoutSeconds = timeout,
                GameSessionData = string.Empty,
                CustomEventData = $"{CompleteVersion.Current.ToPlusFormat()}+{cfg.Environment}{(cfg.EphemeralKey != null ? "." + cfg.EphemeralKey : "")}",
                BackfillMode = "MANUAL",
                Tags = cfg.DefaultTags,
            }, new CustomResourceOptions
            {
                Parent = this,
                // we don't use this value, but it's returned by the flexmatch API and shows as a diff
                // which just causes extra writes/noise in the pulumi update
                IgnoreChanges = new List<string> { "gameSessionQueueArns"}
            });

Log output

pulumi:pulumi:Stack (ephemeral-mkhan-31.3.0):
    panic: interface conversion: interface {} is *schema.Set, not []interface {}
    goroutine 203 [running]:
    github.com/hashicorp/terraform-provider-aws/internal/service/gamelift.resourceMatchmakingConfigurationUpdate({0x118e5b088, 0x140084cac60}, 0x1400823f200, {0x118bcc060, 0x1400220fa00})
        /home/runner/work/pulumi-aws/pulumi-aws/upstream/internal/service/gamelift/matchmaking_configuration.go:312 +0xecc
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x118e5b088?, {0x118e5b088?, 0x140084cac60?}, 0xd?, {0x118bcc060?, 0x1400220fa00?})
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240520223432-0c0bf0d65f10/helper/schema/resource.go:807 +0x64
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x1400229a540, {0x118e5b088, 0x140084cac60}, 0x140084eba00, 0x14008049c00, {0x118bcc060, 0x1400220fa00})
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240520223432-0c0bf0d65f10/helper/schema/resource.go:919 +0x670
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Provider.Apply({0x140011a49c0?, {0x14002137c30?, 0x14007cb5130?, 0x140084cadb0?}}, {0x118e5b088, 0x140084cac60}, {0x1138f119b, 0x26}, {0x118e5b3d0, 0x140086795f0}, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.84.0/pkg/tfshim/sdk-v2/provider.go:131 +0x148
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.(*providerWithPlanResourceChangeDispatch).Apply(0x14002324810, {0x118e5b088, 0x140084cac60}, {0x1138f119b, 0x26}, {0x118e5b3d0, 0x140086795f0}, {0x118e76ac0, 0x14008049c00})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.84.0/pkg/tfshim/sdk-v2/provider2.go:695 +0xc8
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Update(0x14000f29308, {0x118e5b088?, 0x140084ca840?}, 0x1400439f0e0)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.84.0/pkg/tfbridge/provider.go:1401 +0x9b8
    github.com/pulumi/pulumi-terraform-bridge/x/muxer.(*muxer).Update.func1({0x118ef7ce0?, 0x14000f29308?})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/x/muxer@v0.0.8/muxer.go:387 +0x3c
    github.com/pulumi/pulumi-terraform-bridge/x/muxer.resourceMethod[...](0x140071f4360?, 0x118639200, 0x1400739d698?)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/x/muxer@v0.0.8/muxer.go:334 +0xc4
    github.com/pulumi/pulumi-terraform-bridge/x/muxer.(*muxer).Update(0x123842f10?, {0x118e5b088?, 0x140084ca840?}, 0x116312ee0?)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/x/muxer@v0.0.8/muxer.go:386 +0x58
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Update_Handler.func1({0x118e5b088?, 0x140084ca840?}, {0x1186ce140?, 0x1400439f0e0?})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.118.0/proto/go/provider_grpc.pb.go:687 +0xd0
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x118e5b088, 0x140084ca210}, {0x1186ce140, 0x1400439f0e0}, 0x140084e00a0, 0x140084dc1f8)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x2e4
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Update_Handler({0x118a39d60, 0x140071f4360}, {0x118e5b088, 0x140084ca210}, 0x1400823e980, 0x1400511cb40)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.118.0/proto/go/provider_grpc.pb.go:689 +0x148
    google.golang.org/grpc.(*Server).processUnaryRPC(0x14004c25c00, {0x118e5b088, 0x140084ca180}, {0x118eb1860, 0x14000329b00}, 0x140084de000, 0x14007280030, 0x123e290e8, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0xb58
    google.golang.org/grpc.(*Server).handleStream(0x14004c25c00, {0x118eb1860, 0x14000329b00}, 0x140084de000)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0xb20
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x13c

  aws:sqs:Queue (usw2-mkhan-CubeGame-Api-v31-3-0-CreateGame):
    error: error reading from server: read tcp 127.0.0.1:60923->127.0.0.1:60920: read: connection reset by peer

Affected Resource(s)

No response

Output of pulumi about

we're using the automation api so there's no yaml

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

corymhall commented 1 month ago

@stooj do you know if this ever worked? I've tried testing this going back to pretty old aws versions and I couldn't get this to work.

It looks like this issue is entirely created through a patch. https://github.com/pulumi/pulumi-aws/blob/268405309e79ddd1e55252a2273478365b033967/patches/0014-add-matchmaking-configuration-72.patch#L351

We need to change

    if v, ok := d.GetOk("game_session_queue_arns"); ok {
        input.GameSessionQueueArns = expandStringList(v.([]interface{}))
    }

to

    if v, ok := d.GetOk("game_session_queue_arns"); ok {
        input.GameSessionQueueArns = expandStringList(v.(*schema.Set))
    }