Skip to content

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

Merged
liamcervante merged 1 commit intomainfrom
liamcervante/34562
Jan 24, 2024
Merged

mocking overrides: default to concrete empty object when values are missing#34563
liamcervante merged 1 commit intomainfrom
liamcervante/34562

Conversation

@liamcervante
Copy link
Copy Markdown
Contributor

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 requested a review from a team January 24, 2024 10:52
@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
@liamcervante liamcervante deleted the liamcervante/34562 branch January 24, 2024 11:40
@github-actions
Copy link
Copy Markdown
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
Copy Markdown
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