Is it possible to import component resources in th...
# getting-started
r
Is it possible to import component resources in the CLI? You can see I successfully imported 3 resources related to an S3 bucket, but it's at the root of the stack. I want to import them into the S3Bucket component I've created. I assume this is possible with a resource import, but is it possible from the CLI bulk import?
g
You can uses
aliases
to change the parent of the resource to your component. https://www.pulumi.com/blog/cumundi-guest-post/
r
Makes sense, but we have over 500 resources to import and I was hoping I could import them directly into the final structure instead of aliasing all of them
g
You can set the parent with
pulumi import --parent ...
if that's how you're importing it.
r
Aha! And that works for arbitrarily deep nesting? In the example screenshot above, I would be importing under
panther:s3Bucket
(component) ->
aws:s3:Bucket
->
aws:s3:BucketPublicAccessBlock
g
Yep, I believe so.
r
Great, I will try that, thank you! Last question - is there any meaningful difference between importing it from within Pulumi code and using the CLI?