List of usage examples for com.amazonaws.services.cloudformation.model StackStatus CREATE_COMPLETE
StackStatus CREATE_COMPLETE
To view the source code for com.amazonaws.services.cloudformation.model StackStatus CREATE_COMPLETE.
Click Source Link
From source file:CloudFormation.java
License:Open Source License
public static String waitForCompletion(AmazonCloudFormation stackbuilder, String stackName) throws Exception { DescribeStacksRequest wait = new DescribeStacksRequest(); wait.setStackName(stackName);/* w ww . jav a 2s . c o m*/ Boolean completed = false; String stackStatus = "Unknown"; String stackReason = ""; System.out.print("Waiting"); while (!completed) { List<Stack> stacks = stackbuilder.describeStacks(wait).getStacks(); if (stacks.isEmpty()) { completed = true; stackStatus = "NO_SUCH_STACK"; stackReason = "Stack has been deleted"; } else { for (Stack stack : stacks) { if (stack.getStackStatus().equals(StackStatus.CREATE_COMPLETE.toString()) || stack.getStackStatus().equals(StackStatus.CREATE_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.ROLLBACK_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.DELETE_FAILED.toString())) { completed = true; stackStatus = stack.getStackStatus(); stackReason = stack.getStackStatusReason(); } } } // Show we are waiting System.out.print("."); // Not done yet so sleep for 10 seconds. if (!completed) Thread.sleep(10000); } // Show we are done System.out.print("done\n"); return stackStatus + " (" + stackReason + ")"; }
From source file:br.com.ingenieux.mojo.cloudformation.AbstractCloudformationMojo.java
License:Apache License
/** * Lookups a Stack/*from w w w . j a v a 2 s . c om*/ */ protected void ensureStackLookup() { if (isNotEmpty(stackId)) return; getLog().info("Looking up stackId (stack name: " + stackName + ")"); final Pattern namePattern; if (GlobUtil.hasWildcards(stackName)) { namePattern = GlobUtil.globify(stackName); } else { namePattern = Pattern.compile(Pattern.quote(stackName)); } String nextToken = null; final ListStacksRequest req = new ListStacksRequest().withStackStatusFilters(StackStatus.CREATE_COMPLETE, StackStatus.CREATE_FAILED, StackStatus.UPDATE_COMPLETE); do { req.setNextToken(nextToken); final ListStacksResult result = getService().listStacks(req); final Optional<StackSummary> matchedStackSummary = result.getStackSummaries().stream() .filter(x -> namePattern.matcher(x.getStackName()).matches()).findFirst(); if (matchedStackSummary.isPresent()) { getLog().info("Found stack (stackSummary: " + matchedStackSummary.get()); this.stackId = matchedStackSummary.get().getStackId(); this.stackSummary = matchedStackSummary.get(); return; } nextToken = result.getNextToken(); } while (null != nextToken); throw new IllegalStateException("Stack '" + stackName + "' not found!"); }
From source file:br.com.ingenieux.mojo.cloudformation.PushStackMojo.java
License:Apache License
@Override protected Object executeInternal() throws Exception { shouldFailIfMissingStack(failIfMissing); if (!templateLocation.exists() && !templateLocation.isFile()) { getLog().warn("File not found (or not a file): " + templateLocation.getPath() + ". Skipping."); return null; }/* w ww . j a v a2s.c o m*/ if (isNotBlank(s3Url)) { getLog().info("Uploading file " + this.templateLocation + " to location " + this.s3Url); s3Client = new BeanstalkerS3Client(getAWSCredentials(), getClientConfiguration(), getRegion()); s3Client.setMultipartUpload(false); this.destinationS3Uri = new AmazonS3URI(s3Url); uploadContents(templateLocation, destinationS3Uri); } else { templateBody = IOUtils.toString(new FileInputStream(this.templateLocation)); } { ValidateTemplateResult validateTemplateResult = validateTemplate(); if (!validateTemplateResult.getParameters().isEmpty()) { Set<String> existingParameterNames = this.parameters.stream().map(x -> x.getParameterKey()) .collect(Collectors.toSet()); Set<String> requiredParameterNames = validateTemplateResult.getParameters().stream() .map(x -> x.getParameterKey()).collect(Collectors.toSet()); for (String requiredParameter : requiredParameterNames) { if (!existingParameterNames.contains(requiredParameter)) { getLog().warn("Missing required parameter name: " + requiredParameter); getLog().warn("If its an update, will reuse previous value"); } this.parameters.add(new com.amazonaws.services.cloudformation.model.Parameter() .withParameterKey(requiredParameter).withUsePreviousValue(true)); } } } WaitForStackCommand.WaitForStackContext ctx = null; Object result = null; if (null == stackSummary) { getLog().info("Must Create Stack"); CreateStackResult createStackResult; result = createStackResult = createStack(); ctx = new WaitForStackCommand.WaitForStackContext(createStackResult.getStackId(), getService(), this::info, 30, asList(StackStatus.CREATE_COMPLETE)); } else { getLog().info("Must Update Stack"); UpdateStackResult updateStackResult; result = updateStackResult = updateStack(); if (null != result) { ctx = new WaitForStackCommand.WaitForStackContext(updateStackResult.getStackId(), getService(), this::info, 30, asList(StackStatus.UPDATE_COMPLETE)); } } if (null != ctx) new WaitForStackCommand(ctx).execute(); return result; }
From source file:com.nike.cerberus.operation.cms.CreateCmsClusterOperation.java
License:Apache License
@Override public void run(final CreateCmsClusterCommand command) { final String uniqueStackName = String.format("%s-%s", StackName.CMS.getName(), uuidSupplier.get()); final BaseOutputs baseOutputs = configStore.getBaseStackOutputs(); final Optional<String> cmsServerCertificateArn = configStore.getServerCertificateArn(StackName.CMS); final Optional<String> pubKey = configStore.getCertPart(StackName.CMS, ConfigConstants.CERT_PART_PUBKEY); final String internalElbCname = configStore.getInternalElbCname(StackName.CMS); if (!cmsServerCertificateArn.isPresent() || !pubKey.isPresent()) { throw new IllegalStateException("CMS certificate has not been uploaded!"); }/*from w w w . j a va 2 s .c o m*/ final CmsParameters cmsParameters = new CmsParameters() .setInstanceProfileName(baseOutputs.getCmsInstanceProfileName()) .setCmsElbSgId(baseOutputs.getCmsElbSgId()).setCmsSgId(baseOutputs.getCmsSgId()) .setToolsIngressSgId(baseOutputs.getToolsIngressSgId()).setVpcId(baseOutputs.getVpcId()) .setVpcSubnetIdForAz1(baseOutputs.getVpcSubnetIdForAz1()) .setVpcSubnetIdForAz2(baseOutputs.getVpcSubnetIdForAz2()) .setVpcSubnetIdForAz3(baseOutputs.getVpcSubnetIdForAz3()) .setHostedZoneId(baseOutputs.getVpcHostedZoneId()).setCname(internalElbCname); cmsParameters.getSslConfigParameters().setCertPublicKey(pubKey.get()); cmsParameters.getSslConfigParameters().setSslCertificateArn(cmsServerCertificateArn.get()); cmsParameters.getLaunchConfigParameters().setAmiId(command.getStackDelegate().getAmiId()); cmsParameters.getLaunchConfigParameters().setInstanceSize(command.getStackDelegate().getInstanceSize()); cmsParameters.getLaunchConfigParameters().setKeyPairName(command.getStackDelegate().getKeyPairName()); cmsParameters.getLaunchConfigParameters().setUserData( ec2UserDataService.getUserData(StackName.CMS, command.getStackDelegate().getOwnerGroup())); cmsParameters.getTagParameters().setTagEmail(command.getStackDelegate().getOwnerEmail()); cmsParameters.getTagParameters().setTagName(ConfigConstants.ENV_PREFIX + environmentMetadata.getName()); cmsParameters.getTagParameters().setTagCostcenter(command.getStackDelegate().getCostcenter()); final TypeReference<Map<String, String>> typeReference = new TypeReference<Map<String, String>>() { }; final Map<String, String> parameters = cloudformationObjectMapper.convertValue(cmsParameters, typeReference); final String stackId = cloudFormationService.createStack( cloudFormationService.getEnvStackName(uniqueStackName), parameters, ConfigConstants.CMS_STACK_TEMPLATE_PATH, true); logger.info("Uploading data to the configuration bucket."); configStore.storeStackId(StackName.CMS, stackId); logger.info("Uploading complete."); final StackStatus endStatus = cloudFormationService.waitForStatus(stackId, Sets.newHashSet(StackStatus.CREATE_COMPLETE, StackStatus.ROLLBACK_COMPLETE)); if (endStatus != StackStatus.CREATE_COMPLETE) { final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage); } }
From source file:com.nike.cerberus.operation.consul.CreateConsulClusterOperation.java
License:Apache License
@Override public void run(final CreateConsulClusterCommand command) { final String uniqueStackName = String.format("%s-%s", StackName.CONSUL.getName(), uuidSupplier.get()); final BaseOutputs baseOutputs = configStore.getBaseStackOutputs(); final ConsulParameters consulParameters = new ConsulParameters() .setInstanceProfileName(baseOutputs.getConsulInstanceProfileName()) .setConsulClientSgId(baseOutputs.getConsulClientSgId()) .setConsulServerSgId(baseOutputs.getConsulServerSgId()) .setToolsIngressSgId(baseOutputs.getToolsIngressSgId()).setVpcId(baseOutputs.getVpcId()) .setVpcSubnetIdForAz1(baseOutputs.getVpcSubnetIdForAz1()) .setVpcSubnetIdForAz2(baseOutputs.getVpcSubnetIdForAz2()) .setVpcSubnetIdForAz3(baseOutputs.getVpcSubnetIdForAz3()); consulParameters.getLaunchConfigParameters().setAmiId(command.getStackDelegate().getAmiId()); consulParameters.getLaunchConfigParameters().setInstanceSize(command.getStackDelegate().getInstanceSize()); consulParameters.getLaunchConfigParameters().setKeyPairName(command.getStackDelegate().getKeyPairName()); consulParameters.getLaunchConfigParameters().setUserData( ec2UserDataService.getUserData(StackName.CONSUL, command.getStackDelegate().getOwnerGroup())); consulParameters.getTagParameters().setTagEmail(command.getStackDelegate().getOwnerEmail()); consulParameters.getTagParameters().setTagName(ConfigConstants.ENV_PREFIX + environmentMetadata.getName()); consulParameters.getTagParameters().setTagCostcenter(command.getStackDelegate().getCostcenter()); final TypeReference<Map<String, String>> typeReference = new TypeReference<Map<String, String>>() { };//from www. j a v a 2s . c o m final Map<String, String> parameters = cloudformationObjectMapper.convertValue(consulParameters, typeReference); final String stackId = cloudFormationService.createStack( cloudFormationService.getEnvStackName(uniqueStackName), parameters, ConfigConstants.CONSUL_STACK_TEMPLATE_PATH, true); logger.info("Uploading data to the configuration bucket."); configStore.storeStackId(StackName.CONSUL, stackId); logger.info("Uploading complete."); final StackStatus endStatus = cloudFormationService.waitForStatus(stackId, Sets.newHashSet(StackStatus.CREATE_COMPLETE, StackStatus.ROLLBACK_COMPLETE)); if (endStatus != StackStatus.CREATE_COMPLETE) { final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage); } }
From source file:com.nike.cerberus.operation.core.CreateBaseOperation.java
License:Apache License
@Override public void run(final CreateBaseCommand command) { final String uniqueStackName = String.format("%s-%s", ConfigConstants.BASE_STACK_NAME, uuidSupplier.get()); final Map<Integer, String> azByIdentifier = mapAvailabilityZones(); final String dbMasterPassword = passwordGenerator.get(); final BaseParameters baseParameters = new BaseParameters(); baseParameters.setAccountAdminArn(command.getAdminRoleArn()).setAz1(azByIdentifier.get(1)) .setAz2(azByIdentifier.get(2)).setAz3(azByIdentifier.get(3)) .setCmsDbMasterUsername(ConfigConstants.DEFAULT_CMS_DB_NAME) .setCmsDbMasterPassword(dbMasterPassword).setCmsDbName(ConfigConstants.DEFAULT_CMS_DB_NAME) .setVpcHostedZoneName(command.getVpcHostedZoneName()); baseParameters.getTagParameters().setTagEmail(command.getOwnerEmail()); baseParameters.getTagParameters().setTagName(ConfigConstants.ENV_PREFIX + environmentMetadata.getName()); baseParameters.getTagParameters().setTagCostcenter(command.getCostcenter()); final TypeReference<Map<String, String>> typeReference = new TypeReference<Map<String, String>>() { };//from ww w . j av a2 s . c om final Map<String, String> parameters = cloudformationObjectMapper.convertValue(baseParameters, typeReference); final String stackId = cloudFormationService.createStack( cloudFormationService.getEnvStackName(uniqueStackName), parameters, ConfigConstants.BASE_STACK_TEMPLATE_PATH, true); final StackStatus endStatus = cloudFormationService.waitForStatus(stackId, Sets.newHashSet(StackStatus.CREATE_COMPLETE, StackStatus.ROLLBACK_COMPLETE)); if (StackStatus.CREATE_COMPLETE == endStatus) { final Map<String, String> stackOutputs = cloudFormationService.getStackOutputs(stackId); final BaseOutputs outputParameters = cloudformationObjectMapper.convertValue(stackOutputs, BaseOutputs.class); logger.info("Stack creation complete, uploading data to the configuration bucket."); // ORDER IS IMPORTANT! // 1. First update the environment metadata with the new config bucket name. environmentMetadata.setBucketName(outputParameters.getConfigBucketName()); // 2. Initialize the environment config. configStore.initEnvironmentData(); // 3. Write the first configuration values to the config bucket. configStore.storeAzs(azByIdentifier.get(1), azByIdentifier.get(2), azByIdentifier.get(3)); configStore.storeStackId(StackName.BASE, stackId); configStore.storeConfigKeyId(outputParameters.getConfigFileKeyId()); // 4. Initialize the secrets config. configStore.initSecretsData(); // 5. Write the first secret value to the config bucket once the config key id has been saved. configStore.storeCmsDatabasePassword(dbMasterPassword); logger.info("Uploading complete."); } else { final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage); } }
From source file:com.nike.cerberus.operation.gateway.CreateCloudFrontSecurityGroupUpdaterLambdaOperation.java
License:Apache License
private void createLambda() { final CloudFrontIpSynchronizerParameters cloudFrontIpSynchronizerParameters = new CloudFrontIpSynchronizerParameters() .setLambdaBucket(environmentMetadata.getBucketName()) .setLambdaKey(LambdaName.CLOUD_FRONT_SG_GROUP_IP_SYNC.getBucketKey()); final TypeReference<Map<String, String>> typeReference = new TypeReference<Map<String, String>>() { };/*from w w w. j av a2 s .c o m*/ final Map<String, String> parameters = cloudformationObjectMapper .convertValue(cloudFrontIpSynchronizerParameters, typeReference); final String stackId = cloudFormationService.createStack(StackName.CLOUD_FRONT_IP_SYNCHRONIZER.getName(), parameters, ConfigConstants.CF_ELB_IP_SYNC_STACK_TEMPLATE_PATH, true); final StackStatus endStatus = cloudFormationService.waitForStatus(stackId, Sets.newHashSet(StackStatus.CREATE_COMPLETE, StackStatus.ROLLBACK_COMPLETE)); if (endStatus != StackStatus.CREATE_COMPLETE) { final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage); } }
From source file:com.nike.cerberus.operation.gateway.CreateGatewayClusterOperation.java
License:Apache License
@Override public void run(final CreateGatewayClusterCommand command) { final String uniqueStackName = String.format("%s-%s", StackName.GATEWAY.getName(), uuidSupplier.get()); final BaseOutputs baseOutputs = configStore.getBaseStackOutputs(); final Optional<String> gatewayServerCertificateArn = configStore.getServerCertificateArn(StackName.GATEWAY); final Optional<String> gatewayServerCertificateId = configStore.getServerCertificateId(StackName.GATEWAY); final Optional<String> pubKey = configStore.getCertPart(StackName.GATEWAY, ConfigConstants.CERT_PART_PUBKEY); if (!gatewayServerCertificateArn.isPresent() || !pubKey.isPresent()) { throw new IllegalStateException("Gateway certificate has not been uploaded!"); }//w w w.j a v a2s .co m final GatewayParameters gatewayParameters = new GatewayParameters().setVpcId(baseOutputs.getVpcId()) .setInstanceProfileName(baseOutputs.getGatewayInstanceProfileName()) .setGatewayServerSgId(baseOutputs.getGatewayServerSgId()) .setGatewayElbSgId(baseOutputs.getGatewayElbSgId()) .setToolsIngressSgId(baseOutputs.getToolsIngressSgId()) .setVpcSubnetIdForAz1(baseOutputs.getVpcSubnetIdForAz1()) .setVpcSubnetIdForAz2(baseOutputs.getVpcSubnetIdForAz2()) .setVpcSubnetIdForAz3(baseOutputs.getVpcSubnetIdForAz3()).setHostedZoneId(command.getHostedZoneId()) .setHostname(command.getHostname()).setWafLambdaBucket(environmentMetadata.getBucketName()) .setWafLambdaKey(LambdaName.WAF.getBucketKey()) .setCloudFrontLogProcessorLambdaIamRoleArn(baseOutputs.getCloudFrontLogProcessorLambdaIamRoleArn()); gatewayParameters.getSslConfigParameters().setCertPublicKey(pubKey.get()); gatewayParameters.getSslConfigParameters().setSslCertificateArn(gatewayServerCertificateArn.get()); gatewayParameters.getSslConfigParameters().setSslCertificateId(gatewayServerCertificateId.get()); gatewayParameters.getLaunchConfigParameters().setAmiId(command.getStackDelegate().getAmiId()); gatewayParameters.getLaunchConfigParameters().setInstanceSize(command.getStackDelegate().getInstanceSize()); gatewayParameters.getLaunchConfigParameters().setKeyPairName(command.getStackDelegate().getKeyPairName()); gatewayParameters.getLaunchConfigParameters().setUserData( ec2UserDataService.getUserData(StackName.GATEWAY, command.getStackDelegate().getOwnerGroup())); gatewayParameters.getTagParameters().setTagEmail(command.getStackDelegate().getOwnerEmail()); gatewayParameters.getTagParameters().setTagName(ConfigConstants.ENV_PREFIX + environmentMetadata.getName()); gatewayParameters.getTagParameters().setTagCostcenter(command.getStackDelegate().getCostcenter()); final TypeReference<Map<String, String>> typeReference = new TypeReference<Map<String, String>>() { }; final Map<String, String> parameters = cloudformationObjectMapper.convertValue(gatewayParameters, typeReference); final String stackId = cloudFormationService.createStack( cloudFormationService.getEnvStackName(uniqueStackName), parameters, ConfigConstants.GATEWAY_STACK_TEMPLATE_PATH, true); logger.info("Uploading data to the configuration bucket."); configStore.storeStackId(StackName.GATEWAY, stackId); logger.info("Uploading complete."); final StackStatus endStatus = cloudFormationService.waitForStatus(stackId, Sets.newHashSet(StackStatus.CREATE_COMPLETE, StackStatus.ROLLBACK_COMPLETE)); if (endStatus != StackStatus.CREATE_COMPLETE) { final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage); } }
From source file:com.nike.cerberus.operation.vault.CreateVaultClusterOperation.java
License:Apache License
@Override public void run(final CreateVaultClusterCommand command) { final String uniqueStackName = String.format("%s-%s", StackName.VAULT.getName(), uuidSupplier.get()); final BaseOutputs baseOutputs = configStore.getBaseStackOutputs(); final Optional<String> vaultServerCertificateArn = configStore.getServerCertificateArn(StackName.VAULT); final Optional<String> pubKey = configStore.getCertPart(StackName.VAULT, ConfigConstants.CERT_PART_PUBKEY); final String internalElbCname = configStore.getInternalElbCname(StackName.VAULT); if (!vaultServerCertificateArn.isPresent() || !pubKey.isPresent()) { throw new IllegalStateException("Vault server certificate has not been uploaded!"); }// w w w . j a v a 2 s. c o m final VaultParameters vaultParameters = new VaultParameters() .setInstanceProfileName(baseOutputs.getVaultInstanceProfileName()) .setVaultClientSgId(baseOutputs.getVaultClientSgId()) .setVaultServerSgId(baseOutputs.getVaultServerSgId()) .setVaultServerElbSgId(baseOutputs.getVaultServerElbSgId()) .setConsulClientSgId(baseOutputs.getConsulClientSgId()) .setConsulServerSgId(baseOutputs.getConsulServerSgId()) .setToolsIngressSgId(baseOutputs.getToolsIngressSgId()).setVpcId(baseOutputs.getVpcId()) .setVpcSubnetIdForAz1(baseOutputs.getVpcSubnetIdForAz1()) .setVpcSubnetIdForAz2(baseOutputs.getVpcSubnetIdForAz2()) .setVpcSubnetIdForAz3(baseOutputs.getVpcSubnetIdForAz3()) .setHostedZoneId(baseOutputs.getVpcHostedZoneId()).setCname(internalElbCname); vaultParameters.getSslConfigParameters().setCertPublicKey(pubKey.get()); vaultParameters.getSslConfigParameters().setSslCertificateArn(vaultServerCertificateArn.get()); vaultParameters.getLaunchConfigParameters().setAmiId(command.getStackDelegate().getAmiId()); vaultParameters.getLaunchConfigParameters().setInstanceSize(command.getStackDelegate().getInstanceSize()); vaultParameters.getLaunchConfigParameters().setKeyPairName(command.getStackDelegate().getKeyPairName()); vaultParameters.getLaunchConfigParameters().setUserData( ec2UserDataService.getUserData(StackName.VAULT, command.getStackDelegate().getOwnerGroup())); vaultParameters.getTagParameters().setTagEmail(command.getStackDelegate().getOwnerEmail()); vaultParameters.getTagParameters().setTagName(ConfigConstants.ENV_PREFIX + environmentMetadata.getName()); vaultParameters.getTagParameters().setTagCostcenter(command.getStackDelegate().getCostcenter()); final TypeReference<Map<String, String>> typeReference = new TypeReference<Map<String, String>>() { }; final Map<String, String> parameters = cloudformationObjectMapper.convertValue(vaultParameters, typeReference); final String stackId = cloudFormationService.createStack( cloudFormationService.getEnvStackName(uniqueStackName), parameters, ConfigConstants.VAULT_STACK_TEMPLATE_PATH, true); logger.info("Uploading data to the configuration bucket."); configStore.storeStackId(StackName.VAULT, stackId); logger.info("Uploading complete."); final StackStatus endStatus = cloudFormationService.waitForStatus(stackId, Sets.newHashSet(StackStatus.CREATE_COMPLETE, StackStatus.ROLLBACK_COMPLETE)); if (endStatus != StackStatus.CREATE_COMPLETE) { final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage); } }
From source file:com.tvarit.plugin.StackMaker.java
License:Open Source License
public Stack makeStack(CreateStackRequest createStackRequest, AmazonCloudFormationClient amazonCloudFormationClient, Log log) throws MojoFailureException { CreateStackResult createStackResult = amazonCloudFormationClient.createStack(createStackRequest); final String stackName = createStackRequest.getStackName(); DescribeStacksResult describeStacksResult = amazonCloudFormationClient .describeStacks(new DescribeStacksRequest().withStackName(stackName)); while (describeStacksResult.getStacks().get(0).getStackStatus() .equals(StackStatus.CREATE_IN_PROGRESS.toString())) { try {/* www.j a va 2s . c om*/ log.info("Awaiting stack create completion!"); Thread.sleep(5000); } catch (InterruptedException e) { log.error(e); throw new RuntimeException(e); } describeStacksResult = amazonCloudFormationClient .describeStacks(new DescribeStacksRequest().withStackName(stackName)); } final Stack stack = describeStacksResult.getStacks().get(0); final String stackStatus = stack.getStackStatus(); if (!stackStatus.equals(StackStatus.CREATE_COMPLETE.toString())) { throw new MojoFailureException("Could not create infrastructure. Stack Status is: " + stackStatus + ". Please review details on the AWS console and open a new github issue on https://github.com/sdole/tvarit-maven/issues/new that is needed."); } return stack; }