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

Issue 26320 - lookup(): only treat map as unknown if it is wholly unknown #26427

Conversation

OwenTuz
Copy link
Contributor

@OwenTuz OwenTuz commented Sep 30, 2020

Fix for issue #26320 - this allows us to derive known values from partially known maps where we can, and may prevent unnecessary destroy/rebuild cycles during apply in some cases.

Based on @apparentlymart 's suggestions in the issue thread.

Most of this PR is changes to primary_test.go and automation_test.go as I have added a very basic regression test to the primary workflow. Happy to change or adjust this if you feel it would be cleaner/preferable to have a separate HCL file and test set for this.

@pselle pselle requested a review from a team September 30, 2020 21:52
Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

Hi @OwenTuz ! Thank you for working on this.

I really appreciate you adding test coverage, so please don't take this as criticism, just a request:
I would prefer to see test coverage in the lookup tests rather than the e2e tests - the e2e tests are primarily focused on the workflow and generally only run in circleCI, whereas the unit tests are something one can run locally and quickly.

Here's a test case that you could add to the lookup tests (in collection_test.go) which fails today and passes with your change:

{
	[]cty.Value{
		mapWithUnknowns,
		cty.StringVal("foo"),
	},
	cty.StringVal("bar"),
	false,
},

Thank you so much for submitting on this!

@OwenTuz
Copy link
Contributor Author

OwenTuz commented Oct 1, 2020 via email

Fix for issue hashicorp#26320 - this allows us to derive known values from
partially known maps where we can, and may prevent unnecessary
destroy/rebuild cycles during apply in some cases.
@OwenTuz OwenTuz force-pushed the issue-26320-prevent-some-resources-incorrectly-being-labelled-unknown branch from 04cbaeb to 28cb0ab Compare October 2, 2020 09:14
@codecov
Copy link

codecov bot commented Oct 2, 2020

Codecov Report

Merging #26427 into master will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted Files Coverage Δ
lang/funcs/collection.go 77.61% <0.00%> (-0.75%) ⬇️
dag/marshal.go 53.42% <0.00%> (-1.37%) ⬇️
terraform/evaluate.go 50.11% <0.00%> (-0.46%) ⬇️

@OwenTuz OwenTuz requested a review from mildwonkey October 2, 2020 09:23
Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

🎉 Thank you @OwenTuz , this looks great!

@mildwonkey mildwonkey merged commit bb39faf into hashicorp:master Oct 5, 2020
@mildwonkey
Copy link
Contributor

This is merged and the fix will be in Terraform v0.14 🎉

@ghost
Copy link

ghost commented Nov 5, 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 5, 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