dcg

Pulumi

infrastructure.pulumi

Protects against destructive Pulumi operations like destroy and up with -y (auto-approve)

  • 6blocking rules
  • 9safe patterns
  • 1Critical
  • 4High
  • 1Medium
~/.config/dcg/config.toml
[packs]
enabled = ["infrastructure.pulumi"]

Evaluated when a command contains pulumi, destroy, state.

Blocking rules

Each rule ID is infrastructure.pulumi:<name>. Use it in allowlists and [policy.rules].

  1. destroy

    Critical

    pulumi destroy removes ALL managed infrastructure. Use 'pulumi preview --diff' first.

    Explanation
    pulumi destroy removes ALL managed infrastructure: - Every resource in your stack is destroyed - Cloud resources (VMs, databases, networks) deleted - Cannot be undone without backups/recreation - Use --target to destroy specific resources only Preview first: pulumi preview --diff
  2. cancel

    High

    pulumi cancel terminates an in-progress update, which may leave resources in inconsistent state.

    Explanation
    pulumi cancel stops in-progress operations: - Terminates currently running update/destroy - Resources may be left in inconsistent state - Some resources created, others not - May require manual cleanup Use only when operation is stuck/hung
  3. stack-rm

    High

    pulumi stack rm removes the stack. Use --force only if stack is empty.

    Explanation
    pulumi stack rm removes the entire stack: - Stack and its state deleted - Does NOT destroy actual infrastructure (unless empty) - --force required if resources still exist - Resources become unmanaged (orphaned) Destroy resources first: pulumi destroy, then rm stack
  4. state-delete

    High

    pulumi state delete removes resource from state without destroying it.

    Explanation
    pulumi state delete orphans resources: - Resource removed from Pulumi state - Actual cloud resource still exists - Resource becomes 'unmanaged' (Pulumi ignores it) - May cause drift between state and reality Consider: pulumi refresh to sync state with reality
  5. up-yes

    High

    pulumi up -y skips confirmation. Remove -y flag for safety.

    Explanation
    pulumi up -y skips confirmation: - No opportunity to review changes before applying - Intended for CI/CD, not interactive use - Changes may destroy or recreate resources - Replacements can cause downtime For safety: remove -y and review the preview
  6. refresh-yes

    Medium

    pulumi refresh -y auto-approves state changes. Review changes first.

    Explanation
    pulumi refresh -y auto-approves state sync: - Syncs Pulumi state with actual cloud resources - May delete resources from state if not found - May update state with drift from cloud Run without -y first to review detected changes

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • pulumi-preview
  • pulumi-stack-ls
  • pulumi-stack-select
  • pulumi-stack-init
  • pulumi-config
  • pulumi-whoami
  • pulumi-version
  • pulumi-about
  • pulumi-logs