core: Report reason for deferring data read until apply#30971
core: Report reason for deferring data read until apply#30971apparentlymart merged 1 commit intomainfrom
Conversation
We have two different reasons why a data resource might be read only during apply, rather than during planning as usual: the configuration contains unknown values, or the data resource as a whole depends on a managed resource which itself has a change pending. However, we didn't previously distinguish these two in a way that allowed the UI to describe the difference, and so we confusingly reported both as "config refers to values not yet known", which in turn led to a number of reasonable questions about why Terraform was claiming that but then immediately below showing the configuration entirely known. Now we'll use our existing "ActionReason" mechanism to tell the UI layer which of the two reasons applies to a particular data resource instance. The "dependency pending" situation tends to happen in conjunction with "config unknown", so we'll prefer to refer that the configuration is unknown if both are true.
|
Since this is essentially a minor UI change, and may merge poorly due to proto/stringer changes, perhaps we should backport this to v1.2 before the rc? |
|
I'm going to hold on backporting this into v1.2 for the moment because rc1 already happened and so we're currently in a freeze period. However, we can consider backporting this into the v1.2 branch manually later if it proves useful to do so; I don't have any particular objection to doing so. |
|
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
|
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. |
We have two different reasons why a data resource might be read only during apply, rather than during planning as usual: the configuration contains unknown values, or the data resource as a whole depends on a managed resource which itself has a change pending.
However, we didn't previously distinguish these two in a way that allowed the UI to describe the difference, and so we confusingly reported both as "config refers to values not yet known", which in turn led to a number of reasonable questions about why Terraform was claiming that but then immediately below showing the configuration entirely known.
Now we'll use our existing
ActionReasonmechanism to tell the UI layer which of the two reasons applies to a particular data resource instance. The "dependency pending" situation tends to happen in conjunction with "config unknown", so we'll prefer to refer that the configuration is unknown if both are true.The plan hint for the config-unknown case remains unchanged:
For the "dependencies pending" case there is now a new parenthetical hint:
I had originally hoped to include one or more of the specific resources that the data resource depends on as part of this output, but that isn't possible at the moment because we don't currently preserve dependency information directly inside the plan; instead, during the apply phase we reconstruct the dependency graph from the source material.