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

Upgrade hcl to fix crash with optional attributes #31847

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

alisdair
Copy link
Contributor

@alisdair alisdair commented Sep 22, 2022

Include the changes to HCL proposed in hashicorp/hcl#555. Includes a context test which crashes before this HCL upgrade.

Fixes #31844

Target Release

1.3.1

Draft CHANGELOG entry

BUG FIXES

  • Fixed a crash when using objects with optional attributes and default values in collections, most visible with nested modules.

@alisdair alisdair added the 1.3-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Sep 22, 2022
@alisdair alisdair requested a review from a team September 22, 2022 15:24
@alisdair alisdair self-assigned this Sep 22, 2022
@alisdair alisdair force-pushed the alisdair/pre-convert-optional-defaults branch from e24f2a3 to 3c36a75 Compare September 23, 2022 14:32
Also add regression test coverage of the crash. This would occur when
objects with optional attributes had default values of different type
from the attribute type, and the objects were members of a collection.

For example:

list(object({
  a = optional(set(string), [])
}))

If this type constraint is applied to a variable value where one object
has a set(string) value for a, and the other object applies the empty
tuple default, Terraform would crash.
@alisdair alisdair force-pushed the alisdair/pre-convert-optional-defaults branch from 3c36a75 to 10ae444 Compare September 23, 2022 14:34
@alisdair alisdair marked this pull request as ready for review September 23, 2022 14:41
@alisdair alisdair added this to the v1.3.1 milestone Sep 23, 2022
@alisdair alisdair merged commit 6448d7b into main Sep 23, 2022
@alisdair alisdair deleted the alisdair/pre-convert-optional-defaults branch September 23, 2022 16:47
@github-actions
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@github-actions
Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.3-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"panic: inconsistent list element types" when using optional object attributes across multiple modules
2 participants