remove a few traces of states.EachMode

This commit is contained in:
James Bardin 2020-04-24 21:36:44 -04:00
parent 98cf28b02d
commit 15a95031e5
3 changed files with 2 additions and 10 deletions

View File

@ -259,6 +259,7 @@ func marshalResources(resources map[string]*states.Resource, module addrs.Module
current := resource{ current := resource{
Address: r.Addr.Instance(k).String(), Address: r.Addr.Instance(k).String(),
Index: k,
Type: resAddr.Type, Type: resAddr.Type,
Name: resAddr.Name, Name: resAddr.Name,
ProviderName: r.ProviderConfig.Provider.String(), ProviderName: r.ProviderConfig.Provider.String(),
@ -276,10 +277,6 @@ func marshalResources(resources map[string]*states.Resource, module addrs.Module
) )
} }
if r.EachMode != states.NoEach {
current.Index = k
}
schema, _ := schemas.ResourceTypeConfig( schema, _ := schemas.ResourceTypeConfig(
r.ProviderConfig.Provider, r.ProviderConfig.Provider,
resAddr.Mode, resAddr.Mode,

View File

@ -193,7 +193,6 @@ func TestMarshalResources(t *testing.T) {
Name: "bar", Name: "bar",
}, },
}, },
EachMode: states.NoEach,
Instances: map[addrs.InstanceKey]*states.ResourceInstance{ Instances: map[addrs.InstanceKey]*states.ResourceInstance{
addrs.NoKey: { addrs.NoKey: {
Current: &states.ResourceInstanceObjectSrc{ Current: &states.ResourceInstanceObjectSrc{
@ -237,7 +236,6 @@ func TestMarshalResources(t *testing.T) {
Name: "bar", Name: "bar",
}, },
}, },
EachMode: states.EachList,
Instances: map[addrs.InstanceKey]*states.ResourceInstance{ Instances: map[addrs.InstanceKey]*states.ResourceInstance{
addrs.IntKey(0): { addrs.IntKey(0): {
Current: &states.ResourceInstanceObjectSrc{ Current: &states.ResourceInstanceObjectSrc{
@ -281,7 +279,6 @@ func TestMarshalResources(t *testing.T) {
Name: "bar", Name: "bar",
}, },
}, },
EachMode: states.EachMap,
Instances: map[addrs.InstanceKey]*states.ResourceInstance{ Instances: map[addrs.InstanceKey]*states.ResourceInstance{
addrs.StringKey("rockhopper"): { addrs.StringKey("rockhopper"): {
Current: &states.ResourceInstanceObjectSrc{ Current: &states.ResourceInstanceObjectSrc{
@ -325,7 +322,6 @@ func TestMarshalResources(t *testing.T) {
Name: "bar", Name: "bar",
}, },
}, },
EachMode: states.NoEach,
Instances: map[addrs.InstanceKey]*states.ResourceInstance{ Instances: map[addrs.InstanceKey]*states.ResourceInstance{
addrs.NoKey: { addrs.NoKey: {
Deposed: map[states.DeposedKey]*states.ResourceInstanceObjectSrc{ Deposed: map[states.DeposedKey]*states.ResourceInstanceObjectSrc{
@ -371,7 +367,6 @@ func TestMarshalResources(t *testing.T) {
Name: "bar", Name: "bar",
}, },
}, },
EachMode: states.NoEach,
Instances: map[addrs.InstanceKey]*states.ResourceInstance{ Instances: map[addrs.InstanceKey]*states.ResourceInstance{
addrs.NoKey: { addrs.NoKey: {
Deposed: map[states.DeposedKey]*states.ResourceInstanceObjectSrc{ Deposed: map[states.DeposedKey]*states.ResourceInstanceObjectSrc{

View File

@ -154,6 +154,6 @@ func TestFullInitialState() *states.State {
Provider: addrs.NewLegacyProvider(rAddr.ImpliedProvider()), Provider: addrs.NewLegacyProvider(rAddr.ImpliedProvider()),
Module: addrs.RootModule, Module: addrs.RootModule,
} }
childMod.SetResourceMeta(rAddr, states.EachList, providerAddr) childMod.SetResourceProvider(rAddr, providerAddr)
return state return state
} }