@payfit/iac 1.0.3 โ†’ 1.0.4-ephemeral-iac-migration-docs.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/executors/stack-migration/README.md +71 -115
  2. package/dist/executors/stack-migration/lib/migration-tool.d.ts +1 -5
  3. package/dist/executors/stack-migration/lib/migration-tool.js +213 -211
  4. package/dist/executors/stack-migration/lib/migration-tool.js.map +1 -1
  5. package/dist/executors/stack-migration/lib/templates/index.d.ts +1 -0
  6. package/dist/executors/stack-migration/lib/templates/index.js +1 -0
  7. package/dist/executors/stack-migration/lib/templates/index.js.map +1 -1
  8. package/dist/executors/stack-migration/lib/templates/mermaid-diagram.d.ts +13 -0
  9. package/dist/executors/stack-migration/lib/templates/mermaid-diagram.js +46 -0
  10. package/dist/executors/stack-migration/lib/templates/mermaid-diagram.js.map +1 -0
  11. package/dist/executors/stack-migration/lib/templates/message-templates.d.ts +15 -20
  12. package/dist/executors/stack-migration/lib/templates/message-templates.js +34 -93
  13. package/dist/executors/stack-migration/lib/templates/message-templates.js.map +1 -1
  14. package/dist/executors/stack-migration/lib/templates/pr-templates.d.ts +16 -9
  15. package/dist/executors/stack-migration/lib/templates/pr-templates.js +77 -121
  16. package/dist/executors/stack-migration/lib/templates/pr-templates.js.map +1 -1
  17. package/dist/executors/stack-migration/lib/templates/procedure-template.d.ts +1 -0
  18. package/dist/executors/stack-migration/lib/templates/procedure-template.js +37 -118
  19. package/dist/executors/stack-migration/lib/templates/procedure-template.js.map +1 -1
  20. package/dist/executors/stack-migration/schema.d.ts +2 -3
  21. package/dist/executors/stack-migration/schema.json +2 -3
  22. package/dist/executors/stack-migration/stack-migration.js +2 -5
  23. package/dist/executors/stack-migration/stack-migration.js.map +1 -1
  24. package/package.json +1 -1
@@ -1,125 +1,81 @@
1
1
  # Stack Migration Executor
2
2
 
3
- NX executor for migrating Spacelift stacks from centralized iac-deploy to repository-level metastacks.
4
-
5
- ## Overview
6
-
7
- This tool automates the migration of Spacelift stacks to the new metastack architecture. It creates necessary PRs, generates import files, and manages state removal.
8
-
9
- ## Commands
10
-
11
- ### Complete Workflow
12
-
13
- ```bash
14
- # Run the full migration (recommended for first-time users)
15
- nx run <project>:stack-migration --command=run
16
-
17
- # Run in dry-run mode to preview changes
18
- nx run <project>:stack-migration --command=run --dryRun
3
+ Migrate Spacelift stacks from iac-deploy to repository-level metastacks.
4
+
5
+ ## Migration Flow
6
+
7
+ ```mermaid
8
+ flowchart TD
9
+ subgraph Phase1["๐Ÿ“ฆ 1: Setup"]
10
+ A[init] --> B[Create PRs + Scripts]
11
+ end
12
+
13
+ subgraph Phase2["๐Ÿ”’ 2: Safety & Enrollment"]
14
+ B --> C[Merge Safety Net PR]
15
+ C --> D[Merge Domain Enrollment PR]
16
+ end
17
+
18
+ subgraph Phase3["๐Ÿงน 3: State Management"]
19
+ D --> E[Run State Removal]
20
+ E --> F[Merge iac-deploy Cleanup PR]
21
+ F --> G[Run migrate-spaces]
22
+ end
23
+
24
+ subgraph Phase4["โœ… 4: Complete"]
25
+ G --> H[Merge Service Repo PR]
26
+ H --> I[Run Cleanup]
27
+ I --> J[Merge Post-Migration Cleanup PR]
28
+ end
19
29
  ```
20
30
 
21
- ### Individual Steps
22
-
23
- You can also run each step independently. This is useful if you need to pause the migration or re-run specific steps.
31
+ ## Quick Start
24
32
 
25
33
  ```bash
