2016-03-15 10:11:28 -05: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 13:47:22 -05: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 10:11:28 -05:00
|
|
|
ResourcesMap: map[string]*schema.Resource{
|
2017-05-28 00:58:44 -05:00
|
|
|
"test_resource": testResource(),
|
2019-03-14 16:39:38 -05:00
|
|
|
"test_resource_as_single": testResourceAsSingle(),
|
2017-05-28 00:58:44 -05:00
|
|
|
"test_resource_gh12183": testResourceGH12183(),
|
2019-01-29 18:49:02 -06:00
|
|
|
"test_resource_import_other": testResourceImportOther(),
|
2017-05-28 00:58:44 -05:00
|
|
|
"test_resource_with_custom_diff": testResourceCustomDiff(),
|
2018-10-30 11:58:29 -05:00
|
|
|
"test_resource_timeout": testResourceTimeout(),
|
2018-10-30 13:53:02 -05:00
|
|
|
"test_resource_diff_suppress": testResourceDiffSuppress(),
|
2018-10-31 12:42:28 -05:00
|
|
|
"test_resource_force_new": testResourceForceNew(),
|
2018-11-01 15:11:19 -05:00
|
|
|
"test_resource_nested": testResourceNested(),
|
2018-11-08 11:15:06 -06:00
|
|
|
"test_resource_nested_set": testResourceNestedSet(),
|
2018-12-03 11:47:17 -06:00
|
|
|
"test_resource_state_func": testResourceStateFunc(),
|
2019-01-11 16:36:46 -06:00
|
|
|
"test_resource_deprecated": testResourceDeprecated(),
|
2019-01-16 15:54:02 -06:00
|
|
|
"test_resource_defaults": testResourceDefaults(),
|
2019-01-18 12:05:59 -06:00
|
|
|
"test_resource_list": testResourceList(),
|
2019-02-01 20:34:12 -06:00
|
|
|
"test_resource_list_set": testResourceListSet(),
|
2019-01-23 15:33:19 -06:00
|
|
|
"test_resource_map": testResourceMap(),
|
2019-02-01 16:07:56 -06:00
|
|
|
"test_resource_computed_set": testResourceComputedSet(),
|
2019-03-08 18:31:22 -06:00
|
|
|
"test_resource_config_mode": testResourceConfigMode(),
|
2019-02-05 15:16:08 -06:00
|
|
|
"test_resource_nested_id": testResourceNestedId(),
|
2016-03-15 10:11:28 -05:00
|
|
|
},
|
2016-06-30 18:22:20 -05:00
|
|
|
DataSourcesMap: map[string]*schema.Resource{
|
2017-05-09 13:47:22 -05:00
|
|
|
"test_data_source": testDataSource(),
|
|
|
|
"test_provider_label": providerLabelDataSource(),
|
2016-06-30 18:22:20 -05:00
|
|
|
},
|
2016-03-15 10:11:28 -05:00
|
|
|
ConfigureFunc: providerConfigure,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
2017-05-09 13:47:22 -05:00
|
|
|
return d.Get("label"), nil
|
2016-03-15 10:11:28 -05:00
|
|
|
}
|