github.com/Kevinklinger/open_terraform@v0.11.12-beta1/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_with_custom_diff": testResourceCustomDiff(),
    23  		},
    24  		DataSourcesMap: map[string]*schema.Resource{
    25  			"test_data_source":    testDataSource(),
    26  			"test_provider_label": providerLabelDataSource(),
    27  		},
    28  		ConfigureFunc: providerConfigure,
    29  	}
    30  }
    31  
    32  func providerConfigure(d *schema.ResourceData) (interface{}, error) {
    33  	return d.Get("label"), nil
    34  }