github.com/lymingtonprecision/terraform@v0.9.9-0.20170613092852-62acef9611a9/builtin/providers/test/data_source_label.go (about)

     1  package test
     2  
     3  import (
     4  	"github.com/hashicorp/terraform/helper/schema"
     5  )
     6  
     7  func providerLabelDataSource() *schema.Resource {
     8  	return &schema.Resource{
     9  		Read: providerLabelDataSourceRead,
    10  
    11  		Schema: map[string]*schema.Schema{
    12  			"label": {
    13  				Type:     schema.TypeString,
    14  				Computed: true,
    15  			},
    16  		},
    17  	}
    18  }
    19  
    20  func providerLabelDataSourceRead(d *schema.ResourceData, meta interface{}) error {
    21  	label := meta.(string)
    22  	d.SetId(label)
    23  	d.Set("label", label)
    24  	return nil
    25  }