Florian Forster
5a4e2076e9
backend/remote-state/gcloud: Add the "path" config option.
...
This config option was used by the legacy "gcs" client. If set, we're
using it for the default state -- all other states still use the
"state_dir" setting.
2017-10-27 16:51:21 -04:00
Florian Forster
f80b872bc3
backend/remote-state/gcloud: Unify on the "context" package.
...
We don't need to use the legacy package here.
2017-10-27 16:51:21 -04:00
Florian Forster
5d4e25ada4
backend/remote-state/gcloud: Make gcsBackend private.
...
This class is only used via the "backend".Backend interface, so there is
no need to export this type beyond the gcloud package.
2017-10-27 16:51:21 -04:00
Florian Forster
9ec39573ee
backend/remote-state/gcloud: Make remoteClient private.
...
This class is only used via the "state/remote".State interface, so there
is no need to export this type beyond the gcloud package.
2017-10-27 16:51:21 -04:00
Florian Forster
fabba5c0c8
backend/remote-state/gcloud: Refactor Backend.States().
...
The previous code listed all objects in the bucket and used local filtering
(using regular expressions) to find .tfstate objects. This new code sets
the delimiter to "/", which causes GCS to only return objects directly in
the given prefix, but not any sub"directories".
Fixes:
* https://github.com/golang/go/wiki/CodeReviewComments#doc-comments
* https://github.com/golang/go/wiki/CodeReviewComments#error-strings
2017-10-27 16:51:21 -04:00
Florian Forster
edf2096e28
backend/remote-state/gcloud: Use the context provided to configure().
...
Calling context.Background() from outside the main() function is
discouraged. The configure functions are only called from
"…/helper/schema".Backend.Configure which provides the Background context,
i.e. a long-living context we can use for backend communication.
2017-10-27 16:51:21 -04:00
Florian Forster
2e5fca78c2
backend/remote-state/gcloud: Coding style changes.
...
Refactorings to make the code more idiomatic.
2017-10-27 16:51:21 -04:00
Florian Forster
e54d36b489
backend/remote-state/gcloud: Sort standard library imports before other imports.
2017-10-27 16:51:20 -04:00
Florian Forster
5313e15e07
backend/remote-state/gcloud: Move the definition of the Backend struct.
2017-10-27 16:51:20 -04:00
Florian Forster
def3279ec7
backend/remote-state/gcloud: Use package provided OAuth scope.
2017-10-27 16:51:20 -04:00
Piotrek Bzdyl
5854373018
Implemented GCloud backend supporting remote locking and multiple workspaces.
2017-10-27 16:51:20 -04:00