Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

ClusterContainsContainerInstancesException #38

Open
tomdavidson opened this issue Jul 23, 2016 · 5 comments
Open

ClusterContainsContainerInstancesException #38

tomdavidson opened this issue Jul 23, 2016 · 5 comments

Comments

@tomdavidson
Copy link
Contributor

tomdavidson commented Jul 23, 2016

Im more than a bit excited about Stack. This is not nit picking, but sharing info because I experience quite a few issues. Using Terrafrom 0.6.16.

On a fresh and branch new stack I have the following plan:


module "autoreg_stack" {
  source      = "github.com/segmentio/stack"
  environment = "iac"
  key_name    = "autoreg"
  name        = "autoreg-stack"
  domain_name = "autoreg-stack.local"
  region      = "us-west-2"
  availability_zones  = "us-west-2a,us-west-2b,us-west-2c"
  cidr        = "192.168.0.0/16"
  internal_subnets  = "192.168.0.0/19,192.168.64.0/19,192.168.128.0/19"
  external_subnets  = "192.168.32.0/20,192.168.96.0/20,192.168.160.0/20"
  ecs_instance_type = "t2.small"
  ecs_instance_ebs_optimized  = false
}

Unfortunately, apply does not make it all the way through:

Error applying plan:

1 error(s) occurred:

* aws_ecs_cluster.main: ClusterContainsContainerInstancesException: The Cluster cannot be deleted while Container Instances are active.
        status code: 400, request id: 8bc05c80-5089-11e6-a6e1-7bf5f1238842

But if I plan and apply again, then Terrafrom says there are no changes to be made.

@achille-roussel
Copy link
Contributor

That is really odd... the error comes from the AWS API.

We're working with 0.6.15 here, so either the stack code relies on a bug prior to 0.6.16 or the latest terraform has introduced an issue (the latter seems more likely to me).

Can we confirm that there was no ECS cluster in your AWS account when you ran the first time?

@tomdavidson
Copy link
Contributor Author

Tired 0.6.15 - same symptoms. There might have been an ECS cluster from a previous Stack experiment but it would have had a different name - are the modules created in such a way I can only have one Stack per AWS account?

@achille-roussel
Copy link
Contributor

Things should work if you give a different name to your stacks and use different subnets etc... are all the stacks you use named differently?

@tomdavidson
Copy link
Contributor Author

tomdavidson commented Jul 28, 2016

Yes, all named differently. Only two stacks in my test account. The second stack was just to see if it would happen again. Right now I am not able to reproduce because both stacks give me a cycle error #37

(Happen to know of a util to wipe out all provisioned resources of an aws account?)

@andersonkyle
Copy link
Contributor

Charity Majors recommends tagging all resources with something like terraform: true. See this for more detail.

That way you can be more surgical when destroying resources out of band.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants