@@ -31,11 +31,21 @@ func TestParse(t *testing.T) {
31
31
Files : map [string ]string {
32
32
"main.tf" : `variable "A" {
33
33
description = "Testing!"
34
- }` ,
34
+ }
35
+
36
+ provider "coder" { feature_use_managed_variables = "true" }` ,
35
37
},
36
38
Response : & proto.Parse_Response {
37
39
Type : & proto.Parse_Response_Complete {
38
- Complete : & proto.Parse_Complete {},
40
+ Complete : & proto.Parse_Complete {
41
+ TemplateVariables : []* proto.TemplateVariable {
42
+ {
43
+ Name : "A" ,
44
+ Description : "Testing!" ,
45
+ Required : true ,
46
+ },
47
+ },
48
+ },
39
49
},
40
50
},
41
51
},
@@ -44,11 +54,20 @@ func TestParse(t *testing.T) {
44
54
Files : map [string ]string {
45
55
"main.tf" : `variable "A" {
46
56
default = "wow"
47
- }` ,
57
+ }
58
+
59
+ provider "coder" { feature_use_managed_variables = "true" }` ,
48
60
},
49
61
Response : & proto.Parse_Response {
50
62
Type : & proto.Parse_Response_Complete {
51
- Complete : & proto.Parse_Complete {},
63
+ Complete : & proto.Parse_Complete {
64
+ TemplateVariables : []* proto.TemplateVariable {
65
+ {
66
+ Name : "A" ,
67
+ DefaultValue : "wow" ,
68
+ },
69
+ },
70
+ },
52
71
},
53
72
},
54
73
},
@@ -59,11 +78,20 @@ func TestParse(t *testing.T) {
59
78
validation {
60
79
condition = var.A == "value"
61
80
}
62
- }` ,
81
+ }
82
+
83
+ provider "coder" { feature_use_managed_variables = "true" }` ,
63
84
},
64
85
Response : & proto.Parse_Response {
65
86
Type : & proto.Parse_Response_Complete {
66
- Complete : & proto.Parse_Complete {},
87
+ Complete : & proto.Parse_Complete {
88
+ TemplateVariables : []* proto.TemplateVariable {
89
+ {
90
+ Name : "A" ,
91
+ Required : true ,
92
+ },
93
+ },
94
+ },
67
95
},
68
96
},
69
97
},
@@ -78,13 +106,34 @@ func TestParse(t *testing.T) {
78
106
Name : "multiple-variables" ,
79
107
Files : map [string ]string {
80
108
"main1.tf" : `variable "foo" { }
81
- variable "bar" { }` ,
109
+ variable "bar" { }
110
+
111
+ provider "coder" { feature_use_managed_variables = "true" }` ,
82
112
"main2.tf" : `variable "baz" { }
83
113
variable "quux" { }` ,
84
114
},
85
115
Response : & proto.Parse_Response {
86
116
Type : & proto.Parse_Response_Complete {
87
- Complete : & proto.Parse_Complete {},
117
+ Complete : & proto.Parse_Complete {
118
+ TemplateVariables : []* proto.TemplateVariable {
119
+ {
120
+ Name : "foo" ,
121
+ Required : true ,
122
+ },
123
+ {
124
+ Name : "bar" ,
125
+ Required : true ,
126
+ },
127
+ {
128
+ Name : "baz" ,
129
+ Required : true ,
130
+ },
131
+ {
132
+ Name : "quux" ,
133
+ Required : true ,
134
+ },
135
+ },
136
+ },
88
137
},
89
138
},
90
139
},
0 commit comments