github.com/kcburge/terraform@v0.11.12-beta1/website/docs/backends/types/gcs.html.md (about)

     1  ---
     2  layout: "backend-types"
     3  page_title: "Backend Type: gcs"
     4  sidebar_current: "docs-backends-types-standard-gcs"
     5  description: |-
     6    Terraform can store the state remotely, making it easier to version and work with in a team.
     7  ---
     8  
     9  # gcs
    10  
    11  **Kind: Standard (with locking)**
    12  
    13  Stores the state as an object in a configurable prefix and bucket on [Google Cloud Storage](https://cloud.google.com/storage/) (GCS).
    14  
    15  ## Example Configuration
    16  
    17  ```hcl
    18  terraform {
    19    backend "gcs" {
    20      bucket  = "tf-state-prod"
    21      prefix  = "terraform/state"
    22    }
    23  }
    24  ```
    25  
    26  ## Example Referencing
    27  
    28  ```hcl
    29  data "terraform_remote_state" "foo" {
    30    backend = "gcs"
    31    config {
    32      bucket  = "terraform-state"
    33      prefix  = "prod"
    34    }
    35  }
    36  
    37  resource "template_file" "bar" {
    38    template = "${greeting}"
    39  
    40    vars {
    41      greeting = "${data.terraform_remote_state.foo.greeting}"
    42    }
    43  }
    44  ```
    45  
    46  ## Configuration variables
    47  
    48  The following configuration options are supported:
    49  
    50   *  `bucket` - (Required) The name of the GCS bucket.
    51      This name must be globally unique.
    52      For more information, see [Bucket Naming Guidelines](https://cloud.google.com/storage/docs/bucketnaming.html#requirements).
    53   *  `credentials` / `GOOGLE_CREDENTIALS` - (Optional) Local path to Google Cloud Platform account credentials in JSON format.
    54      If unset, [Google Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials) are used.
    55      The provided credentials need to have the `devstorage.read_write` scope and `WRITER` permissions on the bucket.
    56   *  `prefix` - (Optional) GCS prefix inside the bucket. Named states for workspaces are stored in an object called `<prefix>/<name>.tfstate`.
    57   *  `path` - (Deprecated) GCS path to the state file of the default state. For backwards compatibility only, use `prefix` instead.
    58   *  `project` / `GOOGLE_PROJECT` - (Optional) The project ID to which the bucket belongs. This is only used when creating a new bucket during initialization.
    59      Since buckets have globally unique names, the project ID is not required to access the bucket during normal operation.
    60   *  `region` / `GOOGLE_REGION` - (Optional) The region in which a new bucket is created.
    61      For more information, see [Bucket Locations](https://cloud.google.com/storage/docs/bucket-locations).
    62   *  `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).