feat: plumb user secrets through provisioner chain to terraform#24542
Open
feat: plumb user secrets through provisioner chain to terraform#24542
Conversation
b7bc9ed to
e457dc3
Compare
6fad51d to
01ca924
Compare
Passes user secrets from coderd to the Terraform process at workspace build time so the `data.coder_secret` data source in terraform-provider-coder can resolve values at plan time. Secrets traverse two proto hops: `provisionerdserver` fetches them via `ListUserSecretsWithValues`, attaches them to `AcquiredJob.WorkspaceBuild.user_secrets` on `provisionerd.proto`; `runner.go` forwards into `PlanRequest.user_secrets` on `provisioner.proto`; the Terraform provisioner encodes each as `CODER_SECRET_ENV_<name>` or `CODER_SECRET_FILE_<hex(path)>` before invoking `terraform plan`. Only plan requests carry secrets; apply runs with `nil` because values are baked into plan state. Fetch is gated on `WorkspaceTransitionStart`: stop and delete transitions never carry secrets, so revoking or deleting a stored secret cannot make a workspace unstoppable. DB errors on the fetch fail the job outright rather than silently continuing with an empty secret set.
01ca924 to
a8372f7
Compare
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.
Passes user secrets from coderd to the Terraform process at workspace build time so the
data.coder_secretdata source in terraform-provider-coder can resolve values at plan time.Secrets traverse two proto hops:
provisionerdserverfetches them viaListUserSecretsWithValues, attaches them toAcquiredJob.WorkspaceBuild.user_secretsonprovisionerd.proto;runner.goforwards intoPlanRequest.user_secretsonprovisioner.proto; the Terraform provisioner encodes each asCODER_SECRET_ENV_<name>orCODER_SECRET_FILE_<hex(path)>before invokingterraform plan. Only plan requests carry secrets; apply runs withnilbecause values are baked into plan state.Fetch is gated on a workspace transitioning to start. stop and delete transitions never carry secrets, so revoking or deleting a stored secret cannot make a workspace unstoppable. DB errors on the fetch fail the job outright rather than silently continuing with an empty secret set.
Corresponding terraform-provider-coder change: coder/terraform-provider-coder#501