pulumi / pulumi-terraform-bridge

A library allowing Terraform providers to be bridged into Pulumi.
Apache License 2.0
197 stars 43 forks source link

bug: `vultr:apiKey` is not a valid configuration key for the vultr provider #2582

Open dirien opened 2 days ago

dirien commented 2 days ago

What happened?

This appears to be a regression between 2.20.1 and 2.21.1.

It previously worked to set a config key vultr:apiKey, including as a secret, to set the vultr configuration. But some change has made this break between these versions.

Output of pulumi up:

Diagnostics:
  pulumi:providers:vultr (default_2_21_1_github_/api.github.com/dirien/pulumi-vultr):
    error: pulumi:providers:vultr resource 'default_2_21_1_github_/api.github.com/dirien/pulumi-vultr' has a problem: `vultr:apiKey` is not a valid configuration key for the vultr provider. If the referenced key is not intended for the provider, please choose a different namespace from `vultr:`.

Example

index.ts

import * as vultr from "@ediri/vultr";

let vke = new vultr.Kubernetes("vke", {
    region: "fra",
    version: "v1.25.4+1",
    label: "pulumi-vultr",
    nodePools: {
        nodeQuantity: 1,
        plan: "vc2-2c-4gb",
        label: "pulumi-vultr-nodepool",
    },
})

export const kubeconfig = vke.kubeConfig;

package.json

{
  "name": "vultr-ts",
  "main": "index.ts",
  "devDependencies": {
    "@types/node": "^18"
  },
  "dependencies": {
    "@pulumi/pulumi": "^3.0.0",
    "@ediri/vultr": "2.21.1"
  }
}

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).

iwahbe commented 2 days ago

I'm marking as P1, since it looks like a regression. If we are not able to demonstrate a regression, we can remove the label.

guineveresaenger commented 1 day ago

I'll take a look to pinpoint as soon as I can.

guineveresaenger commented 12 hours ago

Update: I've confirmed this is still an issue, even when this provider gets updated to the latest bridge. The error message commit (PR #1663), however, is not the cause.

The cause being that vultr's provider.configType.AttributeTypes is an empty map, so that the attribute type lookup fails.

The issue goes away when SkipValidateProviderConfigForPluginFramework is set to true on the provider; however that feels like incorrect usage of skipping config validation, as per #1448 this setting is meant to avoid a performance slowdown - not skip validation altogether. In fact, this particular field is currently only being used for AWS so I expect this is another red herring and we do not, in fact, want to skip this validation.

It's a little difficult to bisect which bridge version introduces this behavior, since this provider's bridge version is not being regularly updated.

Panic stacktrace:

panic: panic called with nil argument
    goroutine 46 [running]:
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge.(*provider).validateProviderConfig(0x140000ef888, {0x101de6958?, 0x1400049e8d0?}, {0x14000110000, 0x6e}, 0x1400049eb70)
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/pf/tfbridge/provider_checkconfig.go:212 +0x700
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge.(*provider).CheckConfigWithContext(0x140000ef888, {0x101de6958?, 0x1400100f6e0?}, {0x14000110000, 0x6e}, 0x0?, 0x1400100fa40, 0x80?)
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/pf/tfbridge/provider_checkconfig.go:109 +0x728
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/internal/configencoding.(*provider[...]).CheckConfigWithContext(0x1400100f860, {0x101de6958?, 0x1400100f6e0}, {0x14000110000, 0x6e}, 0x1400100f890, 0x1400100f8c0, 0x1)
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/pf/internal/configencoding/provider.go:74 +0xac
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/internal/plugin.(*providerServer).CheckConfig(0x140009db680, {0x101de6958, 0x1400100f6e0}, 0x14000c58900)
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/pf/internal/plugin/provider_server.go:227 +0x224
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/x/muxer.(*muxer).CheckConfig.func1()
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/x/muxer/muxer.go:128 +0x74
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/x/muxer.asyncJoin[...].func1()
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/x/muxer/muxer.go:597 +0x48
    created by github.com/pulumi/pulumi-terraform-bridge/v3/pkg/x/muxer.asyncJoin[...] in goroutine 44
        /Users/guin/go/src/github.com/pulumi/pulumi-terraform-bridge/pkg/x/muxer/muxer.go:596 +0x78
iwahbe commented 4 hours ago

@guineveresaenger Are you saying the issue is because vultr is a muxed provider (SDKv2 & PF) and the config types of the different providers disagree?