Skip to content
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

internal: Suppress duplicate version constraints #26705

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

alisdair
Copy link
Contributor

Backport of #26678 to v0.14

A set of version constraints can contain duplicates. This can happen if
multiple identical constraints are specified throughout a configuration.

When rendering the set, it is confusing to display redundant
constraints. This commit changes the string renderer to only show the
first instance of a given constraint, and adds unit tests for this
function to cover this change.

This also fixes a bug with the locks file generation: previously, a
configuration with redundant constraints would result in this error on
second init:

Error: Invalid provider version constraints

  on .terraform.lock.hcl line 6:
  (source code not available)

The recorded version constraints for provider
registry.terraform.io/hashicorp/random must be written in normalized form:
"3.0.0".
@alisdair alisdair requested a review from a team October 26, 2020 15:29
@codecov
Copy link

codecov bot commented Oct 26, 2020

Codecov Report

Merging #26705 into v0.14 will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
internal/getproviders/types.go 66.34% <100.00%> (+29.34%) ⬆️
internal/providercache/dir.go 65.30% <0.00%> (-6.13%) ⬇️
terraform/evaluate.go 52.50% <0.00%> (-0.42%) ⬇️
dag/marshal.go 54.79% <0.00%> (+1.36%) ⬆️

@alisdair alisdair merged commit f6b0779 into v0.14 Oct 26, 2020
@alisdair alisdair deleted the alisdair/suppress-duplicate-version-constraints-014 branch October 26, 2020 15:57
@ghost
Copy link

ghost commented Nov 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants