Skip to content

Commit

Permalink
Remove ssm string parameter Type references
Browse files Browse the repository at this point in the history
  • Loading branch information
biffgaut committed Feb 7, 2023
1 parent 466bded commit e029dda
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
* and limitations under the License.
*/

import {ParameterType, StringParameter, StringParameterProps} from 'aws-cdk-lib/aws-ssm';
import {StringParameter, StringParameterProps} from 'aws-cdk-lib/aws-ssm';
import {Construct} from 'constructs';
import {printWarning} from "./utils";

/**
* Method to build the default AWS SSM Parameter Store
Expand All @@ -23,14 +22,5 @@ import {printWarning} from "./utils";
* @param stringParameterProps
*/
export function buildSsmStringParameter(scope: Construct, id: string, stringParameterProps: StringParameterProps): StringParameter {
let props: StringParameterProps = stringParameterProps;

if (stringParameterProps.type && stringParameterProps.type !== ParameterType.STRING) {
printWarning('Overriding SSM String Parameter type to be ParameterType.STRING');
props = {
...stringParameterProps,
type: ParameterType.STRING
};
}
return new StringParameter(scope, id, props);
return new StringParameter(scope, id, stringParameterProps);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import {Stack} from 'aws-cdk-lib';
import * as defaults from '../';
import '@aws-cdk/assert/jest';
import {ParameterType} from 'aws-cdk-lib/aws-ssm';

// --------------------------------------------------------------
// Test minimal deployment with no properties
Expand All @@ -31,23 +30,3 @@ test('Test minimal deployment with required properties', () => {
Value: parameterValue
});
});

// --------------------------------------------------------------
// Test minimal deployment overriding parameter type
// --------------------------------------------------------------
test('Test minimal deployment with required properties', () => {
// Stack
const stack = new Stack();
// Helper declaration
const parameterValue = "test-val";
defaults.buildSsmStringParameter(stack, 'parameterName',
{
stringValue: parameterValue,
type: ParameterType.STRING_LIST,
});

expect(stack).toHaveResourceLike('AWS::SSM::Parameter', {
Type: 'String',
Value: parameterValue
});
});

0 comments on commit e029dda

Please sign in to comment.