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