pulumi-aws
pulumi-aws copied to clipboard
Wrong argument name for bucket name for BucketV2 object doc
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) :
-
When instanciating/creating a bucketV2, it seems the argument name for naming the bucket is
resource_name, but Ii aresource_nameis provided, it will output an error. It seems it should bebucket_name. Should be fixed, and/or clarified. -
Are we sure this argument
resource_name/bucket_nameis mandatory? It doesn't look like so, from my tries. -
Also, I think the example should include the naming of the bucket
-
Doesn't the Bucket v1 documentation have the same issue?
Hi @bolinocroustibat - thank you for filing these issues!
@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
Closing per the answer provided above.
@lukehoban Thanks for the answer, but the ticket was about updating and clarifying the documentation, as we were several coders confused with that.