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

Chore: Add status field, which allows to wait for specific status #408

Closed
wants to merge 2 commits into from

Conversation

RLRabinowitz
Copy link
Contributor

@RLRabinowitz RLRabinowitz commented Jun 2, 2022

Issue & Steps to Reproduce / Feature Request

Currently, using wait_for: FULLY_DEPLOYED field on env0_environment resource, has a specific issue:

If environment fails to deploy on initial terraform apply, it'll get tainted. This means that on the next terraform apply, the environment will be destroyed and redeployed. If the user decides to terraform untaint the resource, then the environment resource would not detect any change on the next terraform apply, and therefor will not redeploy

Tainting happens by the terraform SDK, and this behaviour cannot be changed as long as a multi-step create fails.

If we do not throw an error on deployment failure - then the TF code will continue deploying other dependant resources as though nothing's happened. Also, on subsequent terraform applys, the environment resource will not redeploy
If we do not store this environment in state, then it'll just become unmanaged, and the next terraform apply will create another environment

Solution

This PR proposes a partial solution for the issue: It helps TF realise that a redeploy is needed if a deployment has failed.
This PR introduces a new field to the environment resource: status. Users have to add status: "ACTIVE" to the environment resource, alongside wait_for: "FULLY_DEPLOYED"

In conjunction with auto-untainting using env0 custom flows, the behaviour here would be as expected:
If initial environment deployment fails, the terraform apply will fail. The next terraform apply would trigger a redeploy

@RLRabinowitz RLRabinowitz self-assigned this Jun 2, 2022
@yaronya yaronya changed the title Experiment: Add status field, which allows to wait for specific status Chore: Add status field, which allows to wait for specific status Jun 6, 2022
@avnerenv0
Copy link
Contributor

@RLRabinowitz since #424
Can we close this one?

@RLRabinowitz
Copy link
Contributor Author

@avnerenv0 Yes, this is irrelevant either way. Closing

@TomerHeber TomerHeber deleted the experiment-environment-wait-for-status branch April 11, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants