mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-18 17:19:58 +00:00
30 lines
672 B
Go
30 lines
672 B
Go
|
package google
|
||
|
|
||
|
import (
|
||
|
"github.com/hashicorp/terraform/helper/schema"
|
||
|
)
|
||
|
|
||
|
func dataSourceGoogleStorageProjectServiceAccount() *schema.Resource {
|
||
|
return &schema.Resource{
|
||
|
Read: dataSourceGoogleStorageProjectServiceAccountRead,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func dataSourceGoogleStorageProjectServiceAccountRead(d *schema.ResourceData, meta interface{}) error {
|
||
|
config := meta.(*Config)
|
||
|
|
||
|
project, err := getProject(d, config)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
serviceAccount, err := config.clientStorage.Projects.ServiceAccount.Get(project).Do()
|
||
|
if err != nil {
|
||
|
return handleNotFoundError(err, d, "GCS service account not found")
|
||
|
}
|
||
|
|
||
|
d.SetId(serviceAccount.EmailAddress)
|
||
|
|
||
|
return nil
|
||
|
}
|