pulumi / pulumi-cloudflare

Pulumi's Cloudflare package, providing multi-language infrastructure as code for Cloudflare
Apache License 2.0
101 stars 12 forks source link

Panic trying to create NotificationPolicy #213

Open barclayadam opened 2 years ago

barclayadam commented 2 years ago

Hello!

Issue details

Trying to create a NotificationPolicy with filters (i.e. to notify on image resizing requests) causes a go panic using v4.3.0 of the provider:

 panic: Unknown validation type: 6
    goroutine 72 [running]:
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.validateMapValues(0x232a5c4, 0x7, 0xc0002248a0, 0xc0000fa3c0, 0xc0008eac10, 0x1, 0x1, 0x20f8220, 0x1, 0xc0008eaca0)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/schema.go:1912 +0xc3f
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.validateMap(0xc0005215f0, 0x232a5c4, 0x7, 0x2119240, 0xc0002248a0, 0xc0000fa3c0, 0xc000224900, 0xc0008eac10, 0x1, 0x1, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/schema.go:1819 +0x9b2
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.validateType(0xc0005215f0, 0x232a5c4, 0x7, 0x2119240, 0xc0002248a0, 0xc0000fa3c0, 0xc000224900, 0xc0008eac10, 0x1, 0x1, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/schema.go:2109 +0x4b8
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.validate(0xc0005215f0, 0x232a5c4, 0x7, 0xc0000fa3c0, 0xc000224900, 0xc0008eac10, 0x1, 0x1, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/schema.go:1534 +0x8c9
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.validateObject(0xc0005215f0, 0x0, 0x0, 0xc0005215f0, 0xc000224900, 0x2fff6d8, 0x0, 0x0, 0x25d5390, 0xc000224750, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/schema.go:1970 +0x2bc
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Validate(...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/schema.go:649
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Validate(0xc0000f7110, 0xc000224900, 0x234ff60, 0x1e, 0xc000c77568)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/resource.go:521 +0x75
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).ValidateResource(0xc000c2fea0, 0x234ff60, 0x1e, 0xc000224900, 0x1f96f14, 0xc000c2fea0, 0xc000224870)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20211019194827-62530c6537a4/helper/schema/provider.go:251 +0x16c
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Provider.ValidateResource(0xc000c2fea0, 0x234ff60, 0x1e, 0x25fc940, 0xc000224900, 0xc0005215f0, 0x0, 0xc000224750, 0xc000224720, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.11.0/pkg/tfshim/sdk-v2/provider.go:76 +0x77
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Check(0xc000c39800, 0x261c4a8, 0xc000224570, 0xc0009200c0, 0xc000c39800, 0x2128601, 0xc000920dc0)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.11.0/pkg/tfbridge/provider.go:685 +0x742
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Check_Handler.func1(0x261c4a8, 0xc000224570, 0x2278020, 0xc0009200c0, 0x229fb20, 0x2fff6d8, 0x261c4a8, 0xc000224570)

        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.17.0/proto/go/provider.pb.go:2566 +0x8d
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x261c4a8, 0xc000224210, 0x2278020, 0xc0009200c0, 0xc000e24260, 0xc000a800f0, 0x0, 0x0, 0x25f6e20, 0xc000524810)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x31c
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Check_Handler(0x22ec060, 0xc000c39800, 0x261c4a8, 0xc000224210, 0xc000096360, 0xc000c61b80, 0x261c4a8, 0xc000224210, 0xc000234000, 0x197)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.17.0/proto/go/provider.pb.go:2568 +0x15e
    google.golang.org/grpc.(*Server).processUnaryRPC(0xc000094c40, 0x262ab38, 0xc000105380, 0xc0003a3320, 0xc00004da40, 0x2fa4550, 0x0, 0x0, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:1297 +0x52b
    google.golang.org/grpc.(*Server).handleStream(0xc000094c40, 0x262ab38, 0xc000105380, 0xc0003a3320, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:1626 +0xd0c
    google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00012e060, 0xc000094c40, 0x262ab38, 0xc000105380, 0xc0003a3320)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:941 +0xb2
    created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:939 +0x1fd

Steps to reproduce

Try to create a NotificationPolicy, for example for image resizing requests using:

new cloudflare.NotificationPolicy('image-resizing-requests-notification-policy', {
    accountId: '...',
    name: 'Image resizing requests',
    alertType: 'billing_usage_alert',
    enabled: true,
    filters: {
        product: ['image_resizing_requests'],
        limit: ['50000'],
    },
    emailIntegrations: [{
        id: 'me@example.com',
    }],
})

Expected: A notification to be created in CF Actual: Go panics

mikhailshilkov commented 1 year ago

It looks like this upstream issue: https://github.com/cloudflare/terraform-provider-cloudflare/issues/1189

It has been closed but is still reported to occur