Search code examples
rancherpulumi

Pulumi Rancher2 provider creation is throwing error


I am currently trying to create rancher2 provider in Pulumi like this:

import * as rancher2 from '@pulumi/rancher2'

const rancher2ProviderBootstrap = new rancher2.Provider(
    'ComponentResource::AwsClusterK3s::rancher2Provider',
    {
        apiUrl: `https://rancherurl.com`,
        bootstrap: true,
        timeout: '5m',
        // I have also tried combining/removing properties (only apiUrl is required), but the error is still the same
    },
)

And when I run pulumi preview or pulumi up I get following error:

panic: fatal: An assertion has failed

goroutine 52 [running]:
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)
        /Users/runner/work/pulumi/pulumi/sdk/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Assert(...)
        /Users/runner/work/pulumi/pulumi/sdk/go/common/util/contract/assert.go:26
github.com/pulumi/pulumi/pkg/v3/resource/deploy/providers.mustNewReference({0xc000382380, 0x6a}, {0x1acccaa, 0x24})
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/providers/reference.go:134 +0xce
github.com/pulumi/pulumi/pkg/v3/resource/deploy/providers.(*Registry).Check(0xc0010dceb0, {0xc000382380, 0x6a}, 0x0, 0xc000babd70, 0x0, 0xc0006ad200)
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/providers/registry.go:284 +0x40e
github.com/pulumi/pulumi/pkg/v3/resource/deploy.(*stepGenerator).generateSteps(0xc00029f680, {0x1de5553bb18, 0xc000bcee20})
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/step_generator.go:427 +0x10fb
github.com/pulumi/pulumi/pkg/v3/resource/deploy.(*stepGenerator).GenerateSteps(0xc00029f680, {0x1de5553bb18, 0xc000bcee20})
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/step_generator.go:185 +0x46
github.com/pulumi/pulumi/pkg/v3/resource/deploy.(*deploymentExecutor).handleSingleEvent(0xc000688498, {0x1e2e820, 0xc000bcee20})
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/deployment_executor.go:413 +0xe5
github.com/pulumi/pulumi/pkg/v3/resource/deploy.(*deploymentExecutor).Execute.func3(0xc001156240, 0xc000688498, 0xc000ef0fd0, {0x1e602f0, 0xc000681a80}, 0x0, 0x0, {0x1e60398, 0xc00113ecf0})
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/deployment_executor.go:250 +0x273
github.com/pulumi/pulumi/pkg/v3/resource/deploy.(*deploymentExecutor).Execute(0xc000688498, {0x1e60398, 0xc00113ecf0}, {{0x1de5556d5a8, 0xc0005d6840}, 0x7fffffff, 0x0, 0x0, {0x0, 0x0, ...}, ...}, ...)
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/deployment_executor.go:266 +0x95f
github.com/pulumi/pulumi/pkg/v3/resource/deploy.(*Deployment).Execute(0xc000cae420, {0x1e60398, 0xc00113ecf0}, {{0x1de5556d5a8, 0xc0005d6840}, 0x7fffffff, 0x0, 0x0, {0x0, 0x0, ...}, ...}, ...)
        /Users/runner/work/pulumi/pulumi/pkg/resource/deploy/deployment.go:447 +0xd0
github.com/pulumi/pulumi/pkg/v3/engine.(*deployment).run.func1()
        /Users/runner/work/pulumi/pulumi/pkg/engine/deployment.go:269 +0x250
created by github.com/pulumi/pulumi/pkg/v3/engine.(*deployment).run
        /Users/runner/work/pulumi/pulumi/pkg/engine/deployment.go:252 +0x371

NPM Versions:

@pulumi/[email protected] (latest)
@pulumi/[email protected] (latest)

Local PC:

PULUMI: [email protected] (latest)
OS: Windows 10

Am I doing something wrong, or is this really bug in the pulumi library?


Solution

  • Resource names shouldn't contain :. It shouldn't panic like this, but the fix is simple.

    Set your resource name like this:

    import * as rancher2 from '@pulumi/rancher2'
    
    const rancher2ProviderBootstrap = new rancher2.Provider(
        'AwsClusterK3s',
        {
            apiUrl: `https://rancherurl.com`,
            bootstrap: true,
            timeout: '5m',
        },
    )
    

    I've added a github issue for the panic here: https://github.com/pulumi/pulumi/issues/8949