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,12 +5957,13 @@ func TestContext2Apply_destroyOrder(t *testing.T) {
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
ctx = testContext2(t, &ContextOpts{
State: state,
Module: module.NewEmptyTree(),
Hooks: []Hook{h},
Destroy: true,
State: state,
Module: m,
Hooks: []Hook{h},
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),

View File

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

View File

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