github.com/andresvia/terraform@v0.6.15-0.20160412045437-d51c75946785/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  ```js
    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  The following keys are supported for backwards compatibility, and may be
    66  removed in a future version:
    67  
    68  * `account_file` - __Deprecated: please use `credentials` instead.__
    69    Path to or contents of the JSON file used to describe your
    70    account credentials, downloaded from Google Cloud Console. More details on
    71    retrieving this file are below. The `account file` can be "" if you are running
    72    terraform from a GCE instance with a properly-configured [Compute Engine
    73    Service Account](https://cloud.google.com/compute/docs/authentication). This
    74    can also be specified with the `GOOGLE_ACCOUNT_FILE` shell environment
    75    variable.
    76  
    77  
    78  ## Authentication JSON File
    79  
    80  Authenticating with Google Cloud services requires a JSON
    81  file which we call the _account file_.
    82  
    83  This file is downloaded directly from the
    84  [Google Developers Console](https://console.developers.google.com). To make
    85  the process more straightforwarded, it is documented here:
    86  
    87  1. Log into the [Google Developers Console](https://console.developers.google.com)
    88     and select a project.
    89  
    90  2. Click the menu button in the top left corner, and navigate to "Permissions",
    91     then "Service accounts", and finally "Create service account".
    92  
    93  3. Provide a name and ID in the corresponding fields, select
    94     "Furnish a new private key", and select "JSON" as the key type.
    95  
    96  4. Clicking "Create" will download your `credentials`.