Skip to content

Commit

Permalink
refactor(CLI): Introduce modern warning about resource limit
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Oct 13, 2021
1 parent 8e6dcd1 commit ca705b8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/plugins/aws/info/index.js
Expand Up @@ -8,6 +8,7 @@ const getStackInfo = require('./getStackInfo');
const getResourceCount = require('./getResourceCount');
const getApiKeyValues = require('./getApiKeyValues');
const display = require('./display');
const { log } = require('@serverless/utils/log');

const mainProgress = progress.get('main');

Expand Down Expand Up @@ -72,6 +73,18 @@ class AwsInfo {
'aws:info:displayStackOutputs': async () =>
BbPromise.bind(this).then(this.displayStackOutputs),

'after:aws:info:gatherData': () => {
if (this.gatheredData.info.resourceCount >= 450) {
log.warning(
`You have ${
this.gatheredData.info.resourceCount
} resources in your service. CloudFormation has a hard limit of 500 resources in a service. For advice on avoiding this limit, check out this link: ${style.link(
'http://slss.io/2q2'
)}.`
);
}
},

'finalize': () => {
if (this.serverless.processedInput.commands.join(' ') !== 'info') return;

Expand Down

0 comments on commit ca705b8

Please sign in to comment.