use of com.scaleset.cfbuilder.core.Parameter in project TOSCAna by StuPro-TOSCAna.
the class CloudFormationFileCreator method writeStackCreationScript.
/**
* Creates the script for creating the CloudFormation stack from the template.
*/
private void writeStackCreationScript() throws IOException {
logger.debug("Creating create-stack script.");
BashScript createStackScript = new BashScript(cfnModule.getFileAccess(), FILENAME_CREATE_STACK);
// Build deploy command
StringBuilder deployCommand = new StringBuilder("");
deployCommand.append(CLI_COMMAND_CREATESTACK + CLI_PARAM_STACKNAME).append(cfnModule.getStackName()).append(" ").append(CLI_PARAM_TEMPLATEFILE).append("../").append(TEMPLATE_YAML);
// Add IAM capability if needed
List<FileUpload> fileUploadList = cfnModule.getFileUploadList();
if (!fileUploadList.isEmpty()) {
logger.debug("Adding IAM capability to create stack command.");
deployCommand.append(" " + CLI_PARAM_CAPABILITIES + " " + CAPABILITY_IAM);
}
// Add parameters if needed
Map<String, Parameter> parameters = cfnModule.getParameters();
if (!parameters.isEmpty()) {
logger.debug("Adding parameters to create stack command.");
deployCommand.append(" " + CLI_PARAM_PARAMOVERRIDES);
for (Map.Entry<String, Parameter> entry : parameters.entrySet()) {
String id = entry.getKey();
deployCommand.append(" ").append(id).append("=$").append(id).append("Var");
}
}
createStackScript.append(deployCommand.toString());
}
Aggregations