https://pulumi.com logo
#general
Title
# general
c

crooked-pillow-11944

09/19/2021, 12:15 PM
I'm confused by the process of looking up an existing resource The documentation is referring to a resource id Can somebody give an example of looking up an existing s3 bucket by tag that was created outside of the current stack?
What's confusing is that
id
is required: https://www.pulumi.com/docs/reference/pkg/aws/s3/bucket/#look-up The point of the lookup should be that it returns the resource ID. What am I missing here?
l

little-cartoon-10569

09/19/2021, 8:40 PM
The id required for an import is always listed at the bottom of the docs: https://www.pulumi.com/docs/reference/pkg/aws/s3/bucket/#import So for a bucket, it's the bucket name.
b

bored-oyster-3147

09/19/2021, 9:41 PM
That is not the lookup that you want for a bucket outside the stack. That is the lookup for a bucket inside the same stack. The name parameter in that case is the Pulumi name that you provided when declaring the bucket elsewhere within the stack. It’s a bit confusing but the wording makes this apparent. It says “lookup an existing Bucket resource’s state using the given name..” This tells you that it is pulling this information from your state, or your Pulumi backend. The method that you want to use to hit your cloud provider for a bucket that might be managed by another stack, or might not be managed by Pulumi at all, is this one: https://www.pulumi.com/docs/reference/pkg/aws/s3/getbucket/