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-05-28 07:58:44 +02:00
|
|
|
"test_resource": testResource(),
|
|
|
|
"test_resource_gh12183": testResourceGH12183(),
|
2019-01-30 01:49:02 +01:00
|
|
|
"test_resource_import_other": testResourceImportOther(),
|
2019-04-16 02:54:06 +02:00
|
|
|
"test_resource_import_removed": testResourceImportRemoved(),
|
2017-05-28 07:58:44 +02:00
|
|
|
"test_resource_with_custom_diff": testResourceCustomDiff(),
|
2018-10-30 17:58:29 +01:00
|
|
|
"test_resource_timeout": testResourceTimeout(),
|
2018-10-30 19:53:02 +01:00
|
|
|
"test_resource_diff_suppress": testResourceDiffSuppress(),
|
2018-10-31 18:42:28 +01:00
|
|
|
"test_resource_force_new": testResourceForceNew(),
|
2018-11-01 21:11:19 +01:00
|
|
|
"test_resource_nested": testResourceNested(),
|
2018-11-08 18:15:06 +01:00
|
|
|
"test_resource_nested_set": testResourceNestedSet(),
|
2018-12-03 18:47:17 +01:00
|
|
|
"test_resource_state_func": testResourceStateFunc(),
|
2019-01-11 23:36:46 +01:00
|
|
|
"test_resource_deprecated": testResourceDeprecated(),
|
2019-01-16 22:54:02 +01:00
|
|
|
"test_resource_defaults": testResourceDefaults(),
|
2019-01-18 19:05:59 +01:00
|
|
|
"test_resource_list": testResourceList(),
|
2019-02-02 03:34:12 +01:00
|
|
|
"test_resource_list_set": testResourceListSet(),
|
2019-01-23 22:33:19 +01:00
|
|
|
"test_resource_map": testResourceMap(),
|
2019-02-01 23:07:56 +01:00
|
|
|
"test_resource_computed_set": testResourceComputedSet(),
|
2019-03-09 01:31:22 +01:00
|
|
|
"test_resource_config_mode": testResourceConfigMode(),
|
2019-02-05 22:16:08 +01:00
|
|
|
"test_resource_nested_id": testResourceNestedId(),
|
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
|
|
|
}
|