plans/planfile: allow resource instances with no instance key

This happens for resources that don't have either "count" or "for_each"
set.
This commit is contained in:
Martin Atkins 2018-09-26 09:20:32 -07:00
parent 9e0f7c10d9
commit 9179cdcbc6
1 changed files with 3 additions and 0 deletions

View File

@ -172,6 +172,7 @@ func resourceChangeFromTfplan(rawChange *planproto.ResourceInstanceChange) (*pla
var instKey addrs.InstanceKey
switch rawTk := rawChange.InstanceKey.(type) {
case nil:
case *planproto.ResourceInstanceChange_Int:
instKey = addrs.IntKey(rawTk.Int)
case *planproto.ResourceInstanceChange_Str:
@ -382,6 +383,8 @@ func resourceChangeToTfplan(change *plans.ResourceInstanceChangeSrc) (*planproto
ret.Name = relAddr.Resource.Name
switch tk := relAddr.Key.(type) {
case nil:
// Nothing to do, then.
case addrs.IntKey:
ret.InstanceKey = &planproto.ResourceInstanceChange_Int{
Int: int64(tk),