Closed AllegraChen closed 3 years ago
Hi @aghadiry, could you take a look at this pull request?
@aghadiry @AllegraChen next time please mention this kind of changes as BREAKING (so release a major, not a minor). I updated from 1.5 to 1.8 and builds started to fail due to the plugin assuming the config is an array.
Before this PR,
cloudfrontInvalidation
was a single object under thecustom
section of serverless.yml file. There was no possible way to create invalidations for multiple CloudFront distributions. Therefore, thecloudfrontInvalidation
object is turned into a list that can contain multiple distributions. The index.js file is modified to realize this feature. The function body ininvalidate()
is moved into...cloudfrontInvalidation.forEach()
. This feature is also mentioned in issue #8.Besides, an option of create invalidations based on deployment stages was also not available. Hence, an optional
stage
property is added for each distribution element. An if statement that checks forstage
property declaration and its matching with the provider's stage is added intoinvalidate()
in index.js file.The Setup example of
cloudfrontInvalidation
as a list and the Setup example of using thestage
property of the elements ofcloudfrontInvalidation
is added to README.md file.