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

can not destroy due to cycle #37

Open

Description

@tomdavidson

Thanks for the awesome project. I have enjoyed checking it out.

My plan consists of:

module "autoreg_stack" {
  source      = "github.com/segmentio/stack"
  environment = "iac"
  key_name    = "autoreg"
  name        = "autoreg"
  domain_name = "autoreg.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.large"
  ecs_instance_ebs_optimized  = false
}

And if try to destroy i get a cycle error that I am not finding:

destroy:
    $(TF)  plan -detailed-exitcode -destroy -out=destroy.tfplan
    $(TF)  apply destroy.tfplan
$ make destroy
There are warnings and/or errors related to your configuration. Please
fix these before continuing.

Errors:

  * 1 error(s) occurred:

* Cycle: module.autoreg_infra.module.ecs_cluster.aws_cloudwatch_metric_alarm.memory_high (destroy), module.autoreg_infra.module.ecs_cluster.aws_cloudwatch_metric_alarm.cpu_high (destroy), module.autoreg_infra.module.ecs_cluster.aws_autoscaling_policy.scale_up (destroy), module.autoreg_infra.module.ecs_cluster.aws_cloudwatch_metric_alarm.cpu_low (destroy), module.autoreg_infra.module.vpc.output.internal_subnets, module.autoreg_infra.module.ecs_cluster.var.subnet_ids, module.autoreg_infra.module.ecs_cluster.aws_cloudwatch_metric_alarm.memory_low (destroy), module.autoreg_infra.module.ecs_cluster.aws_autoscaling_policy.scale_down (destroy), module.autoreg_infra.module.vpc.output.availability_zones, module.autoreg_infra.module.ecs_cluster.var.availability_zones, module.autoreg_infra.output.external_elb, module.autoreg_infra.module.security_groups.aws_security_group.external_elb (destroy), module.autoreg_infra.module.security_groups.aws_security_group.internal_ssh (destroy), module.autoreg_infra.module.bastion.var.subnet_id, module.autoreg_infra.module.security_groups.output.external_ssh, module.autoreg_infra.module.bastion.var.security_groups, module.autoreg_infra.module.vpc.aws_subnet.external (destroy), module.autoreg_infra.module.vpc.aws_subnet.external, module.autoreg_infra.module.vpc.output.external_subnets, module.autoreg_infra.module.security_groups.aws_security_group.external_ssh (destroy), module.autoreg_infra.output.ecs_cluster_security_group_id, module.autoreg_infra.module.iam_role.aws_iam_role.default_ecs_role (destroy), module.autoreg_infra.module.iam_role.output.profile, module.autoreg_infra.module.ecs_cluster.var.security_groups, module.autoreg_infra.module.security_groups.output.external_elb, module.autoreg_infra.module.ecs_cluster.output.security_group_id, module.autoreg_infra.module.ecs_cluster.aws_security_group.cluster (destroy), module.autoreg_infra.module.security_groups.output.internal_ssh, module.autoreg_infra.module.security_groups.var.vpc_id, module.autoreg_infra.module.security_groups.output.internal_elb, module.autoreg_infra.output.internal_elb, module.autoreg_infra.module.vpc.output.id, module.autoreg_infra.module.ecs_cluster.var.vpc_id, module.autoreg_infra.module.security_groups.aws_security_group.internal_elb (destroy), module.autoreg_infra.module.vpc.aws_vpc.main (destroy), module.autoreg_infra.module.vpc.aws_subnet.internal (destroy), module.autoreg_infra.module.vpc.aws_subnet.internal, module.autoreg_infra.module.ecs_cluster.aws_autoscaling_group.main (destroy), module.autoreg_infra.module.ecs_cluster.aws_launch_configuration.main (destroy), module.autoreg_infra.module.iam_role.aws_iam_instance_profile.default_ecs (destroy), module.autoreg_infra.module.ecs_cluster.var.iam_instance_profile

graph

There seems to be several terraform issues related to create_before_destroy = true but it seems Stack specific and I am not finding the solution.

Activity

  1. achille-roussel commented on Jul 27, 2016

    @achille-roussel
    Contributor

    We run into these issues from time to time and they are usually caused by resources not having create_before_destroy = true when they depend on other resources that do have create_before_destroy = true.

    Did you test that with terraform 0.6.16 as well?

  2. tomdavidson commented on Jul 27, 2016

    @tomdavidson
    ContributorAuthor

    I have 0.6.16 sys wide but for this issue i tried 0.6.15 and received the same error. Search the Stack dir for depends_on and make sure every linked resource has a create_before_destroy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions