github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/google/index.html.markdown (about) 1 --- 2 layout: "google" 3 page_title: "Provider: Google Cloud" 4 sidebar_current: "docs-google-index" 5 description: |- 6 The Google Cloud provider is used to interact with Google Cloud services. The provider needs to be configured with the proper credentials before it can be used. 7 --- 8 9 # Google Cloud Provider 10 11 The Google Cloud provider is used to interact with 12 [Google Cloud services](https://cloud.google.com/). The provider needs 13 to be configured with the proper credentials before it can be used. 14 15 Use the navigation to the left to read about the available resources. 16 17 ## Example Usage 18 19 ```hcl 20 // Configure the Google Cloud provider 21 provider "google" { 22 credentials = "${file("account.json")}" 23 project = "my-gce-project" 24 region = "us-central1" 25 } 26 27 // Create a new instance 28 resource "google_compute_instance" "default" { 29 # ... 30 } 31 ``` 32 33 ## Configuration Reference 34 35 The following keys can be used to configure the provider. 36 37 * `credentials` - (Optional) Contents of the JSON file used to describe your 38 account credentials, downloaded from Google Cloud Console. More details on 39 retrieving this file are below. Credentials may be blank if you are running 40 Terraform from a GCE instance with a properly-configured [Compute Engine 41 Service Account](https://cloud.google.com/compute/docs/authentication). This 42 can also be specified using any of the following environment variables 43 (listed in order of precedence): 44 45 * `GOOGLE_CREDENTIALS` 46 * `GOOGLE_CLOUD_KEYFILE_JSON` 47 * `GCLOUD_KEYFILE_JSON` 48 49 * `project` - (Required) The ID of the project to apply any resources to. This 50 can be specified using any of the following environment variables (listed in 51 order of precedence): 52 53 * `GOOGLE_PROJECT` 54 * `GCLOUD_PROJECT` 55 * `CLOUDSDK_CORE_PROJECT` 56 57 * `region` - (Required) The region to operate under. This can also be specified 58 using any of the following environment variables (listed in order of 59 precedence): 60 61 * `GOOGLE_REGION` 62 * `GCLOUD_REGION` 63 * `CLOUDSDK_COMPUTE_REGION` 64 65 ## Authentication JSON File 66 67 Authenticating with Google Cloud services requires a JSON 68 file which we call the _account file_. 69 70 This file is downloaded directly from the 71 [Google Developers Console](https://console.developers.google.com). To make 72 the process more straightforwarded, it is documented here: 73 74 1. Log into the [Google Developers Console](https://console.developers.google.com) 75 and select a project. 76 77 2. The API Manager view should be selected, click on "Credentials" on the left, 78 then "Create credentials", and finally "Service account key". 79 80 3. Select "Compute Engine default service account" in the "Service account" 81 dropdown, and select "JSON" as the key type. 82 83 4. Clicking "Create" will download your `credentials`.