Skip to content

Commit 3592997

Browse files
authored
update auth docs (hashicorp#1587)
* Added a link to the console page where you can download a file * Removed instructions on how to get to that page, since now you can just click on the link * Added caveat for application default credentials @sethvargo @theacodes @kimcam let me know if this seems reasonable / you have any suggestions!
1 parent 70010a6 commit 3592997

File tree

1 file changed

+19
-29
lines changed

1 file changed

+19
-29
lines changed

docs/index.html.markdown

+19-29
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ resource "google_compute_instance" "default" {
3535
The following keys can be used to configure the provider.
3636

3737
* `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.
4041

4142
Credentials can also be specified using any of the following environment
4243
variables (listed in order of precedence):
@@ -45,20 +46,21 @@ The following keys can be used to configure the provider.
4546
* `GOOGLE_CLOUD_KEYFILE_JSON`
4647
* `GCLOUD_KEYFILE_JSON`
4748

48-
The [`GOOGLE_APPLICATION_CREDENTIALS`](https://developers.google.com/identity/protocols/application-default-credentials#howtheywork)
49+
The [`GOOGLE_APPLICATION_CREDENTIALS`][adc]
4950
environment variable can also contain the path of a file to obtain credentials
5051
from.
5152

5253
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].
5555
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
5959
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.
6264

6365
* `project` - (Optional) The ID of the project to apply any resources to. This
6466
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.
8587
* `GCLOUD_ZONE`
8688
* `CLOUDSDK_COMPUTE_ZONE`
8789

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`.
10790

10891
## Beta Features
10992

@@ -115,3 +98,10 @@ is publicly announced, and is when they generally become publicly available.
11598
Terraform resources that support beta features will always use the Beta APIs to provision
11699
the resource. Importing a resource that supports beta features will always import those
117100
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

Comments
 (0)