Check workspace before apply

Is there any way to check which workspace the terraform is being applied in. I need 2 things, first to prevent people from running terraform in the default workspace. And second to try and get them to confirm the workspace. i.e. display the currently selected workspace before apply

Thanks!

You can use

terraform workspace show

Also, with recent tf versions, I recall that in the output of plan or apply there is a line mentioning the current workspace.

1 Like