backend/gcs: Mark the unused attributes project and region as removed.
These two attributes are not used since aec45e6967
.
This commit is contained in:
parent
2b1e650df2
commit
3ca1253796
|
@ -32,9 +32,6 @@ type Backend struct {
|
|||
defaultStateFile string
|
||||
|
||||
encryptionKey []byte
|
||||
|
||||
projectID string
|
||||
region string
|
||||
}
|
||||
|
||||
func New() backend.Backend {
|
||||
|
@ -80,6 +77,7 @@ func New() backend.Backend {
|
|||
Optional: true,
|
||||
Description: "Google Cloud Project ID",
|
||||
Default: "",
|
||||
Removed: "Please remove this attribute. It is not used since the backend no longer creates the bucket if it does not yet exist.",
|
||||
},
|
||||
|
||||
"region": {
|
||||
|
@ -87,6 +85,7 @@ func New() backend.Backend {
|
|||
Optional: true,
|
||||
Description: "Region / location in which to create the bucket",
|
||||
Default: "",
|
||||
Removed: "Please remove this attribute. It is not used since the backend no longer creates the bucket if it does not yet exist.",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -115,15 +114,6 @@ func (b *Backend) configure(ctx context.Context) error {
|
|||
|
||||
b.defaultStateFile = strings.TrimLeft(data.Get("path").(string), "/")
|
||||
|
||||
b.projectID = data.Get("project").(string)
|
||||
if id := os.Getenv("GOOGLE_PROJECT"); b.projectID == "" && id != "" {
|
||||
b.projectID = id
|
||||
}
|
||||
b.region = data.Get("region").(string)
|
||||
if r := os.Getenv("GOOGLE_REGION"); b.projectID == "" && r != "" {
|
||||
b.region = r
|
||||
}
|
||||
|
||||
var opts []option.ClientOption
|
||||
|
||||
creds := data.Get("credentials").(string)
|
||||
|
|
|
@ -181,7 +181,6 @@ func setupBackend(t *testing.T, bucket, prefix, key string) backend.Backend {
|
|||
}
|
||||
|
||||
config := map[string]interface{}{
|
||||
"project": projectID,
|
||||
"bucket": bucket,
|
||||
"prefix": prefix,
|
||||
"encryption_key": key,
|
||||
|
@ -199,9 +198,9 @@ func setupBackend(t *testing.T, bucket, prefix, key string) backend.Backend {
|
|||
}
|
||||
|
||||
attrs := &storage.BucketAttrs{
|
||||
Location: be.region,
|
||||
Location: os.Getenv("GOOGLE_REGION"),
|
||||
}
|
||||
err := bkt.Create(be.storageContext, be.projectID, attrs)
|
||||
err := bkt.Create(be.storageContext, projectID, attrs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,12 @@ description: |-
|
|||
|
||||
**Kind: Standard (with locking)**
|
||||
|
||||
Stores the state as an object in a configurable prefix and bucket on [Google Cloud Storage](https://cloud.google.com/storage/) (GCS).
|
||||
Stores the state as an object in a configurable prefix in a given bucket on [Google Cloud Storage](https://cloud.google.com/storage/) (GCS).
|
||||
This backend also supports [state locking](/docs/state/locking.html).
|
||||
|
||||
~> **Warning!** It is highly recommended that you enable
|
||||
[Object Versioning](https://cloud.google.com/storage/docs/object-versioning)
|
||||
on the GCS bucket to allow for state recovery in the case of accidental deletions and human error.
|
||||
|
||||
## Example Configuration
|
||||
|
||||
|
@ -55,8 +60,4 @@ The following configuration options are supported:
|
|||
The provided credentials need to have the `devstorage.read_write` scope and `WRITER` permissions on the bucket.
|
||||
* `prefix` - (Optional) GCS prefix inside the bucket. Named states for workspaces are stored in an object called `<prefix>/<name>.tfstate`.
|
||||
* `path` - (Deprecated) GCS path to the state file of the default state. For backwards compatibility only, use `prefix` instead.
|
||||
* `project` / `GOOGLE_PROJECT` - (Optional) The project ID to which the bucket belongs. This is only used when creating a new bucket during initialization.
|
||||
Since buckets have globally unique names, the project ID is not required to access the bucket during normal operation.
|
||||
* `region` / `GOOGLE_REGION` - (Optional) The region in which a new bucket is created.
|
||||
For more information, see [Bucket Locations](https://cloud.google.com/storage/docs/bucket-locations).
|
||||
* `encryption_key` / `GOOGLE_ENCRYPTION_KEY` - (Optional) A 32 byte base64 encoded 'customer supplied encryption key' used to encrypt all state. For more information see [Customer Supplied Encryption Keys](https://cloud.google.com/storage/docs/encryption#customer-supplied).
|
||||
|
|
Loading…
Reference in New Issue