mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove coder_secret Terraform integration (#25512)
Removes the coder_secret Terraform integration: the data.coder_secret consumption path through provisionerdserver → provisioner.proto → provisioner/terraform, the dynamic-parameter secret-requirement validation, and the workspace-update / resolve-autostart surfaces that depended on it. This is being done due to a product/feature direction change (see PLAT-243). User-secret CRUD (DB, REST, CLI, UI, telemetry, audit) and the agent-manifest secret-injection path are untouched. The provisionerd API is bumped from v1.17 to v1.18 rather than rolled back: v1.17 shipped in v2.33.x, so user_secrets field numbers are reserved and the changelog documents both versions. Generated with assistance from Coder Agents.
This commit is contained in:
@@ -10,13 +10,11 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"cdr.dev/slog/v3"
|
||||
"github.com/coder/coder/v2/coderd/audit"
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/db2sdk"
|
||||
"github.com/coder/coder/v2/coderd/httpapi"
|
||||
"github.com/coder/coder/v2/coderd/httpmw"
|
||||
"github.com/coder/coder/v2/coderd/usersecretspubsub"
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
)
|
||||
|
||||
@@ -84,14 +82,6 @@ func (api *API) postUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
aReq.New = secret
|
||||
|
||||
api.publishUserSecretEvent(ctx, usersecretspubsub.Event{
|
||||
Kind: usersecretspubsub.EventKindCreated,
|
||||
UserID: secret.UserID,
|
||||
Name: secret.Name,
|
||||
EnvName: secret.EnvName,
|
||||
FilePath: secret.FilePath,
|
||||
})
|
||||
|
||||
httpapi.Write(ctx, rw, http.StatusCreated, db2sdk.UserSecretFromFull(secret))
|
||||
}
|
||||
|
||||
@@ -263,14 +253,6 @@ func (api *API) patchUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
api.publishUserSecretEvent(ctx, usersecretspubsub.Event{
|
||||
Kind: usersecretspubsub.EventKindUpdated,
|
||||
UserID: secret.UserID,
|
||||
Name: secret.Name,
|
||||
EnvName: secret.EnvName,
|
||||
FilePath: secret.FilePath,
|
||||
})
|
||||
|
||||
httpapi.Write(ctx, rw, http.StatusOK, db2sdk.UserSecretFromFull(secret))
|
||||
}
|
||||
|
||||
@@ -314,12 +296,6 @@ func (api *API) deleteUserSecret(rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
aReq.Old = deleted
|
||||
|
||||
api.publishUserSecretEvent(ctx, usersecretspubsub.Event{
|
||||
Kind: usersecretspubsub.EventKindDeleted,
|
||||
UserID: user.ID,
|
||||
Name: name,
|
||||
})
|
||||
|
||||
rw.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
@@ -391,14 +367,3 @@ func userSecretConflictValidationErrors(err error) []codersdk.ValidationError {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (api *API) publishUserSecretEvent(ctx context.Context, event usersecretspubsub.Event) {
|
||||
if err := usersecretspubsub.Publish(api.Pubsub, event); err != nil {
|
||||
api.Logger.Warn(ctx, "failed to publish user secret event",
|
||||
slog.F("user_id", event.UserID),
|
||||
slog.F("secret_name", event.Name),
|
||||
slog.F("event_kind", event.Kind),
|
||||
slog.Error(err),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user