Skip to content

Commit

Permalink
better provider name check/parse
Browse files Browse the repository at this point in the history
Co-authored-by: Pat Gavlin <pat@pulumi.com>
  • Loading branch information
aq17 and pgavlin committed Sep 27, 2023
1 parent dd3ed12 commit a1b0903
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ast/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package ast
import (
"encoding/json"
"fmt"
"regexp"
"strings"

"github.com/hashicorp/hcl/v2"
Expand Down Expand Up @@ -534,7 +533,8 @@ func tryParseFunction(node *syntax.ObjectNode) (Expr, syntax.Diagnostics, bool)
case "fn::toString":
parse = parseToString
default:
if match, _ := regexp.MatchString(fnOpenRegex.String(), kvp.Key.Value()); match {

if providerName, isOpen := strings.CutPrefix(kvp.Key.Value(), "fn::open::"); isOpen {

Check failure on line 537 in ast/expr.go

View workflow job for this annotation

GitHub Actions / test / Test (1.21.0, true)

providerName declared and not used

Check failure on line 537 in ast/expr.go

View workflow job for this annotation

GitHub Actions / lint / lint

providerName declared and not used) (typecheck)

Check failure on line 537 in ast/expr.go

View workflow job for this annotation

GitHub Actions / lint / lint

providerName declared and not used (typecheck)

Check failure on line 537 in ast/expr.go

View workflow job for this annotation

GitHub Actions / lint / lint

providerName declared and not used) (typecheck)
// transform the node into fn::open format
providerName := strings.TrimPrefix(kvp.Key.Value(), "fn::")
// case 1: inputs are provided
Expand Down

0 comments on commit a1b0903

Please sign in to comment.