-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cannot import a Resource provided by a Python Dynamic Resource Provider #16175
Comments
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? |
Having that last option, using My path for getting here was:
I was a little surprised this issue is only 3 weeks old as I would imagine this to be a somewhat common path. In my case, deleting/recreating resources is possible but it would be a large QOL improvement if I could import resources since there is historical data associated with them. |
I too was surprised to not find an existing issue documenting this problem. My work around has been to write a Pulumi Native provider for my resources instead of using a Dynamic Resource provider. That work is ongoing but I am hopeful that the path is smoother. |
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: