Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_before_destroy checks #6058

Open
jseaidou opened this issue Apr 7, 2016 · 2 comments
Open

create_before_destroy checks #6058

jseaidou opened this issue Apr 7, 2016 · 2 comments

Comments

@jseaidou
Copy link

jseaidou commented Apr 7, 2016

Hey,
we want to be able to when upgrading a instance or recycling with the create_before_destroy flag to make sure certain events passed (for example provisionner finished successfully etc .. ). We dont want upgrade and have our cluster taken down because of this. With that being said, is it possible to implement something similar to:

  1. bring up all instances
  2. if any of the instances are unsuccessful destroy all the new instances and the state hasn't changed
  3. if successfull delete all previous instances

This gives the benefit of also not crippling the cluster of VMs because we lost some of our machines and can't handle the load as efficiently.

@mitchellh
Copy link
Contributor

This isn't currently possible but something like this is interesting for a lifecycle option.

@apparentlymart
Copy link
Contributor

This is an old issue so I'm not sure what exactly was possible at the time, but in modern Terraform I would expect that a provisioner failure during the create leg of a "create before destroy" replace would:

  1. Mark the affected object as "tainted" in the state, so a future plan will know to destroy it.
  2. Halt and return the provisioning error before reaching the "destroy" leg, since the destroy would depend on the create.

This doesn't exactly match the request because the first apply won't immediately destroy the failed objects, but the next plan would propose to destroy them unless the operator manually removes the tainted status using the terraform untaint command.

Therefore I wonder if the current behavior is already close enough to consider this "done". 🤔

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

No branches or pull requests

4 participants