github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/builtin/providers/test/provider.go (about)

     1  package test
     2  
     3  import (
     4  	"github.com/hashicorp/terraform/helper/schema"
     5  	"github.com/hashicorp/terraform/terraform"
     6  )
     7  
     8  func Provider() terraform.ResourceProvider {
     9  	return &schema.Provider{
    10  		Schema: map[string]*schema.Schema{
    11  			// Optional attribute to label a particular instance for a test
    12  			// that has multiple instances of this provider, so that they
    13  			// can be distinguished using the test_provider_label data source.
    14  			"label": {
    15  				Type:     schema.TypeString,
    16  				Optional: true,
    17  			},
    18  		},
    19  		ResourcesMap: map[string]*schema.Resource{
    20  			"test_resource":                  testResource(),
    21  			"test_resource_gh12183":          testResourceGH12183(),
    22  			"test_resource_import_other":     testResourceImportOther(),
    23  			"test_resource_import_removed":   testResourceImportRemoved(),
    24  			"test_resource_with_custom_diff": testResourceCustomDiff(),
    25  			"test_resource_timeout":          testResourceTimeout(),
    26  			"test_resource_diff_suppress":    testResourceDiffSuppress(),
    27  			"test_resource_force_new":        testResourceForceNew(),
    28  			"test_resource_nested":           testResourceNested(),
    29  			"test_resource_nested_set":       testResourceNestedSet(),
    30  			"test_resource_state_func":       testResourceStateFunc(),
    31  			"test_resource_deprecated":       testResourceDeprecated(),
    32  			"test_resource_defaults":         testResourceDefaults(),
    33  			"test_resource_list":             testResourceList(),
    34  			"test_resource_list_set":         testResourceListSet(),
    35  			"test_resource_map":              testResourceMap(),
    36  			"test_resource_computed_set":     testResourceComputedSet(),
    37  			"test_resource_config_mode":      testResourceConfigMode(),
    38  			"test_resource_nested_id":        testResourceNestedId(),
    39  			"test_resource_signal":           testResourceSignal(),
    40  			"test_undeleteable":              testResourceUndeleteable(),
    41  			"test_resource_required_min":     testResourceRequiredMin(),
    42  		},
    43  		DataSourcesMap: map[string]*schema.Resource{
    44  			"test_data_source":    testDataSource(),
    45  			"test_provider_label": providerLabelDataSource(),
    46  		},
    47  		ConfigureFunc: providerConfigure,
    48  	}
    49  }
    50  
    51  func providerConfigure(d *schema.ResourceData) (interface{}, error) {
    52  	return d.Get("label"), nil
    53  }