|
|
|
|
@ -8,18 +8,18 @@ description: |-
|
|
|
|
|
|
|
|
|
|
# gcs
|
|
|
|
|
|
|
|
|
|
**Kind: Standard (with no locking)**
|
|
|
|
|
**Kind: Standard (with locking)**
|
|
|
|
|
|
|
|
|
|
Stores the state as a given key in a given bucket on [Google Cloud Storage](https://cloud.google.com/storage/).
|
|
|
|
|
Stores the state as an object in a configurable prefix and bucket on [Google Cloud Storage](https://cloud.google.com/storage/) (GCS).
|
|
|
|
|
|
|
|
|
|
## Example Configuration
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
terraform {
|
|
|
|
|
backend "gcs" {
|
|
|
|
|
bucket = "tf-state-prod"
|
|
|
|
|
path = "path/terraform.tfstate"
|
|
|
|
|
project = "myproject"
|
|
|
|
|
bucket = "tf-state-prod"
|
|
|
|
|
prefix = "terraform/state"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
@ -30,9 +30,9 @@ terraform {
|
|
|
|
|
data "terraform_remote_state" "foo" {
|
|
|
|
|
backend = "gcs"
|
|
|
|
|
config {
|
|
|
|
|
bucket = "terraform-state-prod"
|
|
|
|
|
path = "network/terraform.tfstate"
|
|
|
|
|
project = "goopro"
|
|
|
|
|
bucket = "terraform-state"
|
|
|
|
|
prefix = "prod"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -49,6 +49,7 @@ resource "template_file" "bar" {
|
|
|
|
|
|
|
|
|
|
The following configuration options are supported:
|
|
|
|
|
|
|
|
|
|
* `bucket` - (Required) The name of the GCS bucket
|
|
|
|
|
* `path` - (Required) The path where to place/look for state file inside the bucket
|
|
|
|
|
* `credentials` / `GOOGLE_CREDENTIALS` - (Required) Google Cloud Platform account credentials in json format
|
|
|
|
|
* `bucket` - (Required) The name of the GCS bucket.
|
|
|
|
|
* `credentials` / `GOOGLE_CREDENTIALS` - (Required) Local path to Google Cloud Platform account credentials in JSON format.
|
|
|
|
|
* `prefix` - (Optional) GCS prefix inside the bucket. Named states are stored in an object called `<prefix>/<name>.tfstate`.
|
|
|
|
|
* `path` - (Legacy) GCS path to the state file of the default state. For backwards compatibility only, use `prefix` instead.
|
|
|
|
|
|