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

mocking overrides: default to concrete empty object when values are missing #34563

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

liamcervante
Copy link
Member

When the values or outputs attribute was missing from the override_* blocks in the new mocking framework, we were setting the value to be cty.NilVal. This was then causing a crash later in the processing when Terraform was assuming the values in these attributes was an object.

From the perspective of the mocking framework a nil or empty value is the same, in both cases it should just generate the values required. This PR updates the config parsing so that it just sets the value to be an object always using cty.EmptyObjectValue if the attribute isn't specified. It also updates the Terraform graph where this is read so that it can safely handle a cty.NilVal anyway.

We also add in a quick bit of validation, that makes sure the config specifies the attributes as an object, if it is specified.

Fixes #34562

Target Release

1.7.1

Draft CHANGELOG entry

BUG FIXES

  • terraform test: Fix crash when override_module block was missing the outputs attribute.

@liamcervante liamcervante added the 1.7-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Jan 24, 2024
@liamcervante liamcervante merged commit 9658f9d into main Jan 24, 2024
6 checks passed
@liamcervante liamcervante deleted the liamcervante/34562 branch January 24, 2024 11:40
Copy link
Contributor

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

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 Feb 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.7-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.

Terraform test crashes if you dont specify outputs for override_module
2 participants