From 3db76ce287ba3ce03adc873d2e1bab164f047d17 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sun, 11 Oct 2015 16:01:20 -0700 Subject: [PATCH] Revert "Grafana provider" This reverts commit 719e8c956e377a3f23f9bdbb22773b069165081b, which was accidentally included in a merge. --- builtin/providers/grafana/provider.go | 39 ---------------- builtin/providers/grafana/provider_test.go | 54 ---------------------- 2 files changed, 93 deletions(-) delete mode 100644 builtin/providers/grafana/provider.go delete mode 100644 builtin/providers/grafana/provider_test.go diff --git a/builtin/providers/grafana/provider.go b/builtin/providers/grafana/provider.go deleted file mode 100644 index fb83f1e81..000000000 --- a/builtin/providers/grafana/provider.go +++ /dev/null @@ -1,39 +0,0 @@ -package grafana - -import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" - - gapi "github.com/apparentlymart/go-grafana-api" -) - -func Provider() terraform.ResourceProvider { - return &schema.Provider{ - Schema: map[string]*schema.Schema{ - "url": &schema.Schema{ - Type: schema.TypeString, - Required: true, - DefaultFunc: schema.EnvDefaultFunc("GRAFANA_URL", nil), - Description: "URL of the root of the target Grafana server.", - }, - "auth": &schema.Schema{ - Type: schema.TypeString, - Required: true, - DefaultFunc: schema.EnvDefaultFunc("GRAFANA_AUTH", nil), - Description: "Credentials for accessing the Grafana API.", - }, - }, - - ResourcesMap: map[string]*schema.Resource{ - }, - - ConfigureFunc: providerConfigure, - } -} - -func providerConfigure(d *schema.ResourceData) (interface{}, error) { - return gapi.New( - d.Get("auth").(string), - d.Get("url").(string), - ) -} diff --git a/builtin/providers/grafana/provider_test.go b/builtin/providers/grafana/provider_test.go deleted file mode 100644 index 9daba4c72..000000000 --- a/builtin/providers/grafana/provider_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package grafana - -import ( - "os" - "testing" - - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" -) - -// To run these acceptance tests, you will need a Grafana server. -// Grafana can be downloaded here: http://grafana.org/download/ -// -// The tests will need an API key to authenticate with the server. To create -// one, use the menu for one of your installation's organizations (The -// "Main Org." is fine if you've just done a fresh installation to run these -// tests) to reach the "API Keys" admin page. -// -// Giving the API key the Admin role is the easiest way to ensure enough -// access is granted to run all of the tests. -// -// Once you've created the API key, set the GRAFANA_URL and GRAFANA_AUTH -// environment variables to the Grafana base URL and the API key respectively, -// and then run: -// make testacc TEST=./builtin/providers/grafana - -var testAccProviders map[string]terraform.ResourceProvider -var testAccProvider *schema.Provider - -func init() { - testAccProvider = Provider().(*schema.Provider) - testAccProviders = map[string]terraform.ResourceProvider{ - "grafana": testAccProvider, - } -} - -func TestProvider(t *testing.T) { - if err := Provider().(*schema.Provider).InternalValidate(); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestProvider_impl(t *testing.T) { - var _ terraform.ResourceProvider = Provider() -} - -func testAccPreCheck(t *testing.T) { - if v := os.Getenv("GRAFANA_URL"); v == "" { - t.Fatal("GRAFANA_URL must be set for acceptance tests") - } - if v := os.Getenv("GRAFANA_AUTH"); v == "" { - t.Fatal("GRAFANA_AUTH must be set for acceptance tests") - } -}