thojkooi / terraform-digitalocean-docker-swarm-mode

Terraform module for provisioning a Docker Swarm mode cluster on DigitalOcean
https://registry.terraform.io/modules/thojkooi/docker-swarm-mode/digitalocean
MIT License
63 stars 27 forks source link

Terraform destroy on module results in a cycle #8

Closed thojkooi closed 6 years ago

thojkooi commented 6 years ago

When attempting to destroy the firewall example (terraform-docker-swarm/examples/firewall):

$ tf destroy
digitalocean_tag.cluster: Refreshing state... (ID: swarm-mode-cluster)
digitalocean_tag.manager: Refreshing state... (ID: manager)
digitalocean_tag.worker: Refreshing state... (ID: worker)
digitalocean_droplet.manager: Refreshing state... (ID: 68407158)
data.external.swarm_tokens: Refreshing state...
null_resource.bootstrap: Refreshing state... (ID: 3452999552264493736)
digitalocean_droplet.node: Refreshing state... (ID: 68407251)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  - digitalocean_tag.cluster

  - digitalocean_tag.manager

  - digitalocean_tag.worker

  - module.swarm-cluster.module.managers.digitalocean_droplet.manager

  - module.swarm-cluster.module.managers.null_resource.bootstrap

  - module.swarm-cluster.module.workers.digitalocean_droplet.node

Plan: 0 to add, 0 to change, 6 to destroy.

Do you really want to destroy?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

Error applying plan:

1 error(s) occurred:

* Cycle: module.swarm-cluster.module.managers.data.external.swarm_tokens (destroy), module.swarm-cluster.module.managers.digitalocean_droplet.manager (destroy), module.swarm-cluster.module.managers.output.ipv4_addresses, module.swarm-cluster.module.workers.var.manager_public_ip, module.swarm-cluster.module.workers.digitalocean_droplet.node (destroy)

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.