Skip to content

Commit 5cbb712

Browse files
committed
fix: Remove incorrect minimumTerraformVersion variable
1 parent 1d7f825 commit 5cbb712

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

provisioner/terraform/executor.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ func (e executor) checkMinVersion(ctx context.Context) error {
116116
if err != nil {
117117
return err
118118
}
119-
if !v.GreaterThanOrEqual(minimumTerraformVersion) {
119+
if !v.GreaterThanOrEqual(minTerraformVersion) {
120120
return xerrors.Errorf(
121121
"terraform version %q is too old. required >= %q",
122122
v.String(),
123-
minimumTerraformVersion.String())
123+
minTerraformVersion.String())
124124
}
125125
return nil
126126
}
@@ -435,9 +435,6 @@ func provisionReadAndLog(logr logger, reader io.Reader, done chan<- any) {
435435

436436
// If the diagnostic is provided, let's provide a bit more info!
437437
logLevel = convertTerraformLogLevel(log.Diagnostic.Severity, logr)
438-
if err != nil {
439-
continue
440-
}
441438
err = logr.Log(&proto.Log{Level: logLevel, Output: log.Diagnostic.Detail})
442439
if err != nil {
443440
// Not much we can do. We can't log because logging is itself breaking!

provisioner/terraform/serve.go

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,16 @@ import (
1515
"github.com/coder/coder/provisionersdk"
1616
)
1717

18-
// This is the exact version of Terraform used internally
19-
// when Terraform is missing on the system.
20-
var terraformVersion = version.Must(version.NewVersion("1.2.1"))
21-
var minTerraformVersion = version.Must(version.NewVersion("1.1.0"))
22-
var maxTerraformVersion = version.Must(version.NewVersion("1.2.1"))
23-
2418
var (
25-
// The minimum version of Terraform supported by the provisioner.
26-
// Validation came out in 0.13.0, which was released August 10th, 2020.
27-
// https://www.hashicorp.com/blog/announcing-hashicorp-terraform-0-13
28-
minimumTerraformVersion = func() *version.Version {
29-
v, err := version.NewSemver("0.13.0")
30-
if err != nil {
31-
panic(err)
32-
}
33-
return v
34-
}()
35-
)
19+
// This is the exact version of Terraform used internally
20+
// when Terraform is missing on the system.
21+
terraformVersion = version.Must(version.NewVersion("1.2.1"))
22+
23+
minTerraformVersion = version.Must(version.NewVersion("1.1.0"))
24+
maxTerraformVersion = version.Must(version.NewVersion("1.2.1"))
3625

37-
var terraformMinorVersionMismatch = xerrors.New("Terraform binary minor version mismatch.")
26+
terraformMinorVersionMismatch = xerrors.New("Terraform binary minor version mismatch.")
27+
)
3828

3929
type ServeOptions struct {
4030
*provisionersdk.ServeOptions

0 commit comments

Comments
 (0)