Skip to content

Commit

Permalink
feat(AWS HTTP API): Always apply provider.tags to HTTP API
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Tags from `provider.tags` are applied by default to HTTP API
Gateway.
  • Loading branch information
pgrzesik authored and medikoo committed Jan 27, 2022
1 parent b8019d8 commit b34d549
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
30 changes: 2 additions & 28 deletions lib/plugins/aws/package/compile/events/httpApi.js
Expand Up @@ -43,24 +43,6 @@ class HttpApiEvents {
serverless.httpApiEventsPlugin = this;

this.hooks = {
'initialize': () => {
if (
this.serverless.service.provider.name === 'aws' &&
this.serverless.service.provider.tags &&
!_.get(this.serverless.service.provider.httpApi, 'useProviderTags') &&
Object.values(this.serverless.service.functions).some(({ events }) =>
events.some(({ httpApi }) => httpApi)
)
) {
this.serverless._logDeprecation(
'AWS_HTTP_API_USE_PROVIDER_TAGS',
'Starting with next major version, the provider tags ' +
'will be applied to Http Api Gateway by default. \n' +
'Set "provider.httpApi.useProviderTags" to "true" ' +
'to adapt to the new behavior now.'
);
}
},
'package:compileEvents': () => {
this.resolveConfiguration();
if (!this.config.routes.size) return;
Expand Down Expand Up @@ -117,11 +99,7 @@ class HttpApiEvents {
DisableExecuteApiEndpoint:
this.config.disableDefaultEndpoint == null ? undefined : this.config.disableDefaultEndpoint,
};
if (
this.serverless.service.provider.tags &&
this.serverless.service.provider.httpApi &&
this.serverless.service.provider.httpApi.useProviderTags
) {
if (this.serverless.service.provider.tags) {
const tags = Object.assign({}, this.serverless.service.provider.tags);
properties.Tags = tags;
}
Expand Down Expand Up @@ -167,11 +145,7 @@ class HttpApiEvents {
},
};

if (
this.serverless.service.provider.tags &&
this.serverless.service.provider.httpApi &&
this.serverless.service.provider.httpApi.useProviderTags
) {
if (this.serverless.service.provider.tags) {
properties.Tags = Object.assign({}, this.serverless.service.provider.tags);
}

Expand Down
Expand Up @@ -201,7 +201,6 @@ describe('lib/plugins/aws/package/compile/events/httpApi.test.js', () => {
audience: 'audiencexxx',
},
},
useProviderTags: true,
},
logs: {
httpApi: true,
Expand Down

0 comments on commit b34d549

Please sign in to comment.