Hello. Is there any limitation when exporting a pr...
# general
p
Hello. Is there any limitation when exporting a provider? If I try to use a k8s provider from a stack reference I get this error:
Copy code
error: Running program '/Volumes/Projects/Credijusto/infra/applications/prometheus-operator' failed with an unhandled exception:
    TypeError: provider.getPackage is not a function
        at convertToProvidersMap (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/resource.js:198:25)
        at new Resource (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/resource.js:147:19)
        at new ComponentResource (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/resource.js:335:9)
        at new CollectionComponentResource (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/kubernetes/yaml/yaml.js:60:9)
        at new Chart (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/kubernetes/helm/v2/helm.js:62:9)
        at Object.<anonymous> (/Volumes/Projects/Credijusto/infra/applications/prometheus-operator/index.ts:8:1)
        at Module._compile (internal/modules/cjs/loader.js:776:30)
        at Module.m._compile (/Volumes/Projects/Credijusto/infra/node_modules/ts-node/src/index.ts:439:23)
        at Module._extensions..js (internal/modules/cjs/loader.js:787:10)
        at Object.require.extensions.<computed> [as .ts] (/Volumes/Projects/Credijusto/infra/node_modules/ts-node/src/index.ts:442:12)

    (node:99408) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I can get around this one defining the
providers
in the ComponentResourceOptions param (
providers: { kubernetes: myProvider }
), but then the following happens:
Copy code
error: Running program '/Volumes/Projects/Credijusto/infra/applications/prometheus-operator' failed with an unhandled exception:
    TypeError: provider.urn.promise is not a function
        at /Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/runtime/resource.js:226:52
        at Generator.next (<anonymous>)
        at fulfilled (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/runtime/resource.js:17:58)
    error: Running program '/Volumes/Projects/Credijusto/infra/applications/prometheus-operator' failed with an unhandled exception:
    TypeError: provider.urn.promise is not a function
        at /Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/runtime/resource.js:226:52
        at Generator.next (<anonymous>)
        at fulfilled (/Volumes/Projects/Credijusto/infra/node_modules/@pulumi/pulumi/runtime/resource.js:17:58)
    error: Running program '/Volumes/Projects/Credijusto/infra/applications/prometheus-operator' failed with an unhandled exception:
    TypeError: provider.urn.promise is not a function
        at /Volumes/Projects/Credijusto
.
.
.
// It happens recursively.
Any clues on this?
w
If you export any kind of resource in one stack, and then
StackReference
it in another, you get only a JSON serialized object on the other side - not a fully initialized instance of the
Provider
or
Resource
.
p
Any idea of how could I export a provider? Or should I export the generated kubeconfig and create the provider in where I would reference it?
w
Currently it is not possible to export/import a
Provider
instance. Best is to export the
kubeconfig
or similar inputs needed to create the provider and then new it up in the client stacks.
p
Gotcha. Thanks 🙂