Skip to content

Commit

Permalink
Fix adammck#130 - Google was bot working due to lack of recursion on …
Browse files Browse the repository at this point in the history
…attributes parsing
  • Loading branch information
ptgeorge committed Nov 24, 2019
1 parent a408e89 commit d576aed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions parser.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package main


import (
"encoding/json"
"fmt"
Expand Down Expand Up @@ -289,6 +290,11 @@ func encodeTerraform0Dot12ValuesAsAttributes(rawValues *map[string]interface{})
for kk, vv := range v {
if str, typeOk := vv.(string); typeOk {
ret[k+"."+strconv.Itoa(kk)] = str
} else if mi, typeOk := vv.(map[string]interface{}); typeOk {
attribs := encodeTerraform0Dot12ValuesAsAttributes(&mi)
for k3, v3 := range attribs {
ret[k+"."+strconv.Itoa(kk)+"."+k3] = v3
}
} else {
ret[k+"."+strconv.Itoa(kk)] = "<error>"
}
Expand All @@ -312,7 +318,6 @@ func (s *stateTerraform0dot12) resources() []*Resource {
if !typeOk {
continue
}

if strings.HasPrefix(rs.Address, "data.") {
// This does not represent a host (e.g. AWS AMI)
continue
Expand All @@ -326,7 +331,6 @@ func (s *stateTerraform0dot12) resources() []*Resource {
if rs.Index != nil {
resourceKeyName += "." + strconv.Itoa(*rs.Index)
}

// Terraform stores resources in a name->map map, but we need the name to
// decide which groups to include the resource in. So wrap it in a higher-
// level object with both properties.
Expand Down

0 comments on commit d576aed

Please sign in to comment.