From e1553f3a1c35587306a96c94ac00e4638b1483f4 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 24 Jun 2024 14:07:04 +0100 Subject: [PATCH] Fail on conflicting regex names --- provider/pkg/resources/parseResourceId.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/provider/pkg/resources/parseResourceId.go b/provider/pkg/resources/parseResourceId.go index 108461512139..870ea326eb23 100644 --- a/provider/pkg/resources/parseResourceId.go +++ b/provider/pkg/resources/parseResourceId.go @@ -21,6 +21,9 @@ func ParseResourceID(id, path string) (map[string]string, error) { if strings.HasPrefix(s, "{") && strings.HasSuffix(s, "}") { name := s[1 : len(s)-1] regexName := regexMatchGroupNameReplacer.ReplaceAllString(name, "") + if clashingPathName, ok := regexNames[regexName]; ok { + return nil, errors.Errorf("clashing path names: '%s' and '%s' while parsing resource ID for path '%s", clashingPathName, name, path) + } regexNames[regexName] = name regexParts[i] = fmt.Sprintf("(?P<%s>.*?)", regexName) } else {