2014-05-28 17:07:47 -05:00
|
|
|
package terraform
|
|
|
|
|
2017-10-13 20:43:08 -05:00
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
2014-07-10 15:38:04 -05:00
|
|
|
|
2014-05-28 17:07:47 -05:00
|
|
|
// MockResourceProvider implements ResourceProvider but mocks out all the
|
|
|
|
// calls for testing purposes.
|
|
|
|
type MockResourceProvider struct {
|
2014-07-10 15:38:04 -05:00
|
|
|
sync.Mutex
|
|
|
|
|
2014-06-03 17:08:00 -05:00
|
|
|
// Anything you want, in case you need to store extra data with the mock.
|
|
|
|
Meta interface{}
|
|
|
|
|
core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.
DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.
The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.
Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.
At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-07 23:55:32 -05:00
|
|
|
CloseCalled bool
|
|
|
|
CloseError error
|
2017-10-13 20:43:08 -05:00
|
|
|
GetSchemaCalled bool
|
|
|
|
GetSchemaRequest *ProviderSchemaRequest
|
|
|
|
GetSchemaReturn *ProviderSchema
|
|
|
|
GetSchemaReturnError error
|
core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.
DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.
The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.
Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.
At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-07 23:55:32 -05:00
|
|
|
InputCalled bool
|
|
|
|
InputInput UIInput
|
|
|
|
InputConfig *ResourceConfig
|
|
|
|
InputReturnConfig *ResourceConfig
|
|
|
|
InputReturnError error
|
|
|
|
InputFn func(UIInput, *ResourceConfig) (*ResourceConfig, error)
|
|
|
|
ApplyCalled bool
|
|
|
|
ApplyInfo *InstanceInfo
|
|
|
|
ApplyState *InstanceState
|
|
|
|
ApplyDiff *InstanceDiff
|
|
|
|
ApplyFn func(*InstanceInfo, *InstanceState, *InstanceDiff) (*InstanceState, error)
|
|
|
|
ApplyReturn *InstanceState
|
|
|
|
ApplyReturnError error
|
|
|
|
ConfigureCalled bool
|
|
|
|
ConfigureConfig *ResourceConfig
|
|
|
|
ConfigureFn func(*ResourceConfig) error
|
|
|
|
ConfigureReturnError error
|
|
|
|
DiffCalled bool
|
|
|
|
DiffInfo *InstanceInfo
|
|
|
|
DiffState *InstanceState
|
|
|
|
DiffDesired *ResourceConfig
|
|
|
|
DiffFn func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error)
|
|
|
|
DiffReturn *InstanceDiff
|
|
|
|
DiffReturnError error
|
|
|
|
RefreshCalled bool
|
|
|
|
RefreshInfo *InstanceInfo
|
|
|
|
RefreshState *InstanceState
|
|
|
|
RefreshFn func(*InstanceInfo, *InstanceState) (*InstanceState, error)
|
|
|
|
RefreshReturn *InstanceState
|
|
|
|
RefreshReturnError error
|
|
|
|
ResourcesCalled bool
|
|
|
|
ResourcesReturn []ResourceType
|
|
|
|
ReadDataApplyCalled bool
|
|
|
|
ReadDataApplyInfo *InstanceInfo
|
|
|
|
ReadDataApplyDiff *InstanceDiff
|
|
|
|
ReadDataApplyFn func(*InstanceInfo, *InstanceDiff) (*InstanceState, error)
|
|
|
|
ReadDataApplyReturn *InstanceState
|
|
|
|
ReadDataApplyReturnError error
|
|
|
|
ReadDataDiffCalled bool
|
|
|
|
ReadDataDiffInfo *InstanceInfo
|
|
|
|
ReadDataDiffDesired *ResourceConfig
|
|
|
|
ReadDataDiffFn func(*InstanceInfo, *ResourceConfig) (*InstanceDiff, error)
|
|
|
|
ReadDataDiffReturn *InstanceDiff
|
|
|
|
ReadDataDiffReturnError error
|
2016-10-23 19:33:11 -05:00
|
|
|
StopCalled bool
|
|
|
|
StopFn func() error
|
|
|
|
StopReturnError error
|
core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.
DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.
The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.
Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.
At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-07 23:55:32 -05:00
|
|
|
DataSourcesCalled bool
|
|
|
|
DataSourcesReturn []DataSource
|
|
|
|
ValidateCalled bool
|
|
|
|
ValidateConfig *ResourceConfig
|
|
|
|
ValidateFn func(*ResourceConfig) ([]string, []error)
|
|
|
|
ValidateReturnWarns []string
|
|
|
|
ValidateReturnErrors []error
|
|
|
|
ValidateResourceFn func(string, *ResourceConfig) ([]string, []error)
|
|
|
|
ValidateResourceCalled bool
|
|
|
|
ValidateResourceType string
|
|
|
|
ValidateResourceConfig *ResourceConfig
|
|
|
|
ValidateResourceReturnWarns []string
|
|
|
|
ValidateResourceReturnErrors []error
|
|
|
|
ValidateDataSourceFn func(string, *ResourceConfig) ([]string, []error)
|
|
|
|
ValidateDataSourceCalled bool
|
|
|
|
ValidateDataSourceType string
|
|
|
|
ValidateDataSourceConfig *ResourceConfig
|
|
|
|
ValidateDataSourceReturnWarns []string
|
|
|
|
ValidateDataSourceReturnErrors []error
|
2016-04-26 12:56:41 -05:00
|
|
|
|
|
|
|
ImportStateCalled bool
|
|
|
|
ImportStateInfo *InstanceInfo
|
2016-05-04 14:40:45 -05:00
|
|
|
ImportStateID string
|
2016-04-26 12:56:41 -05:00
|
|
|
ImportStateReturn []*InstanceState
|
|
|
|
ImportStateReturnError error
|
2016-05-09 22:46:16 -05:00
|
|
|
ImportStateFn func(*InstanceInfo, string) ([]*InstanceState, error)
|
2014-06-13 00:30:09 -05:00
|
|
|
}
|
|
|
|
|
2015-06-29 12:33:37 -05:00
|
|
|
func (p *MockResourceProvider) Close() error {
|
|
|
|
p.CloseCalled = true
|
|
|
|
return p.CloseError
|
|
|
|
}
|
|
|
|
|
2017-10-13 20:43:08 -05:00
|
|
|
func (p *MockResourceProvider) GetSchema(req *ProviderSchemaRequest) (*ProviderSchema, error) {
|
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.GetSchemaCalled = true
|
|
|
|
p.GetSchemaRequest = req
|
|
|
|
return p.GetSchemaReturn, p.GetSchemaReturnError
|
|
|
|
}
|
|
|
|
|
2014-09-29 01:50:37 -05:00
|
|
|
func (p *MockResourceProvider) Input(
|
|
|
|
input UIInput, c *ResourceConfig) (*ResourceConfig, error) {
|
2017-08-16 14:19:17 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
2014-09-29 01:50:37 -05:00
|
|
|
p.InputCalled = true
|
|
|
|
p.InputInput = input
|
|
|
|
p.InputConfig = c
|
2014-09-29 11:13:15 -05:00
|
|
|
if p.InputFn != nil {
|
|
|
|
return p.InputFn(input, c)
|
|
|
|
}
|
2014-09-29 01:50:37 -05:00
|
|
|
return p.InputReturnConfig, p.InputReturnError
|
|
|
|
}
|
|
|
|
|
2014-06-13 00:30:09 -05:00
|
|
|
func (p *MockResourceProvider) Validate(c *ResourceConfig) ([]string, []error) {
|
2014-07-10 15:38:04 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
2014-06-13 00:30:09 -05:00
|
|
|
p.ValidateCalled = true
|
|
|
|
p.ValidateConfig = c
|
2014-09-24 23:38:23 -05:00
|
|
|
if p.ValidateFn != nil {
|
|
|
|
return p.ValidateFn(c)
|
|
|
|
}
|
2014-06-13 00:30:09 -05:00
|
|
|
return p.ValidateReturnWarns, p.ValidateReturnErrors
|
2014-05-28 17:07:47 -05:00
|
|
|
}
|
|
|
|
|
2014-07-02 22:35:03 -05:00
|
|
|
func (p *MockResourceProvider) ValidateResource(t string, c *ResourceConfig) ([]string, []error) {
|
2014-07-10 15:38:04 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
2014-07-02 22:35:03 -05:00
|
|
|
p.ValidateResourceCalled = true
|
|
|
|
p.ValidateResourceType = t
|
|
|
|
p.ValidateResourceConfig = c
|
2014-07-11 13:09:19 -05:00
|
|
|
|
|
|
|
if p.ValidateResourceFn != nil {
|
|
|
|
return p.ValidateResourceFn(t, c)
|
|
|
|
}
|
|
|
|
|
2014-07-02 22:35:03 -05:00
|
|
|
return p.ValidateResourceReturnWarns, p.ValidateResourceReturnErrors
|
|
|
|
}
|
|
|
|
|
2014-06-12 19:59:59 -05:00
|
|
|
func (p *MockResourceProvider) Configure(c *ResourceConfig) error {
|
2014-07-10 15:38:04 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
2014-05-28 17:07:47 -05:00
|
|
|
p.ConfigureCalled = true
|
|
|
|
p.ConfigureConfig = c
|
2014-09-24 15:31:35 -05:00
|
|
|
|
|
|
|
if p.ConfigureFn != nil {
|
|
|
|
return p.ConfigureFn(c)
|
|
|
|
}
|
|
|
|
|
2014-06-06 02:28:57 -05:00
|
|
|
return p.ConfigureReturnError
|
2014-05-28 17:07:47 -05:00
|
|
|
}
|
2014-06-03 16:26:31 -05:00
|
|
|
|
2016-10-23 19:33:11 -05:00
|
|
|
func (p *MockResourceProvider) Stop() error {
|
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.StopCalled = true
|
|
|
|
if p.StopFn != nil {
|
|
|
|
return p.StopFn()
|
|
|
|
}
|
|
|
|
|
|
|
|
return p.StopReturnError
|
|
|
|
}
|
|
|
|
|
2014-06-18 17:35:03 -05:00
|
|
|
func (p *MockResourceProvider) Apply(
|
2014-09-16 18:20:11 -05:00
|
|
|
info *InstanceInfo,
|
|
|
|
state *InstanceState,
|
2014-09-17 18:33:24 -05:00
|
|
|
diff *InstanceDiff) (*InstanceState, error) {
|
2015-10-14 12:43:51 -05:00
|
|
|
// We only lock while writing data. Reading is fine
|
2014-07-10 15:38:04 -05:00
|
|
|
p.Lock()
|
2014-06-18 17:35:03 -05:00
|
|
|
p.ApplyCalled = true
|
2014-09-16 18:20:11 -05:00
|
|
|
p.ApplyInfo = info
|
2014-06-18 17:35:03 -05:00
|
|
|
p.ApplyState = state
|
|
|
|
p.ApplyDiff = diff
|
2015-10-14 12:43:51 -05:00
|
|
|
p.Unlock()
|
|
|
|
|
2014-06-18 17:35:03 -05:00
|
|
|
if p.ApplyFn != nil {
|
2014-09-16 18:20:11 -05:00
|
|
|
return p.ApplyFn(info, state, diff)
|
2014-06-18 17:35:03 -05:00
|
|
|
}
|
|
|
|
|
2016-10-17 18:29:24 -05:00
|
|
|
return p.ApplyReturn.DeepCopy(), p.ApplyReturnError
|
2014-06-18 17:35:03 -05:00
|
|
|
}
|
|
|
|
|
2014-06-03 18:42:21 -05:00
|
|
|
func (p *MockResourceProvider) Diff(
|
2014-09-16 18:20:11 -05:00
|
|
|
info *InstanceInfo,
|
|
|
|
state *InstanceState,
|
2014-09-17 18:33:24 -05:00
|
|
|
desired *ResourceConfig) (*InstanceDiff, error) {
|
2017-12-02 21:33:53 -06:00
|
|
|
p.Lock()
|
2017-12-20 08:18:38 -06:00
|
|
|
defer p.Unlock()
|
|
|
|
|
2014-06-05 04:32:10 -05:00
|
|
|
p.DiffCalled = true
|
2014-09-16 18:20:11 -05:00
|
|
|
p.DiffInfo = info
|
2014-06-05 04:32:10 -05:00
|
|
|
p.DiffState = state
|
|
|
|
p.DiffDesired = desired
|
2017-12-02 21:33:53 -06:00
|
|
|
|
2014-06-05 08:57:06 -05:00
|
|
|
if p.DiffFn != nil {
|
2014-09-16 18:20:11 -05:00
|
|
|
return p.DiffFn(info, state, desired)
|
2014-06-05 08:57:06 -05:00
|
|
|
}
|
|
|
|
|
2016-10-17 18:29:24 -05:00
|
|
|
return p.DiffReturn.DeepCopy(), p.DiffReturnError
|
2014-06-03 18:42:21 -05:00
|
|
|
}
|
|
|
|
|
2014-06-19 23:22:07 -05:00
|
|
|
func (p *MockResourceProvider) Refresh(
|
2014-09-16 18:20:11 -05:00
|
|
|
info *InstanceInfo,
|
|
|
|
s *InstanceState) (*InstanceState, error) {
|
2014-07-10 15:38:04 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
2014-06-19 23:22:07 -05:00
|
|
|
p.RefreshCalled = true
|
2014-09-16 18:20:11 -05:00
|
|
|
p.RefreshInfo = info
|
2014-06-19 23:22:07 -05:00
|
|
|
p.RefreshState = s
|
|
|
|
|
|
|
|
if p.RefreshFn != nil {
|
2014-09-16 18:20:11 -05:00
|
|
|
return p.RefreshFn(info, s)
|
2014-06-19 23:22:07 -05:00
|
|
|
}
|
|
|
|
|
2016-10-17 18:29:24 -05:00
|
|
|
return p.RefreshReturn.DeepCopy(), p.RefreshReturnError
|
2014-06-19 23:22:07 -05:00
|
|
|
}
|
|
|
|
|
2014-06-03 16:26:31 -05:00
|
|
|
func (p *MockResourceProvider) Resources() []ResourceType {
|
2014-07-10 15:38:04 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
2014-06-03 16:26:31 -05:00
|
|
|
p.ResourcesCalled = true
|
|
|
|
return p.ResourcesReturn
|
|
|
|
}
|
2016-04-26 12:56:41 -05:00
|
|
|
|
2016-05-04 14:40:45 -05:00
|
|
|
func (p *MockResourceProvider) ImportState(info *InstanceInfo, id string) ([]*InstanceState, error) {
|
2016-04-26 12:56:41 -05:00
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.ImportStateCalled = true
|
|
|
|
p.ImportStateInfo = info
|
2016-05-04 14:40:45 -05:00
|
|
|
p.ImportStateID = id
|
2016-04-26 12:56:41 -05:00
|
|
|
if p.ImportStateFn != nil {
|
2016-05-09 22:46:16 -05:00
|
|
|
return p.ImportStateFn(info, id)
|
2016-04-26 12:56:41 -05:00
|
|
|
}
|
|
|
|
|
2016-10-17 18:29:24 -05:00
|
|
|
var result []*InstanceState
|
|
|
|
if p.ImportStateReturn != nil {
|
|
|
|
result = make([]*InstanceState, len(p.ImportStateReturn))
|
|
|
|
for i, v := range p.ImportStateReturn {
|
|
|
|
result[i] = v.DeepCopy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result, p.ImportStateReturnError
|
2016-04-26 12:56:41 -05:00
|
|
|
}
|
core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.
DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.
The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.
Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.
At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-07 23:55:32 -05:00
|
|
|
|
|
|
|
func (p *MockResourceProvider) ValidateDataSource(t string, c *ResourceConfig) ([]string, []error) {
|
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.ValidateDataSourceCalled = true
|
|
|
|
p.ValidateDataSourceType = t
|
|
|
|
p.ValidateDataSourceConfig = c
|
|
|
|
|
|
|
|
if p.ValidateDataSourceFn != nil {
|
|
|
|
return p.ValidateDataSourceFn(t, c)
|
|
|
|
}
|
|
|
|
|
|
|
|
return p.ValidateDataSourceReturnWarns, p.ValidateDataSourceReturnErrors
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *MockResourceProvider) ReadDataDiff(
|
|
|
|
info *InstanceInfo,
|
|
|
|
desired *ResourceConfig) (*InstanceDiff, error) {
|
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.ReadDataDiffCalled = true
|
|
|
|
p.ReadDataDiffInfo = info
|
|
|
|
p.ReadDataDiffDesired = desired
|
|
|
|
if p.ReadDataDiffFn != nil {
|
|
|
|
return p.ReadDataDiffFn(info, desired)
|
|
|
|
}
|
|
|
|
|
2016-10-17 18:29:24 -05:00
|
|
|
return p.ReadDataDiffReturn.DeepCopy(), p.ReadDataDiffReturnError
|
core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.
DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.
The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.
Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.
At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-07 23:55:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *MockResourceProvider) ReadDataApply(
|
|
|
|
info *InstanceInfo,
|
|
|
|
d *InstanceDiff) (*InstanceState, error) {
|
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.ReadDataApplyCalled = true
|
|
|
|
p.ReadDataApplyInfo = info
|
|
|
|
p.ReadDataApplyDiff = d
|
|
|
|
|
|
|
|
if p.ReadDataApplyFn != nil {
|
|
|
|
return p.ReadDataApplyFn(info, d)
|
|
|
|
}
|
|
|
|
|
2016-10-17 18:29:24 -05:00
|
|
|
return p.ReadDataApplyReturn.DeepCopy(), p.ReadDataApplyReturnError
|
core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.
DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.
The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.
Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.
At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-07 23:55:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *MockResourceProvider) DataSources() []DataSource {
|
|
|
|
p.Lock()
|
|
|
|
defer p.Unlock()
|
|
|
|
|
|
|
|
p.DataSourcesCalled = true
|
|
|
|
return p.DataSourcesReturn
|
|
|
|
}
|