Skip to content

Commit

Permalink
Fix infinite loop on variable resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Bergeron committed Nov 27, 2020
1 parent 9b32df3 commit 8a70f9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/iac-providers/terraform/v12/variable-references.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ func (r *RefResolver) ResolveVarRefFromParentModuleCall(varRef string) interface
if reflect.TypeOf(val).Kind() == reflect.String {
valStr := val.(string)
resolvedVal := strings.Replace(varRef, varExpr, valStr, 1)
if varRef == resolvedVal {
zap.S().Debugf("resolved str variable ref refers to self: '%v'", varRef)
return val
}
zap.S().Debugf("resolved str variable ref: '%v', value: '%v'", varRef, string(resolvedVal))
return r.ResolveStrRef(resolvedVal)
}
Expand Down

0 comments on commit 8a70f9e

Please sign in to comment.