File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,6 @@ data "template_file" "template1" {
15
15
vars {
16
16
t1_var1 = "${var.t1_var1}"
17
17
t1-var2 = "${var.t1-var2}"
18
- t1-var3 = "${var.t1-Var3}"
18
+ t1-var3 = "${var.t1-Var3}-${var.t1-inline} "
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ func TestMatchVariable(t *testing.T) {
41
41
for _ , text := range messages {
42
42
ter .matchVarPref (text , varPrefix )
43
43
}
44
- if len (ter .Variables ) != 4 {
45
- t .Errorf ("Should return four variable. but returned %d" , len (ter .Variables ))
44
+ if len (ter .Variables ) != 5 {
45
+ t .Errorf ("Should return five variable. but returned %d" , len (ter .Variables ))
46
46
t .Errorf ("Variables found: %s" , ter .Variables )
47
47
}
48
48
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ type terraformVars struct {
12
12
13
13
func (t * terraformVars ) matchVarPref (row , varPrefix string ) {
14
14
if strings .Contains (row , varPrefix ) {
15
- pattern := regexp .MustCompile (`var.([a-z?0-9?_][a-z?0-9?_?-]*)` )
16
- match := pattern .FindAllStringSubmatch (row , 1 )
17
- if len ( match ) != 0 {
18
- res := replacer .Replace (match [ 0 ] [0 ])
15
+ pattern := regexp .MustCompile (`var.([a-z?A-Z? 0-9?_][a-z?A-Z ?0-9?_?-]*)` )
16
+ match := pattern .FindAllStringSubmatch (row , - 1 )
17
+ for _ , m := range match {
18
+ res := replacer .Replace (m [0 ])
19
19
if ! containsElement (t .Variables , res ) {
20
20
t .Variables = append (t .Variables , res )
21
21
}
You can’t perform that action at this time.
0 commit comments