Skip to content

Add --dry-run to secrets set/delete to preview changes before applying #331

Description

@wankhede04

Problem

infisical secrets set and infisical secrets delete apply changes to the backend immediately — there's no way to preview exactly what will be created, updated, or deleted first. This matters most in CI/scripted secret-rotation pipelines, where a preview step (à la terraform plan) is a standard safety net before mutating state.

Proposal

Add a --dry-run flag to infisical secrets set and infisical secrets delete (and optionally folders create/folders delete) that:

  • Computes the exact set of operations that would be performed (create / update / delete, with masked values) using the existing logic that already separates "compute operations" from "execute + print" in packages/cmd/secrets.go.
  • Prints the same table/JSON output the real run would produce, but skips the actual SetRawSecrets/CallDeleteSecretsRawV3 API call.
  • Exits 0 without mutating anything.

Scope

Since secrets.go already builds a secretOperations-style list before calling the API and before printing results, this should be a small, additive change: gate the actual API call behind if !dryRun, and note in the output that it was a dry run. No changes needed to the API client or other commands. Happy to open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions