@@ -35,8 +35,9 @@ resource "google_compute_instance" "default" {
35
35
The following keys can be used to configure the provider.
36
36
37
37
* ` credentials ` - (Optional) Contents of a file that contains your service
38
- account private key in JSON format. You can download this file from the
39
- Google Cloud Console. More details on retrieving this file are below.
38
+ account private key in JSON format. You can download your existing
39
+ [ Google Cloud service account file]
40
+ from the Google Cloud Console, or you can create a new one from the same page.
40
41
41
42
Credentials can also be specified using any of the following environment
42
43
variables (listed in order of precedence):
@@ -45,20 +46,21 @@ The following keys can be used to configure the provider.
45
46
* ` GOOGLE_CLOUD_KEYFILE_JSON `
46
47
* ` GCLOUD_KEYFILE_JSON `
47
48
48
- The [ ` GOOGLE_APPLICATION_CREDENTIALS ` ] ( https://developers.google.com/identity/protocols/application-default-credentials#howtheywork )
49
+ The [ ` GOOGLE_APPLICATION_CREDENTIALS ` ] [ adc ]
49
50
environment variable can also contain the path of a file to obtain credentials
50
51
from.
51
52
52
53
If no credentials are specified, the provider will fall back to using the
53
- [ Google Application Default
54
- Credentials] ( https://developers.google.com/identity/protocols/application-default-credentials ) .
54
+ [ Google Application Default Credentials] [ adc ] .
55
55
If you are running Terraform from a GCE instance, see [ Creating and Enabling
56
- Service Accounts for
57
- Instances ] ( https://cloud.google.com/compute/docs/authentication ) for
58
- details. On your computer, if you have made your identity available as the
56
+ Service Accounts for Instances ] [ gce-service-account ] for details.
57
+
58
+ On your computer, if you have made your identity available as the
59
59
Application Default Credentials by running [ `gcloud auth application-default
60
- login`] ( https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login ) ,
61
- the provider will use your identity.
60
+ login`] [ gcloud adc ] , the provider will use your identity.
61
+
62
+ ~ > ** Warning:** The gcloud method is not guaranteed to work for all APIs, and
63
+ [ service accounts] or [ GCE metadata] should be used if possible.
62
64
63
65
* ` project ` - (Optional) The ID of the project to apply any resources to. This
64
66
can also be specified using any of the following environment variables (listed
@@ -85,25 +87,6 @@ The following keys can be used to configure the provider.
85
87
* ` GCLOUD_ZONE `
86
88
* ` CLOUDSDK_COMPUTE_ZONE `
87
89
88
- ## Authentication JSON File
89
-
90
- Authenticating with Google Cloud services requires a JSON
91
- file which we call the _ account file_ .
92
-
93
- This file is downloaded directly from the
94
- [ Google Developers Console] ( https://console.developers.google.com ) . To make
95
- the process more straightforwarded, it is documented here:
96
-
97
- 1 . Log into the [ Google Developers Console] ( https://console.developers.google.com )
98
- and select a project.
99
-
100
- 2 . The API Manager view should be selected, click on "Credentials" on the left,
101
- then "Create credentials", and finally "Service account key".
102
-
103
- 3 . Select "Compute Engine default service account" in the "Service account"
104
- dropdown, and select "JSON" as the key type.
105
-
106
- 4 . Clicking "Create" will download your ` credentials ` .
107
90
108
91
## Beta Features
109
92
@@ -115,3 +98,10 @@ is publicly announced, and is when they generally become publicly available.
115
98
Terraform resources that support beta features will always use the Beta APIs to provision
116
99
the resource. Importing a resource that supports beta features will always import those
117
100
features, even if the resource was created in a matter that was not explicitly beta.
101
+
102
+ [ Google Cloud service account file ] : https://console.cloud.google.com/apis/credentials/serviceaccountkey
103
+ [ adc ] : https://cloud.google.com/docs/authentication/production
104
+ [ gce-service-account ] : https://cloud.google.com/compute/docs/authentication
105
+ [ gcloud adc ] : https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login
106
+ [ service accounts ] : https://cloud.google.com/docs/authentication/getting-started
107
+ [ GCE metadata ] : https://cloud.google.com/docs/authentication/production#obtaining_credentials_on_compute_engine_kubernetes_engine_app_engine_flexible_environment_and_cloud_functions
0 commit comments