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

Add experimental flag for enabling CDK lookups #235

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

corymhall
Copy link
Contributor

This adds a new environment variable flag
PULUMI_CDK_EXPERIMENTAL_LOOKUPS that enables CDK lookups during preview operations.

I am working on adding the documentation in a follow up PR #234

re #184

This adds a new environment variable flag
`PULUMI_CDK_EXPERIMENTAL_LOOKUPS` that enables CDK lookups during
preview operations.

I am working on adding the documentation in a follow up PR #234

re #184
try {
// TODO: support lookups https://github.com/pulumi/pulumi-cdk/issues/184
await cli.synth({ quiet: true, lookups: false });
await cli.synth({ quiet: true, lookups });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine assuming we document that folks cannot add pulumi resources in their stacks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed a commit here that documents how this would work. Pretty much all apps will have pulumi resources due to the asset stuff.

#234

} catch (e: any) {
if (typeof e.message === 'string' && e.message.includes('Context lookups have been disabled')) {
const message = e.message as string;
const messageParts = message.split('Context lookups have been disabled. ');
const missingParts = messageParts[1].split('Missing context keys: ');
throw new Error(
'Context lookups have been disabled. Make sure all necessary context is already in "cdk.context.json". \n' +
'Context lookups have been disabled. Make sure all necessary context is already in "cdk.context.json". ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this look like for an app with multiple stacks (or multiple apps) in one repo? Does "cdk.context.json" contain the context for all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes cdk.context.json contains context for the entire app. It's currently not possible to have multiple apps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks!

@corymhall corymhall self-assigned this Nov 20, 2024
@corymhall corymhall merged commit 5464a55 into main Nov 20, 2024
13 checks passed
@corymhall corymhall deleted the corymhall/lookups-flag branch November 20, 2024 18:10
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v1.0.0.

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

Successfully merging this pull request may close these issues.

3 participants