hashicorp / hashicorp/go-version

Pessimistic operator is including the ceiling

Open
#55 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
165
Avg merge
23h 42m
Merged PRs (30d)
2

Description

The pessimistic constraint operator behavior seems to have changed from:

```
"~> 0.11" == ">= 0.11, < 0.12"

to

"~> 0.11" == ">= 0.11, <= 0.12"
```

☝️ this is problematic and an undocumented (as far as i can tell) breaking change.

---

## 0.12 Implicit (with pessimistic operator)

```
→ tf version
Terraform v0.12.0

→ cat main.tf
terraform {
required_version = "~> 0.11"
}

output "foo" {
value = "we shouldn't see this when using terraform 0.12.0"
}

→ tf init

Initializing the backend...

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

/tmp/main
→ tf apply

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

foo = we shouldn't see this when using terraform 0.12.0
```

## 0.12 Explicit (without pessimistic operator)

```
→ cat main.tf
terraform {
required_version = ">= 0.11, < 0.12"
}

output "foo" {
value = "we shouldn't see this when using terraform 0.12.0"
}

→ tf init

Error: Unsupported Terraform Core version

This configuration does not support Terraform version 0.12.0. To proceed,
either choose another supported Terraform version or update the root module's
version constraint. Version constraints are normally set for good reason, so
updating the constraint may lead to other errors or unexpected behavior.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.