26
- # 1. Initialize migration (clone repos, collect info)
27
- nx run <project>:stack-migration --command=init
28
-
29
- # 2. Check migration state
30
- nx run <project>:stack-migration --command=state
31
-
32
- # 3. Create domain enrollment PR
33
- nx run <project>:stack-migration --command=enroll
34
-
35
- # 4. Create service repository PR and generate state removal commands
36
- nx run <project>:stack-migration --command=generate-tf-migration
37
-
38
- # 5. Create cleanup PR (iac-deploy)
39
- nx run <project>:stack-migration --command=cleanup-pr
40
-
41
- # 6. Generate migration procedure documentation
42
- nx run <project>:stack-migration --command=generate-procedure
43
-
44
- # 7. Update stack spaces (move to domain space) - RUN MANUALLY ONLY
45
- nx run <project>:stack-migration --command=migrate-spaces
34
+ # Full migration (recommended)
35
+ nx run <project>:stack-migration --command=run
46
36
 
47
- # 8. Clean up migration files
48
- nx run <project>:stack-migration --command=migration-cleanup
37
+ # Preview changes first
38
+ nx run <project>:stack-migration --command=run --dry-run
49
39
  ```
50
40
 
51
- ## Migration Flow and Dependencies
52
-
53
- The migration follows a specific sequence. Here's the required flow:
54
-
55
- ### Phase 1: Setup and Configuration
56
-
57
- 1. **init** - Clones required repos, validates auth, collects service info
58
- - Creates `.migration-state.json` to track progress
59
- - Clones: `domain-enrollment`, `iac-deploy`
60
- - Loads stack configuration
61
-
62
- ### Phase 2: Safety and Enrollment
63
-
64
- 2. **enroll** - Creates domain enrollment PR
65
- - Adds repository to domain's `spacelift.yaml`
66
- - PR must be merged before continuing
67
- - Deploys the metastack for your repository
68
-
69
- 3. **generate-tf-migration** - Creates service repository PR and state removal script
70
- - Copies `spacelift.yaml` from iac-deploy
71
- - Generates `.metastack/import.tf` with import blocks
72
- - Generates `METASTACK_STATE_REMOVAL_COMMANDS.sh`
73
- - DO NOT MERGE THIS PR YET
74
-
75
- ### Phase 3: Cleanup and State Management
76
-
77
- 4. **cleanup-pr** - Creates cleanup PR
78
- - iac-deploy: Removes stack configuration file
79
- - DO NOT MERGE THIS PR YET
80
-
81
- 5. **generate-procedure** - Generates migration documentation
82
- - Creates `METASTACK_MIGRATION_PROCEDURE.md`
83
- - Provides complete overview of migration steps
84
-
85
- 6. **migrate-spaces** - Updates stack spaces (MANUAL STEP)
86
- - Moves stacks from old space to `domain-{domain}` space
87
- - **IMPORTANT**: Run MANUALLY after state removal commands
88
- - Run AFTER state removal, BEFORE merging cleanup PRs
89
- - NOT included in full `run` workflow for safety
90
-
91
- ### Phase 4: Completion
92
-
93
- 7. After all steps complete:
94
- - Merge cleanup PR (iac-deploy)
95
- - Merge service repository PR
96
- - Run **migration-cleanup** to remove temporary files
97
-
98
- ## Important Notes
99
-
100
- ### State Management
101
-
102
- - Migration state is saved in `.migration-state.json`
103
- - You can resume migration from any step
104
- - Configuration (stacks) is preserved in state
105
- - You can run steps in any order after `init`, but follow the recommended flow
106
-
107
- ### Order Requirements
108
-
109
- While steps can be run independently, they should generally follow this sequence:
110
-
111
- 1. `init` must be run first (loads configuration)
112
- 2. `enroll` should be merged before running `generate-tf-migration`
113
- 3. `generate-tf-migration` creates the service repo PR and state removal script
114
- 4. Run state removal commands from `METASTACK_STATE_REMOVAL_COMMANDS.sh` before merging cleanup PR
115
- 5. Run `migrate-spaces` MANUALLY after state removal but before merging cleanup PR
116
- 6. Merge cleanup PR before merging service repository PR
117
- 7. The full `run` command skips `migrate-spaces` for safety - you must run it manually
118
-
119
- ### Files Generated
41
+ ## Commands
120
42
 
121
- - `.migration-state.json` - Migration state and progress
122
- - `METASTACK_MIGRATION_PROCEDURE.md` - Complete migration procedure
123
- - `METASTACK_STATE_REMOVAL_COMMANDS.sh` - Commands to remove Terraform state
124
- - `.metastack/import.tf` - Terraform import blocks
125
- - `spacelift.yaml` - Stack configuration
43
+ | Command | Description |
44
+ | ----------------------- | --------------------------------------------- |
45
+ | `init` | Clone repos, load config |
46
+ | `state` | Show migration state |
47
+ | `enroll` | Create domain enrollment PR |
48
+ | `generate-tf-migration` | Create service PR + state removal script |
49
+ | `iac-deploy-cleanup` | Create iac-deploy cleanup PR |
50
+ | `generate-procedure` | Generate procedure doc |
51
+ | `migrate-spaces` | Move stacks to domain space (manual) |
52
+ | `cleanup` | Create post-migration PR + remove local files |
53
+
54
+ ## Execution Order
55
+
56
+ | Step | Action | Type |
57
+ | ---- | ----------------------------------- | --------- |
58
+ | 1 | Merge **Safety Net** PR | ๐Ÿ”€ PR |
59
+ | 2 | Merge **Domain Enrollment** PR | ๐Ÿ”€ PR |
60
+ | 3 | Run state removal script | ๐Ÿ”ง Manual |
61
+ | 4 | Merge **iac-deploy Cleanup** PR | ๐Ÿ”€ PR |
62
+ | 5 | Run migrate-spaces | ๐Ÿ”ง Manual |
63
+ | 6 | Merge **Service Repo** PR | ๐Ÿ”€ PR |
64
+ | 7 | Run cleanup | ๐Ÿ”ง Manual |
65
+ | 8 | Merge **Post-Migration Cleanup** PR | ๐Ÿ”€ PR |
66
+
67
+ ## Files Generated
68
+
69
+ | File | Purpose |
70
+ | ------------------------------------- | -------------------------------- |
71
+ | `.migration-state.json` | Migration state (resume anytime) |
72
+ | `METASTACK_MIGRATION_PROCEDURE.md` | Checklist & instructions |
73
+ | `METASTACK_STATE_REMOVAL_COMMANDS.sh` | State removal commands |
74
+ | `.metastack/import.tf` | Terraform import blocks |
75
+ | `spacelift.yaml` | Stack definitions |
76
+
77
+ ## Notes
78
+
79
+ - State saved in `.migration-state.json`, you can resume at any time
80
+ - `migrate-spaces` must be run manually (not in `run` workflow)
81
+ - Run state removal before merging iac-deploy cleanup PR to avoid actually deleting the stacks
@@ -66,13 +66,9 @@ export declare class MigrationTool extends MigrationHelper {
66
66
  */
67
67
  checkMigrationState(): Promise<void>;
68
68
  /**
69
- * Clean up migration files
69
+ * Clean up migration (creates PR + removes local files)
70
70
  */
71
71
  cleanupMigration(): Promise<void>;
72
- /**
73
- * Create Final Cleanup PR (remove import.tf and spacelift provider from version.tf)
74
- */
75
- createFinalCleanupPR(): Promise<void>;
76
72
  /**
77
73
  * Full migration workflow
78
74
  */