Skip to content

Commit 085cec5

Browse files
dominik-lekserosbo
authored andcommitted
Retrieve current OAuth access token from google_client_config data source (hashicorp#1277)
* Added access_token field to google_client_config data source * Refined documentation of google_client_config
1 parent 3b0f415 commit 085cec5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: docs/d/datasource_client_config.html.markdown

+21
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,25 @@ output "project" {
2020
}
2121
```
2222

23+
## Example Usage: Configure Kubernetes provider with OAuth2 access token
24+
25+
```tf
26+
data "google_client_config" "default" {}
27+
28+
data "google_container_cluster" "my_cluster" {
29+
name = "my-cluster"
30+
zone = "us-east1-a"
31+
}
32+
33+
provider "kubernetes" {
34+
load_config_file = false
35+
36+
host = "https://${google_container_cluster.my_cluster.endpoint}"
37+
token = "${data.google_client_config.default.access_token}"
38+
cluster_ca_certificate = "${base64decode(google_container_cluster.my_cluster.master_auth.0.cluster_ca_certificate)}"
39+
}
40+
```
41+
2342
## Argument Reference
2443

2544
There are no arguments available for this data source.
@@ -31,3 +50,5 @@ In addition to the arguments listed above, the following attributes are exported
3150
* `project` - The ID of the project to apply any resources to.
3251

3352
* `region` - The region to operate under.
53+
54+
* `access_token` - The OAuth2 access token used by the client to authenticate against the Google Cloud API.

0 commit comments

Comments
 (0)