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

Cannot perform aws_kms.Key.fromLookup in stacksets #564

Open
jtirrell-amazon opened this issue Sep 6, 2024 · 2 comments
Open

Cannot perform aws_kms.Key.fromLookup in stacksets #564

jtirrell-amazon opened this issue Sep 6, 2024 · 2 comments

Comments

@jtirrell-amazon
Copy link

Error: Cannot retrieve value from context provider key-provider since account/region are not specified at the stack level. Configure "env" with an account and region when you define your stack.See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more details.
    at Function.getValue (/Users/jtirrell/Documents/git-repos/gitlab/wwps-lcc-proserve/delivery-kits/secure-sight-continuous-compliance/arch/cdk_build/node_modules/aws-cdk-lib/core/lib/context-provider.js:2:562)
    at Function.fromLookup (/Users/jtirrell/Documents/git-repos/gitlab/wwps-lcc-proserve/delivery-kits/secure-sight-continuous-compliance/arch/cdk_build/node_modules/aws-cdk-lib/aws-kms/lib/key.js:1:6753)
   const secureSightKmsKey = cdk.aws_kms.Key.fromLookup(
      this,
      "secureSightKmsKey",{
      aliasName: "alias/secureSightKmsKey"
      }
    );

I would expect, because the stack-set is targeted to an account / region that the env variable should be set so that I can perform these look-ups.

@McDoit
Copy link

McDoit commented Oct 7, 2024

I assume that any stack created by stacksets needs to be region agnostic, and therefore you can't provide account/region
One way would be to create your own lookup lambda (fromLookup is usually local to your code, not cloudformation)

@CraigLager
Copy link

I have the same issue when trying to import a VPC

Error: Cannot retrieve value from context provider vpc-provider since account/region are not specified at the stack level. Configure "env" with an account and region when you define your stack.See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more details.

Any workaround so that I can import a VPC into a stacksetstack would be very welcome at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants