public static async Task <bool> Destroy(ILogger log, Context context) { var baseStack = await Cloudformation.GetExistingStackAsync(context.Cloudformation, BaseStack.Name(context.Config)).ConfigureAwait(false); if (baseStack == null) { log.Error("Deploy the {stackName} stack first.", BaseStack.Name(context.Config)); return(false); } var role = baseStack.GetStackOutput("CloudFormationServiceRole"); var bucket = baseStack.GetStackOutput("DeploymentsBucket"); try { await AmazonS3Util.DeleteS3BucketWithObjectsAsync(context.S3, bucket); } catch (Exception ex) { log.Error(ex, "Error deleting S3 bucket {bucket}. Message: {message}", bucket, ex.Message); return(false); } var result = await Cloudformation.DeleteStackAsync(log, context.Cloudformation, Name(context.Config), role); return(result); }
public static async Task <bool> Destroy(ILogger log, Context context) { var baseStack = await Cloudformation.GetExistingStackAsync(context.Cloudformation, BaseStack.Name(context.Config)).ConfigureAwait(false); if (baseStack == null) { log.Error("Deploy the {stackName} stack first.", BaseStack.Name(context.Config)); return(false); } var role = baseStack.GetStackOutput("CloudFormationServiceRole"); var result = await Cloudformation.DeleteStackAsync(log, context.Cloudformation, Name(context.Config), role); return(result); }