Skip to content

Commit

Permalink
chore: Add note that assets are not account for in diff (#1439)
Browse files Browse the repository at this point in the history
Fixes #1327
Related to #395
  • Loading branch information
RomainMuller authored Dec 27, 2018
1 parent 04217a5 commit 36f69b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/aws-cdk/lib/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { print, warning } from './logging';
* @returns the count of differences that were rendered.
*/
export function printStackDiff(oldTemplate: any, newTemplate: cxapi.SynthesizedStack, strict: boolean): number {
if (_hasAssets(newTemplate)) {
const issue = 'https://github.com/awslabs/aws-cdk/issues/395';
warning(`The ${newTemplate.name} stack uses assets, which are currently not accounted for in the diff output! See ${issue}`);
}

const diff = cfnDiff.diffTemplate(oldTemplate, newTemplate.template);

// filter out 'AWS::CDK::Metadata' resources from the template
Expand Down Expand Up @@ -88,3 +93,7 @@ function buildLogicalToPathMap(template: cxapi.SynthesizedStack) {
}
return map;
}

function _hasAssets(stack: cxapi.SynthesizedStack) {
return Object.values(stack.metadata).find(entries => entries.find(entry => entry.type === cxapi.ASSET_METADATA) != null) != null;
}

0 comments on commit 36f69b6

Please sign in to comment.