Skip to content

Undelete Functionality for Terraform Modules/States

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Implement Undelete Functionality for Terraform Modules and States

Overview

Currently, when Terraform modules or states are accidentally deleted, the restoration process is manual and painful. We need to implement a simple "undelete" or recovery feature to restore these deleted resources when needed.

Problem Statement

Customers report that accidental deletion of Terraform modules or states creates significant disruption to their workflows. The current restoration process requires manual intervention, which is time-consuming and error-prone.

User Stories

  • As a DevOps engineer, I want to be able to recover accidentally deleted Terraform modules so that I don't lose important infrastructure code.
  • As a project manager, I want to restore Terraform states that were mistakenly removed so that teams can continue working without rebuilding state files.
  • As an administrator, I want to set retention policies for deleted Terraform resources so that I can balance recovery capabilities with storage constraints.

Requirements

Functional Requirements

  • Implement a "recycle bin" concept for Terraform modules and states
  • Provide a UI for viewing and restoring deleted items
  • Allow restoration of individual modules/states or multiple items at once
  • Display metadata for deleted items (deletion date, original location, size)
  • Support restoration to original location or alternative location
  • Implement configurable retention periods (default: 30 days)

Non-Functional Requirements

  • Restoration process should complete within 60 seconds for typical module/state sizes
  • Storage overhead for deleted items should be monitored and reported
  • All deletion and restoration actions should be logged for audit purposes
  • Access controls should apply to restoration capabilities (same permissions as create)

Technical Considerations

  • Consider implementing soft deletion first (marking as deleted without physical removal)
  • Evaluate storage requirements for maintaining deleted resources
  • Ensure state integrity is maintained during the restoration process
  • Handle potential name conflicts during restoration
  • Consider database schema changes needed to track deletion status

Success Criteria

  • Users can successfully restore deleted Terraform modules and states through the UI
  • Restored modules/states function identically to their pre-deletion state
  • Administrators can configure retention policies
  • All restoration actions are properly logged and auditable
Edited by 🤖 GitLab Bot 🤖