Skip to content

Backport of Fix panics due to missing graph edges on empty modules or invalid refs into v1.8#34994

Merged
liamcervante merged 1 commit intov1.8from
backport/liamcervante/34976/frankly-assuring-boxer
Apr 15, 2024
Merged

Backport of Fix panics due to missing graph edges on empty modules or invalid refs into v1.8#34994
liamcervante merged 1 commit intov1.8from
backport/liamcervante/34976/frankly-assuring-boxer

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 15, 2024

Backport

This PR is auto-generated from #34985 to be assessed for backporting due to the inclusion of the label 1.8-backport.

The below text is copied from the body of the original PR.


This PR fixes two crashes within Terraform v1.8.0. In both cases a module expansion was being missed, and then crashing when something tried to reference the missed module.

The first occurs when referencing an output that doesn't exist within the try() function. In this case the executing node was not getting connected to the module expansion node because the output node to connect doesn't exist. Now, the transform_reference transformer will unfold module call output references into simple module call references if the target node for a module call output does not exist.

The second occurs when referencing a module block directly (ie. not a module output), on a module that has no changes during the apply. The module expansion node was being removed as it had no direct references (as no changes from within the module). Now, the module expansion node implements the referenceable interface, and we'll connect nodes that reference the module directly both to the expansion node and the closer node. This will ensure the expansion of a module happens before anything that references it is processed.

Fixes #34976

Target Release

1.8.1

Draft CHANGELOG entry

BUG FIXES

  • Fix crash in terraform plan when referencing a module output that does not exist within the try(...) function.
  • Fix crash in terraform apply when referencing a module with no planned changes.

Overview of commits

@ghost ghost force-pushed the backport/liamcervante/34976/frankly-assuring-boxer branch from de74720 to a1b483b Compare April 15, 2024 08:28
@ghost ghost assigned liamcervante Apr 15, 2024
@ghost ghost requested a review from liamcervante April 15, 2024 08:28
@liamcervante liamcervante merged commit 6226567 into v1.8 Apr 15, 2024
@liamcervante liamcervante deleted the backport/liamcervante/34976/frankly-assuring-boxer branch April 15, 2024 08:43
@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 May 17, 2024
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.

1 participant