Skip to content

Commit

Permalink
Show depreciation warning unconditionnally
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericbarthelet committed Sep 23, 2020
1 parent 15db8f5 commit 1c927bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/configSchema.js
Expand Up @@ -125,7 +125,7 @@ const schema = {
additionalProperties: false,
required: ['provider', 'service'],
definitions: {
// TODO: awsKmsArn definition to be moved to lib/plugins/aws/provider/awsProvider.js once service.awsKmsKeyArn removed with v2.0.0, see https://github.com/serverless/serverless/issues/8261
// TODO: awsKmsArn definition to be moved to lib/plugins/aws/provider/awsProvider.js once service.awsKmsKeyArn removed with v3.0.0, see https://github.com/serverless/serverless/issues/8261
// TODO: awsKmsArn to include #/definitions/awsCfFunction instead of type: object as one of the possible definition, see https://github.com/serverless/serverless/issues/8261
awsKmsArn: {
anyOf: [{ type: 'object' }, { type: 'string', pattern: '^arn:aws[a-z-]*:kms' }],
Expand Down
25 changes: 15 additions & 10 deletions lib/plugins/aws/package/compile/functions/index.js
Expand Up @@ -212,21 +212,26 @@ class AwsCompileFunctions {

let kmsKeyArn;
const serviceObj = this.serverless.service.serviceObject;
if (functionObject.kmsKeyArn || this.serverless.service.provider.kmsKeyArn) {
kmsKeyArn = functionObject.kmsKeyArn || this.serverless.service.provider.kmsKeyArn;
} else if (functionObject.awsKmsKeyArn) {
this.serverless._logDeprecation(
'FUNCTION_DEPRECATED_PROPERTY_AWS_KMS_KEY_ARN',
'Starting with next major version, awsKmsKeyArn function property will be replaced by kmsKeyArn.'
);
kmsKeyArn = functionObject.awsKmsKeyArn;
} else if (serviceObj && serviceObj.awsKmsKeyArn) {
if (serviceObj && serviceObj.awsKmsKeyArn) {
this.serverless._logDeprecation(
'SERVICE_DEPRECATED_PROPERTY_AWS_KMS_KEY_ARN',
'Starting with next major version, awsKmsKeyArn service property will be replaced by provider.kmsKeyArn.'
'Starting with next major version, awsKmsKeyArn service property will be replaced by provider.kmsKeyArn'
);
kmsKeyArn = serviceObj.awsKmsKeyArn;
}
if (this.serverless.service.provider.kmsKeyArn) {
kmsKeyArn = this.serverless.service.provider.kmsKeyArn;
}
if (functionObject.awsKmsKeyArn) {
this.serverless._logDeprecation(
'FUNCTION_DEPRECATED_PROPERTY_AWS_KMS_KEY_ARN',
'Starting with next major version, awsKmsKeyArn function property will be replaced by kmsKeyArn'
);
kmsKeyArn = functionObject.awsKmsKeyArn;
}
if (functionObject.kmsKeyArn) {
kmsKeyArn = functionObject.kmsKeyArn;
}

if (kmsKeyArn) {
if (typeof kmsKeyArn === 'string') {
Expand Down

0 comments on commit 1c927bc

Please sign in to comment.