Skip to content

Commit

Permalink
Add GCP zone to client_config datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
mt-inside committed Mar 18, 2019
1 parent 0d6b100 commit 985afb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions google/data_source_google_client_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ func dataSourceGoogleClientConfig() *schema.Resource {
Computed: true,
},

"zone": {
Type: schema.TypeString,
Computed: true,
},

"access_token": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -35,6 +40,7 @@ func dataSourceClientConfigRead(d *schema.ResourceData, meta interface{}) error
d.SetId(time.Now().UTC().String())
d.Set("project", config.Project)
d.Set("region", config.Region)
d.Set("zone", config.Zone)

token, err := config.tokenSource.Token()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions google/data_source_google_client_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestAccDataSourceGoogleClientConfig_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "project"),
resource.TestCheckResourceAttrSet(resourceName, "region"),
resource.TestCheckResourceAttrSet(resourceName, "zone"),
resource.TestCheckResourceAttrSet(resourceName, "access_token"),
),
},
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/datasource_client_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ In addition to the arguments listed above, the following attributes are exported

* `region` - The region to operate under.

* `zone` - The zone to operate under.

* `access_token` - The OAuth2 access token used by the client to authenticate against the Google Cloud API.

0 comments on commit 985afb0

Please sign in to comment.