Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify cloud.Bucket name #6725

Open
ekeren opened this issue Jun 17, 2024 · 3 comments
Open

Specify cloud.Bucket name #6725

ekeren opened this issue Jun 17, 2024 · 3 comments
Labels
✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK

Comments

@ekeren
Copy link
Collaborator

ekeren commented Jun 17, 2024

Use Case

you can now create a bucket with a name

Proposed Solution

new cloud.Bucket(name: "a-globally-unique-name-or-it-will-fail-when-trying-to-deploy-on-aws") ;

Implementation Notes

No response

Component

SDK

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.
@ekeren ekeren added ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl labels Jun 17, 2024
@Chriscbr Chriscbr changed the title bucket name Specify cloud.Bucket name Jun 21, 2024
@Chriscbr Chriscbr added the 🎨 sdk SDK label Jun 21, 2024
@Chriscbr
Copy link
Contributor

Out of curiosity what's the use case for using a specific bucket name? On AWS all buckets globally must have unique names, so any fixed name you choose in your Wing source code would only be able to be used once (and it would cause issues if you are trying to define a reusable library or deploy your app to multiple environments).

Maybe it makes sense to support this through a platform parameter instead?

@ekeren
Copy link
Collaborator Author

ekeren commented Jun 22, 2024

I was working on recreating a blog post that used a bucket as the source of images

But even when I was using bucket before, it was convenient to have names especially when they where public. It is true the I had buckets prefixed with the environment.

Do you mind showing how this will work with platform parameters, I am interested seeing a simple solution for such a common requirement

@hasanaburayyan
Copy link
Collaborator

Do you mind showing how this will work with platform parameters, I am interested seeing a simple solution for such a common requirement

@ekeren

It would be simple to add custom prefix to a bucket using platform parameters, i.e. you could have a wing.toml with something like

[ my-tf-aws-platform ]
bucket_prefix = "blah"

And then just a simple hook on newInstance that adds this to instances of buckets

However if your naming conventions or even desired full name is different per bucket, then this is not ideal for platform parameters, as it becomes very obscure and the platform code becomes tightly coupled to your Wing code.


Im not sure of the use case for specifying full names of bucket, I know it can definitely cause issues as @Chriscbr mentioned with libraries.

I know there are certain types of patterns where naming buckets matter, like very simple static sites hosted in s3 sometimes will use a www.xxxx.com naming convention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

3 participants