added securestring option to parameterstore create script
This commit is contained in:
@@ -58,24 +58,35 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const secureParameter = await prompt.confirm(
|
||||||
|
'Should this parameter be secure?'
|
||||||
|
);
|
||||||
|
|
||||||
|
let parameterType = 'String';
|
||||||
|
if (secureParameter) {
|
||||||
|
parameterType = 'SecureString';
|
||||||
|
}
|
||||||
|
|
||||||
if (!parameterValue.value.trim()) {
|
if (!parameterValue.value.trim()) {
|
||||||
print.error(chalk.red('Parameter value cannot be empty.'));
|
print.error(chalk.red('Parameter value cannot be empty.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmCreate = await prompt.confirm(
|
const confirmCreate = await prompt.confirm(
|
||||||
`Create [${chalk.yellow(parameterName.name)}] with value [${chalk.yellow(
|
`Create [${chalk.yellow(parameterName.name)}] with value [${chalk.green(
|
||||||
parameterValue.value
|
parameterValue.value
|
||||||
)}]?`
|
)}] as ${chalk.red(parameterType)}?`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (confirmCreate) {
|
if (confirmCreate) {
|
||||||
try {
|
try {
|
||||||
const createResult = await system.run(
|
const createResult = await system.run(
|
||||||
`aws ssm put-parameter --name "${parameterName.name}" --value "${parameterValue.value}" --type String`
|
`aws ssm put-parameter --name "${parameterName.name}" --value "${parameterValue.value}" --type ${parameterType}`
|
||||||
);
|
);
|
||||||
print.success(
|
print.success(
|
||||||
chalk.green(`Parameter "${parameterName.name}" created successfully.`)
|
chalk.green(
|
||||||
|
`Parameter "${parameterName.name}" created successfully as ${parameterType}.`
|
||||||
|
)
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print.error(chalk.red(`Failed to create parameter: ${error.message}`));
|
print.error(chalk.red(`Failed to create parameter: ${error.message}`));
|
||||||
|
|||||||
Reference in New Issue
Block a user