mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
feat(AWS EventBridge): Adjust deprecation of deployment method
This commit is contained in:
parent
889e1be58c
commit
bf62b7c4da
@ -188,10 +188,12 @@ Starting with v3.0.0, `http.request.schema` property will be replaced by `http.r
|
||||
|
||||
Deprecation code: `AWS_EVENT_BRIDGE_CUSTOM_RESOURCE`
|
||||
|
||||
Starting with v3.0.0 AWS EventBridge lambda event triggers and all associated EventBridge resources will be deployed using native CloudFormation resources instead of a custom resource that used a lambda to deploy them via the AWS SDK/API.
|
||||
Starting with v3.0.0, AWS EventBridge lambda event triggers and all associated EventBridge resources will be, by default, deployed using native CloudFormation resources instead of a custom resource that used a lambda to deploy them via the AWS SDK/API.
|
||||
|
||||
Adapt to this behavior now by setting `provider.eventBridge.useCloudFormation: true`.
|
||||
|
||||
If you want to keep using the old deployment method for your AWS EventBridge resources, set `provider.eventBridge.useCloudFormation: false` instead.
|
||||
|
||||
<a name="NEW_VARIABLES_RESOLVER"><div> </div></a>
|
||||
|
||||
## New variables resolver
|
||||
|
||||
@ -13,14 +13,14 @@ class AwsCompileEventBridgeEvents {
|
||||
|
||||
this.hooks = {
|
||||
'initialize': () => {
|
||||
if (!_.get(this.serverless.service.provider, 'eventBridge.useCloudFormation')) {
|
||||
if (_.get(this.serverless.service.provider, 'eventBridge.useCloudFormation') == null) {
|
||||
const hasFunctionsWithEventBridgeTrigger = Object.values(
|
||||
this.serverless.service.functions
|
||||
).some(({ events }) => events.some(({ eventBridge }) => eventBridge));
|
||||
if (hasFunctionsWithEventBridgeTrigger) {
|
||||
this.serverless._logDeprecation(
|
||||
'AWS_EVENT_BRIDGE_CUSTOM_RESOURCE',
|
||||
'AWS EventBridge resources are not being created using native CloudFormation, this is now possible and the use of custom resources is deprecated. Set `eventBridge.useCloudFormation: true` as a provider property to use this now.'
|
||||
'Starting with "v3.0.0", AWS EventBridge resources will be created using native CloudFormation resources by default. It is possible to use that functionality now by setting "eventBridge.useCloudFormation: true" as provider property in your configuration. If you want to keep using the old creation method, set that property to "false" to hide this deprecation message.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -851,7 +851,7 @@ class AwsProvider {
|
||||
eventBridge: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
useCloudFormation: { const: true },
|
||||
useCloudFormation: { type: 'boolean' },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
|
||||
@ -163,8 +163,12 @@ describe('EventBridgeEvents', () => {
|
||||
const { cfTemplate, awsNaming } = await runServerless({
|
||||
fixture: 'function',
|
||||
configExt: {
|
||||
disabledDeprecations: ['AWS_EVENT_BRIDGE_CUSTOM_RESOURCE'],
|
||||
...serverlessConfigurationExtension,
|
||||
provider: {
|
||||
eventBridge: {
|
||||
useCloudFormation: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
command: 'package',
|
||||
});
|
||||
@ -364,6 +368,21 @@ describe('EventBridgeEvents', () => {
|
||||
'ERROR_INVALID_REFERENCE_TO_EVENT_BUS_CUSTOM_RESOURCE'
|
||||
);
|
||||
});
|
||||
|
||||
it('should emit deprecation when `eventBridge.useCloudFormation` is not explicitly set', async () => {
|
||||
await expect(
|
||||
runServerless({
|
||||
fixture: 'function',
|
||||
configExt: {
|
||||
...serverlessConfigurationExtension,
|
||||
},
|
||||
command: 'package',
|
||||
})
|
||||
).to.be.eventually.rejected.and.have.property(
|
||||
'code',
|
||||
'REJECTED_DEPRECATION_AWS_EVENT_BRIDGE_CUSTOM_RESOURCE'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('using native CloudFormation', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user