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

ext/typeexpr: Convert defaults for optional attrs #555

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

alisdair
Copy link
Contributor

When parsing optional object attribute defaults, we previously verified that the default value was convertible to the attribute type. However, we did not keep this converted value.

This commit uses the converted default value, rather than delaying conversion until later. In turn this prevents crashes when transforming collections which contain objects with optional attributes, caused by incompatible object types at the time of defaults application.

Fixes downstream issue hashicorp/terraform#31844

When parsing optional object attribute defaults, we previously verified
that the default value was convertible to the attribute type. However,
we did not keep this converted value.

This commit uses the converted default value, rather than delaying
conversion until later. In turn this prevents crashes when transforming
collections which contain objects with optional attributes, caused by
incompatible object types at the time of defaults application.
Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

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

This makes sense to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants