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

Support GCS backend prefixes without trailing / #16585

Merged
merged 3 commits into from
Nov 8, 2017

Conversation

negz
Copy link
Contributor

@negz negz commented Nov 8, 2017

I initially thought listing workspaces with the GCS backend was broken, but it turns out I just omitted the trailing / in my prefix path. Creating new workspaces worked fine, but I was unable to list or select existing workspaces:

$ grep -A4 gcs main.tf                        
  backend "gcs" {                                                        
    project = "planet-k8s-staging"                                      
    bucket  = "terraflop-state"                            
    prefix  = "terraflop/etcd"          
  }                                                                                 
$ tf version                            
Terraform v0.11.0-beta1 (23caaf9feb50d566329f5b4aa07a57da8cd6f448)     
+ provider.google (unversioned)                                
+ provider.ignition v1.0.0                                                                  
+ provider.local v1.0.0                                         
+ provider.random v1.0.0                                                 
+ provider.template v1.0.0                                         
+ provider.tls v1.0.0                                                  
                                                                           
$ tf workspace list                                         
  default                                                                
$ gsutil ls gs://terraflop-state/terraflop/etcd         
gs://terraflop-state/terraflop/etcd/default.tfstate                        
gs://terraflop-state/terraflop/etcd/etcd.tfstate                            
gs://terraflop-state/terraflop/etcd/herp.tfstate    
gs://terraflop-state/terraflop/etcd/koobz.tfstate  
gs://terraflop-state/terraflop/etcd/negz.tfstate
gs://terraflop-state/terraflop/etcd/shrd.tfstate

I considered using a ValidateFunc to enforce the trailing /, but it seemed like a better experience for the user to fix it behind the scenes.

$ TF_ACC=1 GOOGLE_PROJECT=planet-k8s-staging go test .
ok      github.com/hashicorp/terraform/backend/remote-state/gcs 21.359s

Nic Cope added 3 commits November 7, 2017 16:12
I considered using a ValidateFunc to enforce the trailing /, but it seemed like
a better experience for the user to fix it behind the scenes.
To ensure we still support users specifying prefixes ending in /
@apparentlymart
Copy link
Contributor

Hi @negz! Thanks for working on this.

This seems like a fine idea to me. Agreed that it's better to just "make this work" rather than forcing the user to add the slash manually, since it seems pretty clear what the user intent is.

@apparentlymart apparentlymart merged commit 27ba7de into hashicorp:master Nov 8, 2017
@ghost
Copy link

ghost commented Apr 6, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants