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

don't error on eval of missing instances #35895

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Oct 23, 2024

While in most cases a missing instance during evaluation would be a bug in terraform, the insertion of postconditions into instance planning has created a situation where not all instances will be available when GetResource is called. We do have a special context for evaluating self alone, but postconditions also need to have the module context available too.

We may be able to come up with some other way to create an evaluation context which handles self more selectively, but that looks like a large change for a situation which should not otherwise happen. If this were to mask a legitimate error, the fact that an unexpected DynamicVal were encountered will raise the problem again, and we can correlate that with the logged warning.

Fixes #34310

While in most cases a missing instance during evaluation would be a bug
in terraform, the insertion of postconditions into instance planning has
created a situation where not all instances will be available when
GetResource is called. We do have a special context for evaluating self
alone, but postconditions also need to have the module context available
too.

We may be able to come up with some other way to create an evaluation
context which handles self more selectively, but that looks like a large
change for a situation which should not otherwise happen. If this were
to mask a legitimate error, the fact that an unexpected DyanamicVal were
encountered will raise the problem again, and we can correlate that with
the logged warning.
@jbardin jbardin merged commit 0b1dfe2 into main Oct 24, 2024
6 checks passed
@jbardin jbardin deleted the jbardin/eval-self-postcondition branch October 24, 2024 13:02
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 Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants