Terraform: Terraform Workspace Deleted even with state present

Created on 11 Jul 2019  路  4Comments  路  Source: hashicorp/terraform

Hi ,

I am currently testing terraform 0.12.3 on the Enterprise version of Terraform. As part of this I am trying to delete the workspace with existing resource present ( in the state file ). As per the below documentation

https://www.terraform.io/docs/commands/workspace/delete.html

Workspace can't be deleted if any existing state present in the workspace. Unless specifying "-force" parameter to delete the workspace.

When i am trying to delete the workspace from the terraform enterprise UI with the resources present in the state file. Without any warning it deletes the workspace.

Terraform Version

Terraform v0.12.3

  • provider.external v1.2.0
  • provider.google v2.9.1
  • provider.local v1.3.0
  • provider.null v2.1.2
  • provider.random v2.1.2
  • provider.template v2.1.2

https://www.terraform.io/docs/commands/workspace/delete.html

...

Expected Behavior

It shouldn't delete the workspace

Actual Behavior

It Deletes the workspace

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:
1) terraform apply
2) terraform state list
3) Try to delete the workspace

bug

Most helpful comment

We got the same errors when running terraform workspace select qa1 after setup the remote execution in terraform cloud.

workspaces not supported

without setting the TF_WORKSPACE env var, tf plan works but the value of terraform.workspace is default for all workspaces. This is really a BIG BREAKING CHANGE when moving to Terraform Cloud.

All 4 comments

Hi @keerthivassan86!

I just want to clarify to make sure I understand what you're reporting: it sounds like you are deleting a workspace through the Terraform Cloud or Terraform Enterprise web UI and were surprised to find that it doesn't have the same precondition that the terraform workspace delete CLI command has. Is that correct?

(I just want to make sure that we label this correctly so that the appropriate team can find it, since Terraform Cloud & Enterprise are maintained by different teams than Terraform CLI.)

@apparentlymart

Yes right, I tried to delete the workspace via terraform Enterprise Web UI . If i configured the Terraform enterprise with backend as remote, it is not supporting the workspace option, getting below message

workspaces not supported

We got the same errors when running terraform workspace select qa1 after setup the remote execution in terraform cloud.

workspaces not supported

without setting the TF_WORKSPACE env var, tf plan works but the value of terraform.workspace is default for all workspaces. This is really a BIG BREAKING CHANGE when moving to Terraform Cloud.

Hi again! Thanks for reporting this and sorry for the lack of further progress.

We use issues in this repository to represent bugs and feature requests in Terraform CLI. Terraform Cloud is developed by other teams who don't typically monitor this repository, and so this issue has unfortunately ended up stalled. The Terraform Cloud teams prefer to hear about bug reports and feature requests via the customer support system.

If you have a paid account on Terraform Cloud, please send this feedback to your usual support contacts. Otherwise, you can contact the Terraform Cloud support team at [email protected]. If you contact the support team, be sure to include your Terraform Cloud username and organization name in your request.

Because the change being discussed here would need to be implemented in the Terraform Cloud codebases rather than in this repository, I'm going to close this issue. Thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronnix picture ronnix  路  3Comments

zeninfinity picture zeninfinity  路  3Comments

pawelsawicz picture pawelsawicz  路  3Comments

rjinski picture rjinski  路  3Comments

shanmugakarna picture shanmugakarna  路  3Comments