How to use the @aws-cdk/cloudformation-diff.ResourceImpact function in @aws-cdk/cloudformation-diff

To help you get started, we’ve selected a few @aws-cdk/cloudformation-diff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / assert / lib / assertions / match-template.ts View on Github external
for (const change of Object.values(diff.resources.changes)) {
        if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) { return false; }
        if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) { return false; }
      }

      for (const change of Object.values(diff.parameters.changes)) {
        if (change.isUpdate) { return false; }
      }

      for (const change of Object.values(diff.outputs.changes)) {
        if (change.isUpdate) { return false; }
      }
      return true;
    case MatchStyle.SUPERSET:
      for (const change of Object.values(diff.resources.changes)) {
        if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) { return false; }
      }

      for (const change of Object.values(diff.parameters.changes)) {
        if (change.isAddition) { return false; }
      }

      for (const change of Object.values(diff.outputs.changes)) {
        if (change.isAddition || change.isUpdate) { return false; }
      }

      return true;
    }
    throw new Error(`Unsupported match style: ${this.matchStyle}`);
  }
github aws / aws-cdk / packages / @aws-cdk / assert / lib / assertions / match-template.ts View on Github external
private isDiffAcceptable(diff: cfnDiff.TemplateDiff): boolean {
    switch (this.matchStyle) {
    case MatchStyle.EXACT:
      return diff.differenceCount === 0;
    case MatchStyle.NO_REPLACES:
      for (const change of Object.values(diff.resources.changes)) {
        if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) { return false; }
        if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) { return false; }
      }

      for (const change of Object.values(diff.parameters.changes)) {
        if (change.isUpdate) { return false; }
      }

      for (const change of Object.values(diff.outputs.changes)) {
        if (change.isUpdate) { return false; }
      }
      return true;
    case MatchStyle.SUPERSET:
      for (const change of Object.values(diff.resources.changes)) {
        if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) { return false; }
      }

      for (const change of Object.values(diff.parameters.changes)) {
github aws / aws-cdk / packages / @aws-cdk / assert / lib / assertions / match-template.ts View on Github external
private isDiffAcceptable(diff: cfnDiff.TemplateDiff): boolean {
    switch (this.matchStyle) {
    case MatchStyle.EXACT:
      return diff.differenceCount === 0;
    case MatchStyle.NO_REPLACES:
      for (const change of Object.values(diff.resources.changes)) {
        if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) { return false; }
        if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) { return false; }
      }

      for (const change of Object.values(diff.parameters.changes)) {
        if (change.isUpdate) { return false; }
      }

      for (const change of Object.values(diff.outputs.changes)) {
        if (change.isUpdate) { return false; }
      }
      return true;
    case MatchStyle.SUPERSET:
      for (const change of Object.values(diff.resources.changes)) {
        if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) { return false; }
      }

@aws-cdk/cloudformation-diff

Utilities to diff CDK stacks against CloudFormation templates

Apache-2.0
Latest version published 2 days ago

Package Health Score

98 / 100
Full package analysis