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

Handle unknown values in ephemeral resource config #35958

Merged
merged 4 commits into from
Nov 7, 2024

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Nov 6, 2024

If an ephemeral resource configuration contains any unknown values, that resource cannot be opened with the provider. This works in the same way as a data source, in that a placeholder is created by Terraform for evaluation, taking the configuration values and inserting unknown values for any computed attributes.

We also add a UI hook for ephemeral resources which can't be read due to unknown values:

  ephemeral.random_password.example: Configuration unknown, deferring...

This is a stopgap to give users some feedback when an ephemeral resource can't be opened, since there is no artifact in the plan which could otherwise be inspected. While the results could generally be inferred, hopefully this helps users more easily figure out what may be happening if they are seeing unexpected results.

There is no json hook implementation so that the machine-readable spec is not bound to the new output until further review. It doesn't really fit with the current json ui model to have messages about what isn't going to happen, so we can determine if that is necessary later.

Ephemeral resources can't be opened if the configuration contains
unknown values.
An Ephemeral resource should not be opened at all if there are any
unknowns in the configuration.
This is a stopgap to give users some feedback when an ephemeral resource
contains unknowns and cannot be opened.

There is no json hook implementation so that the machine-readable spec
is not bound to the new output until further review. It doesn't really
fit with the current json ui model to have messages about what isn't
going to happen.
@jbardin jbardin added the 1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Nov 6, 2024
@jbardin jbardin requested a review from a team November 6, 2024 19:09
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I would also consider documenting the depends_on behaviours/side-effects when ephemeral resources are involved somewhere since we had two provider teams independently being confused by that and I am not entirely sure this change will completely avoid that confusion, although it should reduce it.

internal/terraform/context_plan_ephemeral_test.go Outdated Show resolved Hide resolved
Co-authored-by: Radek Simko <radeksimko@users.noreply.github.com>
@jbardin
Copy link
Member Author

jbardin commented Nov 7, 2024

I'm not sure what to document yet, if anything, for depends_on, since it's working in the way which is already documented. The instances we've seen seemed to be caused by attributing extra behaviors to depends_on which don't exist, but documenting all possibilities that are not part of a feature can't be comprehensive, and doesn't lead to very useful documentation.

@jbardin jbardin merged commit 896f9e7 into main Nov 7, 2024
5 of 6 checks passed
@jbardin jbardin deleted the jbardin/uknown-ephemeral-config branch November 7, 2024 13:24
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link
Contributor

github-actions bot commented Dec 8, 2024

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 Dec 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.10-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