https://pulumi.com logo
#aws
Title
g

gifted-yak-28427

01/27/2021, 1:44 PM
I'm trying to import an existing bucket with:
Copy code
bucket_sse = aws.s3.Bucket.get(
    resource_name = "dev-file-storage-sse",
    id = "arn:aws:s3:::dev-file-storage-sse"
)
Pulumi complaining about the arn though:
Copy code
aws:s3:Bucket (dev-file-storage-sse):
    error: Preview failed: refreshing urn:pulumi:sandbox1::compute::aws:s3/bucket:Bucket::dev-file-storage-sse: 1 error occurred:
    	* error reading S3 Bucket (arn:aws:s3:::dev-file-storage-sse): InvalidARNError: invalid ARN
    caused by: invalid Amazon s3 ARN, unknown resource type, arn:aws:s3:::dev-file-storage-sse
The arn was copied from the console, so it's correct. Am I missing something obvious here? I can access the bucket without issues from the cli using the same user that pulumi is running with.
b

brave-planet-10645

01/27/2021, 1:51 PM
The ID in this case is just the bucket name. So your code should be
Copy code
bucket_sse = aws.s3.Bucket.get(
    resource_name = "dev-file-storage-sse",
    id = "dev-file-storage-sse"
)
g

gifted-yak-28427

01/27/2021, 2:07 PM
Oh for * sake! I just assumed "id" meant arn without checking! Thanks!
b

brave-planet-10645

01/27/2021, 2:34 PM
🙂
3 Views