Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomResource with input kind #1115

Closed
Tracked by #2787
geigerzaehler opened this issue May 11, 2020 · 3 comments · Fixed by #3079
Closed
Tracked by #2787

CustomResource with input kind #1115

geigerzaehler opened this issue May 11, 2020 · 3 comments · Fixed by #3079
Assignees
Labels
impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec
Milestone

Comments

@geigerzaehler
Copy link

Problem description

When creating a k8s.apiextensions.CustomResource with a kind argument that is an input instead of a string pulumi crashes.

Errors & Logs

   panic: fatal: An assertion has failed: Module member token '{v}suffix`
    See https://pulumi.io/help/outputs for more details.
    This function may throw in a future version of @pulumi/pulumi.' missing module member delimiter
    goroutine 33 [running]:
    github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.failfast(...)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/go/common/util/contract/failfast.go:23
    github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.Assertf(0xc001460200, 0x19b8f14, 0x38, 0xc000b3d2e8, 0x1, 0x1)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/go/common/util/contract/assert.go:33 +0x197
    github.com/pulumi/pulumi/sdk/v2/go/common/tokens.ModuleMember.Module(0xc0014602e5, 0x7f, 0xc0014602e5, 0x7f)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/go/common/tokens/tokens.go:192 +0xd6
    github.com/pulumi/pulumi/sdk/v2/go/common/tokens.ModuleMember.Package(0xc0014602e5, 0x7f, 0x1961adf, 0x1)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/go/common/tokens/tokens.go:187 +0x35
    github.com/pulumi/pulumi/sdk/v2/go/common/tokens.Type.Package(0xc0014602e5, 0x7f, 0xc0014602e5, 0x7f)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/go/common/tokens/tokens.go:227 +0x82
    github.com/pulumi/pulumi-kubernetes/provider/v2/pkg/provider.(*kubeProvider).gvkFromURN(0xc00016c000, 0xc0014601c0, 0x1b4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000b3d4e0, ...)
        /home/travis/gopath/src/github.com/pulumi/pulumi-kubernetes/provider/pkg/provider/provider.go:1933 +0x80
    github.com/pulumi/pulumi-kubernetes/provider/v2/pkg/provider.(*kubeProvider).Read(0xc00016c000, 0x1bf9860, 0xc000cf34d0, 0xc0015f7040, 0xc00016c000, 0x1753201, 0xc000ad54c0)
        /home/travis/gopath/src/github.com/pulumi/pulumi-kubernetes/provider/pkg/provider/provider.go:1477 +0x134c
    github.com/pulumi/pulumi/sdk/v2/proto/go._ResourceProvider_Read_Handler.func1(0x1bf9860, 0xc000cf34d0, 0x188dc80, 0xc0015f7040, 0x18b0bc0, 0x28bea50, 0x1bf9860, 0xc000cf34d0)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider.pb.go:1902 +0x86
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x1bf9860, 0xc000cf3440, 0x188dc80, 0xc0015f7040, 0xc001552a40, 0xc001552b00, 0x0, 0x0, 0x1bb5760, 0xc000292270)
        /home/travis/gopath/pkg/mod/github.com/grpc-ecosystem/[email protected]/go/otgrpc/server.go:57 +0x2f9
    github.com/pulumi/pulumi/sdk/v2/proto/go._ResourceProvider_Read_Handler(0x18f5b60, 0xc00016c000, 0x1bf9860, 0xc000cf3440, 0xc000ba27e0, 0xc00000e100, 0x1bf9860, 0xc000cf3440, 0xc0015341e0, 0x1d2)
        /home/travis/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider.pb.go:1904 +0x14b
    google.golang.org/grpc.(*Server).processUnaryRPC(0xc000148000, 0x1c18080, 0xc0004bc300, 0xc0001ca200, 0xc0005341b0, 0x2889de0, 0x0, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/google.golang.org/[email protected]/server.go:1082 +0x4fd
    google.golang.org/grpc.(*Server).handleStream(0xc000148000, 0x1c18080, 0xc0004bc300, 0xc0001ca200, 0x0)
        /home/travis/gopath/pkg/mod/google.golang.org/[email protected]/server.go:1405 +0xd23
    google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00057a070, 0xc000148000, 0x1c18080, 0xc0004bc300, 0xc0001ca200)
        /home/travis/gopath/pkg/mod/google.golang.org/[email protected]/server.go:746 +0xbb
    created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/travis/gopath/pkg/mod/google.golang.org/[email protected]/server.go:744 +0xa1

Affected product version(s)

$ pulumi version  
v2.1.0
$ pulumi plugin ls
NAME          KIND      VERSION       SIZE   INSTALLED  LAST USED
kubernetes    resource  2.0.0         52 MB  n/a        2 hours ago

Reproducing the issue

import * as pulumi from "@pulumi/pulumi"
import * as k8s from "@pulumi/kubernetes"

new k8s.apiextensions.CustomResource("my-custom-resource", {
  kind: pulumi.output("MyCustomResource"),
  apiVersion: "my-custom-resource/v1",
})

Suggestions for a fix

Looks like the offending code is this

super(`kubernetes:${args.apiVersion}:${args.kind}`, name, props, opts);

Here kind is expanded to an error message which is obviously an invalid module suffix.

@EvanBoyle EvanBoyle added kind/bug Some behavior is incorrect or out of spec impact/panic This bug represents a panic or unexpected crash labels Jul 3, 2023
@lblackstone lblackstone removed their assignment Jul 14, 2023
@EronWright
Copy link
Contributor

EronWright commented Apr 22, 2024

Looks like the apiVersion and kind were modeled as inputs across all the SDKs, and all suffer from a variation of the problem. Changing the API seems like a last resort here, and so I would advocate for raising an error when the supplied value is not an immediate known value.

One possibility may be to use UnsafeAwaitOutput to wait for the kind to resolve, then throw if the value is unknown. I'm unsure whether that's practical across all the SDKs.

@EronWright
Copy link
Contributor

EronWright commented Jun 11, 2024

It is proposed that we do a breaking API change for NodeJS SDK, such that the kind and apiversion properties become eager properties (e.g. string vs Input<string>). Assumedly we'd change the Pulumi schema and mark those properties as plain (ref). It is assumed that no program will break because a non-eager value simply didn't work.

@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #3079 and shipped in release v4.15.0.

@mjeffryes mjeffryes added this to the 0.107 milestone Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants