@@ -222,18 +222,15 @@ func validateCoderTemplateReadmeBody(body string) []error {
222222 errs = append (errs , baseErrs ... )
223223 }
224224
225+ var nextLine string
225226 foundParagraph := false
226- terraformCodeBlockCount := 0
227- foundTerraformVersionRef := false
228-
229- lineNum := 0
230227 isInsideCodeBlock := false
231- isInsideTerraform := false
228+ lineNum := 0
232229
233230 lineScanner := bufio .NewScanner (strings .NewReader (trimmed ))
234231 for lineScanner .Scan () {
235232 lineNum ++
236- nextLine : = lineScanner .Text ()
233+ nextLine = lineScanner .Text ()
237234
238235 // Code assumes that invalid headers would've already been handled by the base validation function, so we don't
239236 // need to check deeper if the first line isn't an h1.
@@ -246,23 +243,12 @@ func validateCoderTemplateReadmeBody(body string) []error {
246243
247244 if strings .HasPrefix (nextLine , "```" ) {
248245 isInsideCodeBlock = ! isInsideCodeBlock
249- isInsideTerraform = isInsideCodeBlock && strings .HasPrefix (nextLine , "```tf" )
250- if isInsideTerraform {
251- terraformCodeBlockCount ++
252- }
253246 if strings .HasPrefix (nextLine , "```hcl" ) {
254247 errs = append (errs , xerrors .New ("all .hcl language references must be converted to .tf" ))
255248 }
256249 continue
257250 }
258251
259- if isInsideCodeBlock {
260- if isInsideTerraform {
261- foundTerraformVersionRef = foundTerraformVersionRef || terraformVersionRe .MatchString (nextLine )
262- }
263- continue
264- }
265-
266252 // Code assumes that we can treat this case as the end of the "h1 section" and don't need to process any further lines.
267253 if lineNum > 1 && strings .HasPrefix (nextLine , "#" ) {
268254 break
@@ -275,16 +261,6 @@ func validateCoderTemplateReadmeBody(body string) []error {
275261 foundParagraph = foundParagraph || isParagraph
276262 }
277263
278- if terraformCodeBlockCount == 0 {
279- errs = append (errs , xerrors .New ("did not find Terraform code block within h1 section" ))
280- } else {
281- if terraformCodeBlockCount > 1 {
282- errs = append (errs , xerrors .New ("cannot have more than one Terraform code block in h1 section" ))
283- }
284- if ! foundTerraformVersionRef {
285- errs = append (errs , xerrors .New ("did not find Terraform code block that specifies 'version' field" ))
286- }
287- }
288264 if ! foundParagraph {
289265 errs = append (errs , xerrors .New ("did not find paragraph within h1 section" ))
290266 }
0 commit comments