Skip to content

chore: update terraform to 1.2.1 #3243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions provisioner/terraform/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (

// This is the exact version of Terraform used internally
// when Terraform is missing on the system.
var terraformVersion = version.Must(version.NewVersion("1.1.9"))
var terraformVersion = version.Must(version.NewVersion("1.2.1"))
var minTerraformVersion = version.Must(version.NewVersion("1.1.0"))
var maxTerraformVersion = version.Must(version.NewVersion("1.2.0"))
var maxTerraformVersion = version.Must(version.NewVersion("1.2.1"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the logic in line 70, we are checking that the installed version should be strictly less than the max version. This would throw an error for 1.2.1 and then install 1.2.1 again. The idea behind min and max range was to allow the same minor version. Maybe we can update the range to 1.2.0 <= version < 1.3.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice catch. I don't know about you, but "max" to me implies that the maximum is still allowed.
How about we change the logic on line 70 to

version.LessThan(minTerraformVersion) || version.GreaterThan(maxTerraformVersion)

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can do that!


var (
// The minimum version of Terraform supported by the provisioner.
Expand Down Expand Up @@ -67,7 +67,7 @@ func absoluteBinaryPath(ctx context.Context) (string, error) {
return "", xerrors.Errorf("Terraform binary get version failed: %w", err)
}

if version.LessThan(minTerraformVersion) || version.GreaterThanOrEqual(maxTerraformVersion) {
if version.LessThan(minTerraformVersion) || version.GreaterThan(maxTerraformVersion) {
return "", terraformMinorVersionMismatch
}

Expand Down