-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
terraform workspace list doesn't show workspaces, but new creates them just fine #17508
Comments
/cc @jbardin |
Hi @redbaron, Running the command you provided through docker, with the policy shown worked correctly here.
Is it possible to include the full trace log output from the the command? This should show the AWS API calls that may help us locate the problem. |
Following along here as 0.11.3 did not fix the original issue(#16383) for us as well. |
having the same issue, no docker. Just trying this on my laptop.
If I check in the .terraform/environment file i see prod in the list. create a new workspace
now check the environment file and only see dev.
does not work, I have to run the new command again to manage the state. my config inside the main.tf file for backend:
Terraform v0.11.6 |
did some playing around because this was working at one point. I disabled the workspace_key_prefix line from my config and it is working as expected now.
looking at the s3 bucket when I had the workspace_key_prefix the folder structure was: there was nothing else in the bucket. I deleted everything from the bucket and the .terraform folder from the system. |
I thought maybe it was failing because I did not specify a key in my config and was entering it via the prompt after running init. Also tried to add the env: to the front of the prefix to see if forcing the path helped, no luck there. Looks like as long as the workspace_key_prefix is in the config it does not work correctly. |
found a work around for now. If you place a path in the key field it works. So based on the example you have above.
if you change to the following:
it will store things in env:/pubweb/env:/xxx-terraform in the s3 bucket. I will be using this for now until the prefix is working. |
This is still a problem -- using workspace_key_prefix causes terraform to be unable to list the states stored in S3. We're running into it as well. Additionally the remote state data provider does not use the config passed by -backend-config flag, so it is difficult to specify the same location as the configured backend with a centralized configuration. 😞 |
Still an issue as of Terraform 0.11.8, with AWS Provider version 1.40. |
Having the same issue, using terraform 0.11.9 and aws provider 1.40.0 . |
@davidarmstronglewis, @cgspohn, There hasn't been a reproducible example provided here yet, so unfortunately I'm not sure what the actual issue if. If either of you have an example, I'll be happy to take a look. |
@jbardin Thanks for your response, here is what we are seeing. Remote setup:
Then for the provider we have this below.
When we get started we do
The workspaces are not listed, instead we see default and blank line which seems odd. The |
Yes this is basically the same info i put in the issue 6 months ago. Removing the workspace_key_prefix from the backend config will fix the issue of the workspace's not showing up when you do a list or change. The prob is a caused when using workspaces and having a prefix key setup. My workaround was to put the prefix key as part of the key path and this fixed the issue for me. It would be nice to be able to use the key prefix as that feature looks to have been created for workspaces. |
The initial example in this thread (plus a number of others) has a
This means that the S3 API call is using a prefix ending with 2 slashes, so the response lists nothing. (If you For me, removing the trailing slash made There's a simple fix here for someone familiar with Go. |
Excellent catch @averigin, I don't know how I missed that piece! It doesn't explain the entire story, since each of these examples worked with our infrastructure, but it very well could be what is breaking the config for some users. |
OK, I'm going to mark this as fixed for 0.12, but we can revisit it of course if there continues to be a problem. After diving into the extra slash issue, it turns out there was a few oddities in the key parsing with |
@jbardin I've been having a similar issue using I suspect the issue I and others were having is related to having too many files (or terraform files) under the |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform Configuration Files
Actual Behavior
Steps to Reproduce
Exact command I am running
Additional Context
AWS user which runs TF has policy as per TF doc:
References
Possibly dup #16383
The text was updated successfully, but these errors were encountered: