Maybe not Python specific, but I've got a question...
# python
Maybe not Python specific, but I've got a question about importing a resource into the state. My particular problem is, I have two AWS accounts and my code uses a provider to configure resources in the second account. I cannot delete and recreate them easily, thus I have to import these, but how do I import resources located in a second account?
you can specify the provider while importing the resources
Do you have an example for this?
do you already have a provider defined in the state for the second account?
I thought yes, but my pulumi run said it will create it
But I can create a resource and remove it so the provider will be persisted in the state
Create it then. You will need an existing provider instance if you want to easily import the resource.
you can create the provider itself, you don’t have to create any resources linked to it
Once you have a configured provider in the state, get its URN (you can find it using e.g.
pulumi stack --show-urns
). Once you have it, use
flag available in
pulumi import
Copy code
pulumi import --provider my_provider_name='<PROVIDER>' github:index/repository:Repository just-a-test just-a-test
can be anything AFAIK - it will just be used in generate code template (you can reuse the variable name you used for provider so the snippet will be adjusted to it out of the box)
make sure you provide
within single quotes (URNs usually contain dollar signs and it breaks the shell substitution)
Ok, thanks
Will give it a try
Will report later, got pulled into a meeting
@prehistoric-activity-61023 And of course I forgot to report back .. it did work 😁
🙌 1