2016-03-15 16:11:28 +01:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Provider() terraform.ResourceProvider {
|
|
|
|
return &schema.Provider{
|
2017-05-09 20:47:22 +02:00
|
|
|
Schema: map[string]*schema.Schema{
|
|
|
|
// Optional attribute to label a particular instance for a test
|
|
|
|
// that has multiple instances of this provider, so that they
|
|
|
|
// can be distinguished using the test_provider_label data source.
|
|
|
|
"label": {
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
},
|
|
|
|
},
|
2016-03-15 16:11:28 +01:00
|
|
|
ResourcesMap: map[string]*schema.Resource{
|
2017-02-23 19:03:59 +01:00
|
|
|
"test_resource": testResource(),
|
|
|
|
"test_resource_gh12183": testResourceGH12183(),
|
2016-03-15 16:11:28 +01:00
|
|
|
},
|
2016-07-01 01:22:20 +02:00
|
|
|
DataSourcesMap: map[string]*schema.Resource{
|
2017-05-09 20:47:22 +02:00
|
|
|
"test_data_source": testDataSource(),
|
|
|
|
"test_provider_label": providerLabelDataSource(),
|
2016-07-01 01:22:20 +02:00
|
|
|
},
|
2016-03-15 16:11:28 +01:00
|
|
|
ConfigureFunc: providerConfigure,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
2017-05-09 20:47:22 +02:00
|
|
|
return d.Get("label"), nil
|
2016-03-15 16:11:28 +01:00
|
|
|
}
|