I'm creating a bucket and a bucket policy using Pu...
# aws
q
I'm creating a bucket and a bucket policy using Pulumi / Python. How to get the bucket arn from a bucket resource for creating the bucket policy? If I try to get the bucket arn in the same
pulumi up
run (i.e. creating the bucket and bucket policy) I get
required field is not set
.
l
You’re getting the error trying access
bucket.arn
with something like:
Copy code
import pulumi
import pulumi_aws as aws

bucket = aws.s3.Bucket("newBucket")
Maybe try
bucket.id
instead?
g
q
I found a way to do it yesterday:
Copy code
policy = bucket.id.apply(lambda id:
            '''
            {{
...
               "Resource": "arn:aws:s3:::{my_id}/*"
...
'''.format(my_id=id)...