Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Don't attempt to destroy services scaled > 0
Browse files Browse the repository at this point in the history
This led to an unfortunate situation where the target group was
destroyed by the service was not which broke all manner of things.
  • Loading branch information
jpignata committed Jan 3, 2018
1 parent ed57d12 commit f49db65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
- service create and task run will no longer create a repository if an image is
explictly passed.
- service destroy will remove all references the service's target group and
delete it
delete it.
- Fix git repo detection to properly use a git sha image tag rather than a
time stamp tag ([#6][issue-6])
time stamp tag. ([#6][issue-6])
- Fail fast if a user attempts to destroy a service scaled above 0.

## 0.2.0 (2017-12-31)

Expand Down
5 changes: 5 additions & 0 deletions cmd/service_destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func destroyService(operation *ServiceDestroyOperation) {
ecs := ECS.New(sess, clusterName)
service := ecs.DescribeService(operation.ServiceName)

if service.DesiredCount > 0 {
err := fmt.Errorf("%d tasks running, scale service to 0", service.DesiredCount)
console.ErrorExit(err, "Cannot destroy service %s", operation.ServiceName)
}

if service.TargetGroupArn != "" {
loadBalancerArn := elbv2.GetTargetGroupLoadBalancerArn(service.TargetGroupArn)
loadBalancer := elbv2.DescribeLoadBalancerByArn(loadBalancerArn)
Expand Down

0 comments on commit f49db65

Please sign in to comment.