Open Chriscbr opened 4 months ago
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
Mmm - I see, yeah that makes sense.
We need this!
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: https://github.com/winglang/wing/blob/734a760cc94748deb880b424e92b0fac4a696411/libs/wingsdk/src/target-tf-aws/api.ts#L319-L322Proposed Solution
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
orawscdk
).Component
SDK
Community Notes