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

aws.region API #6794

Open
Chriscbr opened this issue Jun 26, 2024 · 2 comments
Open

aws.region API #6794

Chriscbr opened this issue Jun 26, 2024 · 2 comments
Labels
☁️ aws Related to Amazon Web Services support ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK

Comments

@Chriscbr
Copy link
Contributor

Chriscbr commented Jun 26, 2024

Use Case

As a user, when I'm compiling a Wing app to one of the AWS platforms, I'd like to have a way to easily access the AWS region my app's resources are being deployed to so that I can use it for constructing ARNs and other things like that.

We already use region information in the TypeScript implementations of some of the built-in cloud classes:

const app = App.of(this) as App;
this.id = id;
this.region = app.region;
this.accountId = app.accountId;

Proposed Solution

bring aws;

let region = aws.region; // str

Implementation Notes

By default the AWS Terraform Provider operates in a single region and also CloudFormation runs deployments in a single region.

The implementation of aws.region needs to somehow depend on which target you're compiling to (tf-aws or awscdk).

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.
@Chriscbr Chriscbr added ✨ enhancement New feature or request 🎨 sdk SDK ☁️ aws Related to Amazon Web Services support needs-discussion Further discussion is needed prior to impl labels Jun 26, 2024
@eladb
Copy link
Contributor

eladb commented Jun 26, 2024

The "correct" way to obtain the current region and account is using a terraform data element.

See https://github.com/winglang/winglibs/blob/main/containers/aws.w as an example.

I suspect a global aws.region won't work without tree scope, so it will need to be something like: aws.Region.of(this) or aws.Environment.of(this).region

@Chriscbr
Copy link
Contributor Author

Mmm - I see, yeah that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☁️ aws Related to Amazon Web Services support ✨ 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

2 participants