Skip to content

Commit

Permalink
Fix display name for nested data resources
Browse files Browse the repository at this point in the history
  • Loading branch information
JackFlukinger committed Feb 10, 2022
1 parent f641f9c commit f2d1cf5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions map.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ func (r *rover) GenerateModuleMap(parent *Resource, parentModule string) {

tcr := &Resource{
Type: rs.Type,
Name: strings.TrimPrefix(crName, fmt.Sprintf("%s%s.", prefix, re.ResourceType)),
}

if rs.Type == ResourceTypeData {
tcr.Name = strings.TrimPrefix(crName, fmt.Sprintf("%sdata.%s.", prefix, re.ResourceType))
} else {
tcr.Name = strings.TrimPrefix(crName, fmt.Sprintf("%s%s.", prefix, re.ResourceType))
}

if cr.Change.Actions != nil {
Expand All @@ -211,7 +216,6 @@ func (r *rover) GenerateModuleMap(parent *Resource, parentModule string) {
if rs.Type == ResourceTypeData && configs[parentConfig].Module.DataResources[ind] != nil {

fname = filepath.Base(configs[parentConfig].Module.DataResources[ind].Pos.Filename)
fmt.Printf("%v\n", ind)
re.Line = &configs[parentConfig].Module.DataResources[ind].Pos.Line

r.AddFileIfNotExists(parent, parentModule, fname)
Expand Down

0 comments on commit f2d1cf5

Please sign in to comment.