Skip to content

Commit

Permalink
fix(toolkit): remove metadata warning if region does not have resource (
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr authored Apr 10, 2019
1 parent dfc6665 commit 22ed67c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/aws-cdk/lib/api/cxapp/stacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ export class AppStacks {
}
const resourcePresent = stack.environment.region === 'default-region'
|| regionInfo.Fact.find(stack.environment.region, regionInfo.FactName.cdkMetadataResourceAvailable) === 'YES';
if (!stack.template.Resources.CDKMetadata && resourcePresent) {
stack.template.Resources.CDKMetadata = {
Type: 'AWS::CDK::Metadata',
Properties: {
Modules: modules
}
};
} else {
warning(`The stack ${stack.name} already includes a CDKMetadata resource`);
if (resourcePresent) {
if (!stack.template.Resources.CDKMetadata) {
stack.template.Resources.CDKMetadata = {
Type: 'AWS::CDK::Metadata',
Properties: {
Modules: modules
}
};
} else {
warning(`The stack ${stack.name} already includes a CDKMetadata resource`);
}
}
}
}
Expand Down

0 comments on commit 22ed67c

Please sign in to comment.