Skip to content

Commit 56d58c3

Browse files
authored
bugfix improve provider credentials docs. Fixes hashicorp#21471 (#13111)
1 parent bc1b7c1 commit 56d58c3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown

+12-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ impersonated service account regardless of the primary identity in use.
116116

117117
## Authentication Configuration
118118

119-
* `credentials` - (Optional) Either the path to or the contents of a
120-
[service account key file] in JSON format. You can
119+
* `credentials` - (Optional) Either the path (as returned by the [file terraform function])
120+
to or the contents of a [service account key file] in JSON format. You can
121121
[manage key files using the Cloud Console]. Your service account key file is
122122
used to complete a two-legged OAuth 2.0 flow to obtain access tokens to
123123
authenticate with the GCP API as needed; Terraform will use it to reauthenticate
@@ -136,6 +136,15 @@ by precedence.
136136
the path of your service account key file in the
137137
`GOOGLE_APPLICATION_CREDENTIALS` environment variable, or configure
138138
authentication through one of the following;
139+
140+
```hcl
141+
provider "google" {
142+
alias = "other"
143+
project = var.my_other_project_id
144+
region = var.region
145+
credentials = file(pathexpand(var.gcloud_other_dac_file))
146+
}
147+
```
139148

140149
* If you're running Terraform from a GCE instance, default credentials
141150
are automatically available. See
@@ -414,3 +423,4 @@ See [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110#field.user-agent) for form
414423
[gcloud adc]: https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login
415424
[service accounts]: https://cloud.google.com/docs/authentication/getting-started
416425
[scopes]: https://developers.google.com/identity/protocols/googlescopes
426+
[file terraform function]: https://developer.hashicorp.com/terraform/language/functions/file

0 commit comments

Comments
 (0)