pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

Wrong argument name for bucket name for BucketV2 object doc

Open bolinocroustibat opened this issue 3 years ago • 2 comments
trafficstars

On the page: https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketv2/, at least for the Python version (I didn't check the other languages) :

  1. When instanciating/creating a bucketV2, it seems the argument name for naming the bucket is resource_name, but Ii a resource_name is provided, it will output an error. It seems it should be bucket_name. Should be fixed, and/or clarified.

  2. Are we sure this argument resource_name/bucket_name is mandatory? It doesn't look like so, from my tries.

  3. Also, I think the example should include the naming of the bucket

  4. Doesn't the Bucket v1 documentation have the same issue?

bolinocroustibat avatar Aug 29 '22 15:08 bolinocroustibat

Hi @bolinocroustibat - thank you for filing these issues!

We are hoping to fix issues like this soon.

guineveresaenger avatar Aug 30 '22 00:08 guineveresaenger

@bolinocroustibat resource_name is the Pulumi identifier - all Pulumi resources have this property, and it's always the first parameter. aws.s3.BucketV2Args.bucket or aws.s3.BucketV2Args.bucket_prefix is the name of the bucket (the latter will have a random suffix appended).

If you do not specify aws.s3.BucketV2Args, your bucket will be auto-named after the resource name. If you explicitly specify aws.s3.BucketV2Args.bucket, your bucket will have that exact name.

import pulumi
import pulumi_aws as aws

my_bucket = aws.s3.BucketV2(
    "my-bucket",
)

someone_elses_bucket = aws.s3.BucketV2(
    "someone-elses-bucket",
    aws.s3.BucketV2Args(
        bucket="explicit-bucket-name"
    )
)

pulumi.export("bucket_name", my_bucket.bucket)
pulumi.export("someone_elses_bucket", someone_elses_bucket.bucket)
$ pulumi stack output
Current stack outputs (2):
    OUTPUT                VALUE
    bucket_name           my-bucket-2cce17e
    someone_elses_bucket  explicit-bucket-name

jkodroff avatar Sep 17 '22 21:09 jkodroff

Closing per the answer provided above.

lukehoban avatar Dec 28 '22 04:12 lukehoban

@lukehoban Thanks for the answer, but the ticket was about updating and clarifying the documentation, as we were several coders confused with that.

bolinocroustibat avatar Dec 29 '22 12:12 bolinocroustibat