Skip to content

Conversation

@jbardin
Copy link
Member

@jbardin jbardin commented Dec 10, 2025

Add ability to forward PlannedPrivate data between plans

Terraform providers sometimes want to be able to plan a computed field which may not be deterministically generated. For example, a random GUID could be generated during plan, making the overall Terraform plan more precise, but there is currently no way to carry that planned value forward to apply.

The problem is that there are always two entirely independent plans for every resource change. Terraform compares these two plans for consistency, so a provider may not return a different computed value, but there is no way for the provider to see what the prior planned value was. This means that a planned value which is not reproducible from the given inputs is not plan-able at all.

This PR allows Terraform to take the private data from the first plan, which is usually discarded, and send it along in the second plan request. The provider can then use that data to recreate any previously planned values, either because they are stored directly, or contain enough seed data to recreate the same result.

We require a new client capability flag for this as well. The server needs to know whether it can rely on the planned private data being returned before it can create a plan depending on that behaviour, so the client must advertise that it intends to do so n the initial request.

@jbardin jbardin added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Dec 17, 2025
Terraform providers sometimes want to be able to plan a computed field
which may not be deterministically generated. For example, a random GUID
could be generated during plan, making the overall Terraform plan more
precise, but there is currently no way to carry that planned value
forward to apply.

The problem is that there are always two entirely independent plans for
every resource change. Terraform compares these two plans for
consistency, so a provider may not return a different computed value,
but there is no way for the provider to see what the prior planned value
was. This means that a planned value which is not reproducible from the
given inputs is not plan-able at all.

This PR allows Terraform to take the private data from the first plan,
which is usually discarded, and send it along in the second plan
request. The provider can then use that data to recreate any previously
planned values, either because they are stored directly, or contain
enough seed data to recreate the same result.
@jbardin jbardin force-pushed the jbardin/planned-private-for-random branch from c6b95a0 to be0317a Compare December 17, 2025 16:32
@jbardin jbardin requested a review from austinvalle December 17, 2025 16:32
@jbardin jbardin removed the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant