Repository navigation
feat: add a read-only Terraform provider prototype - #489
Open
cons-tan-tan wants to merge 2 commits into
Open
cons-tan-tan wants to merge 2 commits into
cons-tan-tan wants to merge 2 commits into
Conversation
Expose read-only and no-files options through the strict native call format so older libraries reject restrictions before resolution. Refuse generation that requires storage before invoking generators, and keep hidden dependency names out of scoped refusal diagnostics.
Resolve existing manifests as secretspec_secrets ephemeral resources or data sources, returning a sensitive map for the selected profile/scope. Enable SDK read-only and no-files restrictions for every lookup. Document the state persistence tradeoff and local development setup, and run Terraform acceptance tests in the SDK CI job.
domenkozar
reviewed
Oct 16, 2026
| if !m.Reason.IsNull() { | ||
| builder.WithReason(m.Reason.ValueString()) | ||
| } | ||
| resolved, err := builder.Load() |
Member
There was a problem hiding this comment.
The ctx.Err() check above only handles cancellation before resolution starts. builder.Load() does not receive the context, so if Terraform requests cancellation while a backend read or an allowed non-persisting command generator is running, that work continues and this RPC remains blocked until the native call returns. A hanging command can therefore prevent a graceful stop of plan/apply.
Could we propagate cancellation through the Go SDK/native resolver to backend operations and child processes, and add a test that cancels an in-flight resolution? Returning early from a Go goroutine alone would leave the native work running.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This prototype adds a Terraform provider that reads an existing
secretspec.tomlthrough the Go SDK and Rust resolver. Terraform configurations can reuse the manifest's storage configuration, profiles, scopes and derived values.SecretSpec can generate and save missing values during resolution, including reads triggered by
terraform plan. This provider refuses resolution that requires saving a generated or prompted value, while allowing existing values to be read.secretspec_secretsas an ephemeral resource and a data source. Both acceptpath, optionalprofile,scopeandreason, and return a sensitivevaluesmap.WithReadOnlyandWithNoFilesin the Go SDK through strict native requests. Older libraries reject restricted requests before resolution. The provider enables both options; the Rust resolver rejectsas_pathdeclarations, including hidden dependencies, before fetching values.serve --read-only; generation without provider storage remains allowed.Related to #233. This implements the read side of the SDK-backed provider prototype discussed in the comments. The AWS publication/naming module and broader coexistence guide are outside the scope of this PR.
Testing
Local plan/apply tests passed on Linux with Terraform 1.10.5 and 1.16.1, covering sensitive output, ephemeral omission from saved plans/state, data-source persistence and unchanged stores after refusal. Tests use temporary dotenv stores; live AWS backends were not exercised.
A legacy-ABI shim also confirmed that restricted calls never invoke the legacy resolver, while unrestricted calls still work.