write providers to state for data resources

And update the test state strings

Destroying with no config is no longer allowed, run an exlpicit destroy
for the destroyOrder test.
This commit is contained in:
James Bardin 2017-11-07 20:42:00 -05:00
parent 8dfaae1f23
commit c2f3522f7d
3 changed files with 9 additions and 6 deletions

View File

@ -5957,11 +5957,12 @@ func TestContext2Apply_destroyOrder(t *testing.T) {
t.Logf("State 1: %s", state) t.Logf("State 1: %s", state)
// Next, plan and apply config-less to force a destroy with "apply" // Next, plan and apply a destroy
h.Active = true h.Active = true
ctx = testContext2(t, &ContextOpts{ ctx = testContext2(t, &ContextOpts{
Destroy: true,
State: state, State: state,
Module: module.NewEmptyTree(), Module: m,
Hooks: []Hook{h}, Hooks: []Hook{h},
ProviderResolver: ResourceProviderResolverFixed( ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{ map[string]ResourceProviderFactory{

View File

@ -148,7 +148,7 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode {
&EvalWriteState{ &EvalWriteState{
Name: stateId, Name: stateId,
ResourceType: rs.Type, ResourceType: rs.Type,
Provider: rs.Provider, Provider: n.ResolvedProvider,
Dependencies: rs.Dependencies, Dependencies: rs.Dependencies,
State: &state, // state is nil here State: &state, // state is nil here
}, },
@ -210,7 +210,7 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode {
&EvalWriteState{ &EvalWriteState{
Name: stateId, Name: stateId,
ResourceType: rs.Type, ResourceType: rs.Type,
Provider: rs.Provider, Provider: n.ResolvedProvider,
Dependencies: rs.Dependencies, Dependencies: rs.Dependencies,
State: &state, State: &state,
}, },

View File

@ -1754,6 +1754,7 @@ hcl_instance.hcltest:
const testTerraformRefreshDataRefDataStr = ` const testTerraformRefreshDataRefDataStr = `
data.null_data_source.bar: data.null_data_source.bar:
ID = foo ID = foo
provider = provider.null
bar = yes bar = yes
type = null_data_source type = null_data_source
@ -1761,6 +1762,7 @@ data.null_data_source.bar:
data.null_data_source.foo data.null_data_source.foo
data.null_data_source.foo: data.null_data_source.foo:
ID = foo ID = foo
provider = provider.null
foo = yes foo = yes
type = null_data_source type = null_data_source
` `