Skip to content

Commit 427d9ad

Browse files
committed
Sort variables before writing them to file
1 parent d4eb950 commit 427d9ad

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

generator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func main() {
7272
f, err := os.Create(dstFile)
7373
checkError(err)
7474

75+
t.sortVars()
7576
err = varTemplate.Execute(f, t.Variables)
7677
checkError(err)
7778
log.Infof("Variables are generated to %q file", dstFile)

terraform.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"regexp"
5+
"sort"
56
"strings"
67
)
78

@@ -21,3 +22,7 @@ func (t *terraformVars) matchVarPref(row, varPrefix string) {
2122
}
2223
}
2324
}
25+
26+
func (t *terraformVars) sortVars() {
27+
sort.Sort(sort.StringSlice(t.Variables))
28+
}

0 commit comments

Comments
 (0)