TritonDataCenter / terraform-provider-triton

Terraform Joyent Triton provider
https://www.terraform.io/docs/providers/triton/
Mozilla Public License 2.0
15 stars 24 forks source link

Take machine state into account when reading it #65

Closed cirocosta closed 6 years ago

cirocosta commented 6 years ago

Terraform Version

Terraform v0.10.8

Affected Resource(s)

Terraform Configuration Files

Debug Output

Panic Output

Expected Behavior

Take into account the desired state of an instance (anything except failed) when reading it such that an instance which got to failed state could be recreated instead of being accounted as a resource in good shape.

Actual Behavior

The triton_machine resource doesn't account for the failed state when refreshing so planing again after a machine gets to failed doesn't end up in additions.

Steps to Reproduce

  1. create a single terraform_machine that gets to failed state
  2. terraform apply
  3. terraform plan
  4. no actions to be performed

Important Factoids

In our datacenter, we had some issues with Triton and that lead to having a good number of machines (from triton_machine) ending up in failed state.

References

In GH-10 there was the addition of a check that verifies if the machine got to the failed state. In such case, it doesn't write to tfstate. In our deployment, we were getting to failed a lot of time after the provisioning state (at a time when terraform had already timed out). This lead to terraform keeping the resource at the tfstate and then the plugin not accounting for the failed state later.

stack72 commented 6 years ago

Hi @cirocosta

This is a nice suggestion - just making the addition right now

Paul

cirocosta commented 6 years ago

Hey @stack72 , thanks for the quick response!

Please let me know if you want me to test it or contribute to it 👍

Thanks!

stack72 commented 6 years ago

@cirocosta this has been merged to master - we will try and get a provider release out this week - I need to ask one of the HashiCorp team to do this for us

cirocosta commented 6 years ago

Thanks, @stack72 !

I just tried here by go geting it and then setting terraform init to look for plugins in the right place and it worked perfectly 👍

Thx!

stack72 commented 6 years ago

wonderful news @cirocosta :)