File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,13 @@ resource "aws_nat_gateway" "nat" {
8
8
allocation_id = "${element(aws_eip.nat.*.id, count.index)}"
9
9
subnet_id = "${element(aws_subnet.public.*.id, count.index)}"
10
10
count = "${length(var.public_subnets)}"
11
- }
11
+ }
12
+
13
+ data "template_file" "template1" {
14
+ template = "${file("${path.module}/template1.tpl")}"
15
+ vars {
16
+ t1_var1 = "${var.t1_var1}"
17
+ t1-var2 = "${var.t1-var2}"
18
+ t1-var3 = "${var.t1-Var3}"
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -41,8 +41,9 @@ func TestMatchVariable(t *testing.T) {
41
41
for _ , text := range messages {
42
42
ter .matchVarPref (text , varPrefix )
43
43
}
44
- if len (ter .Variables ) != 1 {
45
- t .Errorf ("Should return one variable. but returned %d" , len (ter .Variables ))
44
+ if len (ter .Variables ) != 4 {
45
+ t .Errorf ("Should return four variable. but returned %d" , len (ter .Variables ))
46
+ t .Errorf ("Variables found: %s" , ter .Variables )
46
47
}
47
48
48
49
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ type terraformVars struct {
11
11
12
12
func (t * terraformVars ) matchVarPref (row , varPrefix string ) {
13
13
if strings .Contains (row , varPrefix ) {
14
- pattern := regexp .MustCompile (`var.([a-z?_]+ )` )
14
+ pattern := regexp .MustCompile (`var.([a-z?0-9?_][a-z?0-9?_?-]* )` )
15
15
match := pattern .FindAllStringSubmatch (row , 1 )
16
16
if len (match ) != 0 {
17
17
res := replacer .Replace (match [0 ][0 ])
You can’t perform that action at this time.
0 commit comments