opentofu/builtin/providers/test/data_source_label.go
Martin Atkins e67c359b2d provider/test: allow assigning a label to each instance
When testing the behavior of multiple provider instances (either aliases
or child module overrides) it's convenient to be able to label the
individual instances to determine which one is actually being used for
the purpose of making test assertions.
2017-05-11 10:52:51 -07:00

26 lines
469 B
Go

package test
import (
"github.com/hashicorp/terraform/helper/schema"
)
func providerLabelDataSource() *schema.Resource {
return &schema.Resource{
Read: providerLabelDataSourceRead,
Schema: map[string]*schema.Schema{
"label": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
func providerLabelDataSourceRead(d *schema.ResourceData, meta interface{}) error {
label := meta.(string)
d.SetId(label)
d.Set("label", label)
return nil
}