Skip to content

evaluate: return diagnostics instead of unknown for uninitialised locals and resources#37663

Merged
liamcervante merged 3 commits intomainfrom
liamcervante/diagnostic-not-unknown
Sep 24, 2025
Merged

evaluate: return diagnostics instead of unknown for uninitialised locals and resources#37663
liamcervante merged 3 commits intomainfrom
liamcervante/diagnostic-not-unknown

Conversation

@liamcervante
Copy link
Copy Markdown
Contributor

This PR updates the behaviour for resources and locals, so that when referenced out of order they return explicit diagnostics stating this instead of simple unknown values.

Fixes #

Target Release

1.14.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@liamcervante liamcervante requested a review from a team as a code owner September 24, 2025 09:05
@liamcervante liamcervante added the 1.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Sep 24, 2025
@liamcervante liamcervante force-pushed the liamcervante/diagnostic-not-unknown branch from f82c603 to ec6bf50 Compare September 24, 2025 09:37
@jbardin
Copy link
Copy Markdown
Member

jbardin commented Sep 24, 2025

Oh, I thought I has another PR to review too. What's here looks good, but did we want to also include GetResource? https://github.com/hashicorp/terraform/blob/main/internal/terraform/evaluate.go#L547

@liamcervante
Copy link
Copy Markdown
Contributor Author

@jbardin
Copy link
Copy Markdown
Member

jbardin commented Sep 24, 2025

sorry, the GH diff was rendering differently than I was used to, and I didn't see that as under GetResource. LGTM!

@liamcervante liamcervante merged commit 1e41449 into main Sep 24, 2025
7 checks passed
@liamcervante liamcervante deleted the liamcervante/diagnostic-not-unknown branch September 24, 2025 14:27
@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 Oct 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.14-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.

2 participants