core: NewInstanceInfo now produces correct "id" for data resources

We need to mimic the old API here, and we weren't doing that quite right
since the "data" prefix was missing from data resources.
This commit is contained in:
Martin Atkins 2018-05-22 18:49:22 -07:00
parent 299fe25a04
commit cc5b1d452f
1 changed files with 3 additions and 0 deletions

View File

@ -132,6 +132,9 @@ func NewInstanceInfo(addr addrs.AbsResource) *InstanceInfo {
// determine from an InstanceInfo alone whether it is a managed or data
// resource that is being referred to.
id := fmt.Sprintf("%s.%s", addr.Resource.Type, addr.Resource.Name)
if addr.Resource.Mode == addrs.DataResourceMode {
id = "data." + id
}
return &InstanceInfo{
Id: id,