Skip to content

Commit 63ab8ad

Browse files
authored
provider: Enable request/response logging (#46)
1 parent 5c9f607 commit 63ab8ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

grafana/provider.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package grafana
22

33
import (
4+
"github.com/hashicorp/terraform/helper/logging"
45
"github.com/hashicorp/terraform/helper/schema"
56
"github.com/hashicorp/terraform/terraform"
67

@@ -38,8 +39,15 @@ func Provider() terraform.ResourceProvider {
3839
}
3940

4041
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
41-
return gapi.New(
42+
client, err := gapi.New(
4243
d.Get("auth").(string),
4344
d.Get("url").(string),
4445
)
46+
if err != nil {
47+
return nil, err
48+
}
49+
50+
client.Transport = logging.NewTransport("Grafana", client.Transport)
51+
52+
return client, nil
4553
}

0 commit comments

Comments
 (0)