Add GCP zone to client_config datasource (#3262)

This commit is contained in:
Matt Turner 2019-05-17 23:54:26 +03:00 committed by Dana Hoffman
parent 0310ea2f75
commit 344c0a2ba6
3 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,11 @@ func dataSourceGoogleClientConfig() *schema.Resource {
Computed: true,
},
"zone": {
Type: schema.TypeString,
Computed: true,
},
"access_token": {
Type: schema.TypeString,
Computed: true,
@ -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 {

View File

@ -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"),
),
},

View File

@ -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.