diff --git a/builtin/bins/provider-random/main.go b/builtin/bins/provider-random/main.go new file mode 100644 index 000000000..f83de47dc --- /dev/null +++ b/builtin/bins/provider-random/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "github.com/hashicorp/terraform/builtin/providers/random" + "github.com/hashicorp/terraform/plugin" + "github.com/hashicorp/terraform/terraform" +) + +func main() { + plugin.Serve(&plugin.ServeOpts{ + ProviderFunc: func() terraform.ResourceProvider { + return random.Provider() + }, + }) +} diff --git a/builtin/bins/provider-random/main_test.go b/builtin/bins/provider-random/main_test.go new file mode 100644 index 000000000..06ab7d0f9 --- /dev/null +++ b/builtin/bins/provider-random/main_test.go @@ -0,0 +1 @@ +package main diff --git a/builtin/providers/random/provider.go b/builtin/providers/random/provider.go new file mode 100644 index 000000000..999fe19ef --- /dev/null +++ b/builtin/providers/random/provider.go @@ -0,0 +1,31 @@ +package random + +import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/terraform" +) + +// Provider returns a terraform.ResourceProvider. +func Provider() terraform.ResourceProvider { + return &schema.Provider{ + Schema: map[string]*schema.Schema{}, + + ResourcesMap: map[string]*schema.Resource{ + //"random_id": resourceId(), + //"random_shuffle": resourceShuffle(), + }, + } +} + +// stubRead is a do-nothing Read implementation used for our resources, +// which don't actually need to do anything on read. +func stubRead(d *schema.ResourceData, meta interface{}) error { + return nil +} + +// stubDelete is a do-nothing Dete implementation used for our resources, +// which don't actually need to do anything unusual on delete. +func stubDelete(d *schema.ResourceData, meta interface{}) error { + d.SetId("") + return nil +} diff --git a/builtin/providers/random/provider_test.go b/builtin/providers/random/provider_test.go new file mode 100644 index 000000000..92d16c509 --- /dev/null +++ b/builtin/providers/random/provider_test.go @@ -0,0 +1,31 @@ +package random + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/terraform" +) + +var testAccProviders map[string]terraform.ResourceProvider +var testAccProvider *schema.Provider + +func init() { + testAccProvider = Provider().(*schema.Provider) + testAccProviders = map[string]terraform.ResourceProvider{ + "random": 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) { +} diff --git a/command/internal_plugin_list.go b/command/internal_plugin_list.go index bb565fcf9..bfef69b8d 100644 --- a/command/internal_plugin_list.go +++ b/command/internal_plugin_list.go @@ -35,6 +35,7 @@ import ( packetprovider "github.com/hashicorp/terraform/builtin/providers/packet" postgresqlprovider "github.com/hashicorp/terraform/builtin/providers/postgresql" powerdnsprovider "github.com/hashicorp/terraform/builtin/providers/powerdns" + randomprovider "github.com/hashicorp/terraform/builtin/providers/random" rundeckprovider "github.com/hashicorp/terraform/builtin/providers/rundeck" softlayerprovider "github.com/hashicorp/terraform/builtin/providers/softlayer" statuscakeprovider "github.com/hashicorp/terraform/builtin/providers/statuscake" @@ -85,6 +86,7 @@ var InternalProviders = map[string]plugin.ProviderFunc{ "packet": packetprovider.Provider, "postgresql": postgresqlprovider.Provider, "powerdns": powerdnsprovider.Provider, + "random": randomprovider.Provider, "rundeck": rundeckprovider.Provider, "softlayer": softlayerprovider.Provider, "statuscake": statuscakeprovider.Provider,