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

env0_environment should return an error when template_id update is not applied on an environment that is "Waiting for approval" #1005

Open
lkanerv opened this issue Jan 24, 2025 · 0 comments
Assignees
Labels
bug Something isn't working Need Triage

Comments

@lkanerv
Copy link

lkanerv commented Jan 24, 2025

Describe the bug
Given an env0 Environment that is marked as "Waiting for approval", updates to env0_environment.template_id incorrectly return a success status after tofu apply. Despite the success status, the template_id does not actually get updated on the Env0 Environment, and it will continue to appear as drift on subsequent deployments.

Overall, it makes sense that Env0 would not update the template_id of an environment that is marked "Waiting for approval." Ideally, that failed update would get returned as a clear error on the tofu apply run, which would prompt an engineer to either approve or cancel the Env0 Environment.

To Reproduce

  • Put an existing environment into a "Waiting for approval" state
  • Update the template_id for the env0_environment resource to be a new value
  • tofu plan shows a template_id update
  • tofu apply shows a success
  • Check the Environment in Env0 Portal, it has the old template_id and not the new one

Expected behavior
tofu apply should return a clear error and exit if the env0_environment.template_id cannot be updated. Ideally something like:

Error: failed deploying environment: 400 Bad Request: Environment is waiting for approval

That would be aligned with how Env0 already handles locked environments today:

Error: failed deploying environment: 400 Bad Request: Environment is locked

Workaround
If you notice an Env0 environment that continually shows drift, check to see if it's "Waiting for Approval". After it's either approved or cancelled, the the template_id update should work on the next tofu apply

Provider Version
v1.24.1

@lkanerv lkanerv added the bug Something isn't working label Jan 24, 2025
@TomerHeber TomerHeber self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Need Triage
Projects
Status: To do
Development

No branches or pull requests

2 participants