You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not possible to import a Resource that is provided by a Dynamic Resource Provider written with the Pulumi Python SDK due to the following error: Exception calling application: '__provider'
$ pulumi import -f import-no-provider.json
Previewing import (import-testing-resource):
Type Name Plan Info
pulumi:pulumi:Stack dynamic_resource_type_name_py-import-testing-resource 1 error
= └─ pulumi-python:dynamic/custom-provider:CustomResource CustomResourceImport import 1 error
Diagnostics:
pulumi:pulumi:Stack (dynamic_resource_type_name_py-import-testing-resource):
error: preview failed
pulumi-python:dynamic/custom-provider:CustomResource (CustomResourceImport):
error: Preview failed: Exception calling application: '__provider'
It does not matter if you specify an existing provider. Create a file with the following contents (note that the URN of your provider depends on your stack name):
$ pulumi import -f import.json
Previewing import (import-testing-resource):
Type Name Plan Info
pulumi:pulumi:Stack dynamic_resource_type_name_py-import-testing-resource 1 error
= └─ pulumi-python:dynamic/custom-provider:CustomResource CustomResourceImport import 1 error
Diagnostics:
pulumi-python:dynamic/custom-provider:CustomResource (CustomResourceImport):
error: Preview failed: Exception calling application: '__provider'
pulumi:pulumi:Stack (dynamic_resource_type_name_py-import-testing-resource):
error: preview failed
The issue also appears if you try to import a resource within your source code directly. Add the following lines to the bottom of your __main__.py file (and import ResourceOptions atop the file):
$ pulumi up
Previewing update (import-testing-resource):
Type Name Plan Info
pulumi:pulumi:Stack dynamic_resource_type_name_py-import-testing-resource 1 error
= └─ pulumi-python:dynamic/custom-provider:CustomResource imported-resource import 1 error
Diagnostics:
pulumi-python:dynamic/custom-provider:CustomResource (imported-resource):
error: Preview failed: Exception calling application: '__provider'
pulumi:pulumi:Stack (dynamic_resource_type_name_py-import-testing-resource):
error: preview failed
Output of pulumi about
CLI
Version 3.115.2
Go Version go1.22.2
Go Compiler gc
Plugins
KIND NAME VERSION
language python unknown
Host
OS darwin
Version 14.4.1
Arch arm64
This project is written in python: executable='/Users/gklatte/pulumi-import-testing/venv/bin/python3' version='3.12.3'
Current Stack: organization/dynamic_resource_type_name_py/import-testing-resource
TYPE URN
pulumi:pulumi:Stack urn:pulumi:import-testing-resource::dynamic_resource_type_name_py::pulumi:pulumi:Stack::dynamic_resource_type_name_py-import-testing-resource
pulumi:providers:pulumi-python urn:pulumi:import-testing-resource::dynamic_resource_type_name_py::pulumi:providers:pulumi-python::default
pulumi-python:dynamic/custom-provider:CustomResource urn:pulumi:import-testing-resource::dynamic_resource_type_name_py::pulumi-python:dynamic/custom-provider:CustomResource::resource-name
Found no pending operations associated with import-testing-resource
Backend
Name MLLAXP1SXQ05N
URL s3://redacted?region=us-east-1&profile=redacted
User gklatte
Organizations
Token type personal
Dependencies:
NAME VERSION
parver 0.5
pip 24.0
pulumi 3.115.2
Pulumi locates its logs in /var/folders/5m/409zz62n0vdgbxb7nhcp6zl80000gp/T/ by default
Additional context
(Caveat: I lack familiarity with the internals of Pulumi but here is what I have observed so far)
The Read method of DynamicResourceProviderServicer receives a request without any properties. As a result, an exception is raised when trying to access the provider. The request received by DynamicResourceProviderServicer should contain a __provider property but does not.
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).
The text was updated successfully, but these errors were encountered:
Yeh this is a limitation with dynamic providers. We might be able to fix the last scenario (using the Import resource option) but as far as I know the others aren't possible to fix.
Yeh this is a limitation with dynamic providers. We might be able to fix the last scenario (using the Import resource option) but as far as I know the others aren't possible to fix.
So it is not possible for a dynamic provider, using any of the Pulumi SDKs, to import resources?
What happened?
It is not possible to import a Resource that is provided by a Dynamic Resource Provider written with the Pulumi Python SDK due to the following error:
Exception calling application: '__provider'
Example
To reproduce, use the following versions:
The python-resource-type-name example provider can demonstrate this issue. Copy the
Pulumi.yaml
and__main__.py
files to your local workspace.Run
pulumi up
to generate the stack.Then, attempt to import a resource. The name and ID of the resource are inconsequential.
You can reproduce this issue by importing from a file as well. Create a file with the following contents:
You will get the same error:
It does not matter if you specify an existing provider. Create a file with the following contents (note that the URN of your provider depends on your stack name):
You will get the same error:
The issue also appears if you try to import a resource within your source code directly. Add the following lines to the bottom of your
__main__.py
file (and importResourceOptions
atop the file):You will get the same error:
Output of
pulumi about
CLI
Version 3.115.2
Go Version go1.22.2
Go Compiler gc
Plugins
KIND NAME VERSION
language python unknown
Host
OS darwin
Version 14.4.1
Arch arm64
This project is written in python: executable='/Users/gklatte/pulumi-import-testing/venv/bin/python3' version='3.12.3'
Current Stack: organization/dynamic_resource_type_name_py/import-testing-resource
TYPE URN
pulumi:pulumi:Stack urn:pulumi:import-testing-resource::dynamic_resource_type_name_py::pulumi:pulumi:Stack::dynamic_resource_type_name_py-import-testing-resource
pulumi:providers:pulumi-python urn:pulumi:import-testing-resource::dynamic_resource_type_name_py::pulumi:providers:pulumi-python::default
pulumi-python:dynamic/custom-provider:CustomResource urn:pulumi:import-testing-resource::dynamic_resource_type_name_py::pulumi-python:dynamic/custom-provider:CustomResource::resource-name
Found no pending operations associated with import-testing-resource
Backend
Name MLLAXP1SXQ05N
URL s3://redacted?region=us-east-1&profile=redacted
User gklatte
Organizations
Token type personal
Dependencies:
NAME VERSION
parver 0.5
pip 24.0
pulumi 3.115.2
Pulumi locates its logs in /var/folders/5m/409zz62n0vdgbxb7nhcp6zl80000gp/T/ by default
Additional context
(Caveat: I lack familiarity with the internals of Pulumi but here is what I have observed so far)
The Read method of DynamicResourceProviderServicer receives a request without any properties. As a result, an exception is raised when trying to access the provider. The request received by
DynamicResourceProviderServicer
should contain a__provider
property but does not.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).
The text was updated successfully, but these errors were encountered: