aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.51k stars 3.85k forks source link

(aws-servicecatalog): ProductStack Env #29219

Open J11522 opened 6 months ago

J11522 commented 6 months ago

Describe the feature

We want to be able to specify the env for the ProductStack, ie. account and/or region.

Use Case

In CDK Pipeline currently the ProductStack takes its env from the stage. In our usecase we need the Product to either be account agnostic or use an account different from the stage.

However, for cross-region deployments an account needs to be specified on the stage. This results in breaking behaviour with our account requirement from above

Proposed Solution

Expose an env property similar to regular stacks

Other Information

No response

Acknowledgements

CDK version used

2.129.0

Environment details (OS name and version, etc.)

Mac

tim-finnigan commented 6 months ago

Thanks for the feature request. There is an environment property on ProductStack, but it sounds like what you're requesting may overlap with https://github.com/aws/aws-cdk/issues/24757 - can you confirm?

J11522 commented 6 months ago

You are right, there is an environment property on the ProductStack. However, this is readonly. The issue #24757 suggests something similar, but has a subtle difference as I can tell.

In the issue, the goal is to use the scope of the ProductStack as the source of the env. While, IMHO, his seems logical, this is in contrast to the regular stack behaviour.

What I suggest is along the line of the regular stack behaviour that one can explicilty provide the env for the stack.

Basically, what I request is to make the environment property available to the user by exposing it through the props similar to how it is with StackProps https://github.com/aws/aws-cdk/blob/v2.129.0/packages/aws-cdk-lib/core/lib/stack.ts#L50

tim-finnigan commented 6 months ago

Thanks for following up, we can track this issue to get more input/discussion.