From ca705b8cc2854c302158a56294c2507ba5f2038f Mon Sep 17 00:00:00 2001 From: Piotr Grzesik Date: Tue, 12 Oct 2021 15:28:27 +0200 Subject: [PATCH] refactor(CLI): Introduce modern warning about resource limit --- lib/plugins/aws/info/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/plugins/aws/info/index.js b/lib/plugins/aws/info/index.js index f997a67c3da..69a2ef87359 100644 --- a/lib/plugins/aws/info/index.js +++ b/lib/plugins/aws/info/index.js @@ -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'); @@ -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;