Skip to content

EPIC: Destroy Command Implementation #8

@josecelano

Description

@josecelano

Epic Type: Parent Epic (Coordinates Task 1.2)
Status: Planning
Related Roadmap: Section 1.2
Parent Issue: #2 (Scaffolding for main app)
Roadmap Section: 1.2 - Create command torrust-tracker-deployer destroy


📋 Epic Overview

This EPIC coordinates the implementation of the destroy command through two sequential phases following Domain-Driven Design (DDD) principles.

The destroy command will provide comprehensive infrastructure teardown capabilities, enabling users to cleanly remove deployed environments and their associated resources.

🎯 Goals

  1. Phase 1: Implement core destroy functionality in DDD Application Layer
  2. Phase 2: Add user-facing CLI interface with proper UX
  3. Ensure complete infrastructure cleanup (OpenTofu, Ansible, state files)
  4. Maintain separation between application logic and UI concerns
  5. Provide comprehensive E2E testing and documentation

🏗️ Implementation Strategy

This follows an inside-outside approach:

  • Phase 1 (App Layer): Build and test core business logic first
  • Phase 2 (UI Layer): Add CLI interface after core functionality is solid

This approach ensures we can validate the destroy functionality with E2E tests before exposing it to users through the CLI.

📦 Child EPICs

1. App Layer Destroy Command

Document: 9-epic-app-layer-destroy-command.md
Status: Not Started
Focus: Core destroy functionality in DDD Application Layer

Implements the essential destroy command logic including:

  • DestroyCommand implementation
  • Infrastructure teardown (OpenTofu, Ansible)
  • State file and build directory cleanup
  • E2E test integration
  • Error handling and recovery

2. UI Layer Destroy Command

Document: 10-epic-ui-layer-destroy-command.md
Status: Not Started
Dependencies: Child Epic #9 must be completed first

Implements the user-facing CLI interface, including:

  • CLI command structure refactoring
  • Subcommand implementation
  • User-friendly progress messages
  • UserOutput type and verbosity scaffolding
  • Comprehensive user documentation

🔄 Workflow

The EPICs must be completed sequentially:

  1. After Epic EPIC: App Layer Destroy Command #9: Developers can use destroy command in code and tests
  2. After Epic EPIC: UI Layer Destroy Command #10: End users can use destroy command from CLI

🧪 Testing Strategy

  • Unit Tests: Command logic, error handling
  • Integration Tests: OpenTofu and Ansible integration
  • E2E Tests: Full deployment lifecycle testing
    • Local VM testing with real infrastructure
    • CI integration for regression prevention
    • Container testing (where applicable)

📋 Acceptance Criteria

  • Both child EPICs completed successfully
  • All E2E tests pass with destroy functionality
  • Infrastructure cleanup is reliable and complete
  • User documentation is comprehensive
  • Code follows project conventions and passes all linters
  • Parent issue Scaffolding for main app #2 task 1.2 is marked complete

🔗 Dependencies

  • Parent: Scaffolding for main app #2 (Scaffolding for main app)
  • Relationship: Implements roadmap task 1.2
  • Scope: Adds destroy functionality to existing provision-focused architecture

📊 Child Epic Issues

🚀 Success Criteria

  • Developers can use destroy command programmatically
  • End users can destroy environments via CLI
  • Infrastructure cleanup is complete and reliable
  • E2E tests prevent regressions
  • Documentation supports users and developers

Implementation Notes

Note: Issue #2 contains the scaffolding foundation that this destroy command builds upon. Complete issue #2 before proceeding.

Next Steps: Create GitHub issues for both child EPICs and link them to parent issue #2


Epic Document: docs/issues/8-epic-destroy-command.md

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions