Skip to content

Commit

Permalink
fix(cli): do not bootstrap unknown environments (aws#3046)
Browse files Browse the repository at this point in the history
"cdk bootstrap" without arguments will automatically bootstrap all environments
defined in the app. now that stacks can be environment-agnostic (aws://unknown-account/unknown-region),
we need to filter those environments in this use case.
  • Loading branch information
Elad Ben-Israel authored Jun 24, 2019
1 parent ba2ace6 commit 000dd53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/aws-cdk/lib/api/cxapp/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export async function globEnvironmentsFromStacks(appStacks: AppStacks, environme

const stacks = await appStacks.listStacks();

const availableEnvironments = distinct(stacks.map(stack => stack.environment)
.filter(env => env !== undefined) as cxapi.Environment[]);
const availableEnvironments = distinct(stacks
.map(stack => stack.environment)
.filter(env => env && env.account !== cxapi.UNKNOWN_ACCOUNT && env.region !== cxapi.UNKNOWN_REGION) as cxapi.Environment[]);

const environments = availableEnvironments.filter(env => environmentGlobs.find(glob => minimatch(env!.name, glob)));
if (environments.length === 0) {
const globs = JSON.stringify(environmentGlobs);
Expand Down

0 comments on commit 000dd53

Please sign in to comment.