File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ func (p *Provider) Meta() interface{} {
5858 return p .meta
5959}
6060
61+ // SetMeta can be used to forcefully set the Meta object of the provider.
62+ // Note that if Configure is called the return value will override anything
63+ // set here.
64+ func (p * Provider ) SetMeta (v interface {}) {
65+ p .meta = v
66+ }
67+
6168// Validate validates the provider configuration against the schema.
6269func (p * Provider ) Validate (c * terraform.ResourceConfig ) ([]string , []error ) {
6370 return schemaMap (p .Schema ).Validate (c )
Original file line number Diff line number Diff line change @@ -155,3 +155,16 @@ func TestProviderValidateResource(t *testing.T) {
155155 }
156156 }
157157}
158+
159+ func TestProviderMeta (t * testing.T ) {
160+ p := new (Provider )
161+ if v := p .Meta (); v != nil {
162+ t .Fatalf ("bad: %#v" , v )
163+ }
164+
165+ expected := 42
166+ p .SetMeta (42 )
167+ if v := p .Meta (); ! reflect .DeepEqual (v , expected ) {
168+ t .Fatalf ("bad: %#v" )
169+ }
170+ }
You can’t perform that action at this time.
0 commit comments