Why does let siteBucket = new aws.s3.Bucket(“s3-bo...
# general
f
Why does let siteBucket = new aws.s3.Bucket(“s3-bob-pr000001”); result in a bucket name of s3-bob-pr000001-d16b3d1 ?
m
The Pulumi AWS provider adds a bit of randomness to the names of its resources by default in order to help ensure uniqueness. You can override this by manually specifying a name. In the case of
aws.s3.Bucket
, IIRC you would do this:
Copy code
new aws.s3.Bucket("my-bucket", { bucket: "my-bucket" })
c
This is super useful when you want to replace a bucket in-place, for example.
s
In effect (if you know the Terraform provider) you can think of it as setting
name_prefix
rather than
name
for resources which support that
f
thanks, yes I can see why in some cases having the unique name is handy, in this case I just wanted what I asked for. Thanks for the explantation and example that solves my issue.
Not sure if this is worth me creating a github issue, but why when doing this with bucket vs sqs is one called bucket and the other name?
let siteBucket = new aws.s3.Bucket(“s3-bob-pr000001”, { bucket: “s3-bob-pr000001" }) let sqs = new aws.sqs.Queue(“sqs-bob-pr000001”, { name: “sqs-bob-pr000001"})
Not trolling just curios
🙂
hmm maybe because that’s how terraform is doing it
s
That’s inherited from the Terraform provider, which inherits it from the API
f
yeah got it