From 629eaaa9f20273aaa6d370d00ed8e39b329ea73e Mon Sep 17 00:00:00 2001 From: ColdFire87 Date: Thu, 2 Apr 2020 17:01:16 +0100 Subject: [PATCH] fix: allow param `value` to be `string | object` --- src/index.ts | 2 +- src/types.ts | 2 +- src/util.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index b1f6758..65a1ea0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -216,7 +216,7 @@ class ServerlessSSMPublish { { Name: param.path, Description: param.description || `Placed by ${this.serverless.service.getServiceName()} - serverless-ssm-plugin`, - Value: param.value, + Value: typeof param.value === 'string' ? param.value : JSON.stringify(param.value), Overwrite: true, Type: param.secure ? 'SecureString' : 'String', }, diff --git a/src/types.ts b/src/types.ts index 79dc70f..6a6a640 100644 --- a/src/types.ts +++ b/src/types.ts @@ -58,7 +58,7 @@ export interface SSMParamCloudFormation extends BaseSSMParam { } export interface SSMParamWithValue extends BaseSSMParam { - value: string; + value: string | object; } export type SSMParam = SSMParamWithValue | SSMParamCloudFormation; diff --git a/src/util.ts b/src/util.ts index ea99a0c..c2ff41a 100644 --- a/src/util.ts +++ b/src/util.ts @@ -87,7 +87,7 @@ export const compareParams = (localParams: SSMParamWithValue[], remoteParams: SS acc.nonExistingParams.push(curr); return acc; } - if (existingParam.Value === curr.value) { + if (existingParam.Value === (typeof curr.value === 'string' ? curr.value : JSON.stringify(curr.value))) { acc.existingUnchangedParams.push(curr); return acc; }