@go-to-k/cdkd 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -510,19 +510,39 @@ Built on modern AWS tooling:
510
510
 
511
511
  ## State Management
512
512
 
513
- State is stored in S3. Each stack has its own `state.json` and `lock.json`:
513
+ State is stored in S3. Keys are scoped by `(stackName, region)` so the same
514
+ stack name deployed to two regions has two independent state files:
514
515
 
515
516
  ```
516
517
  s3://{state-bucket}/
517
518
  └── {prefix}/ # Default: "cdkd" (configurable via --state-prefix)
518
519
  ├── MyStack/
519
- ├── state.json # Resource state
520
- └── lock.json # Exclusive deploy lock
520
+ └── us-east-1/
521
+ ├── state.json # Resource state (version: 2)
522
+ │ └── lock.json # Exclusive deploy lock
521
523
  └── AnotherStack/
522
- ├── state.json
523
- └── lock.json
524
+ ├── us-east-1/
525
+ │ ├── state.json
526
+ │ └── lock.json
527
+ └── us-west-2/ # same stackName, different region
528
+ ├── state.json
529
+ └── lock.json
524
530
  ```
525
531
 
532
+ > **Caveat: same `stackName` in multiple regions becomes visible after
533
+ > `env.region` changes.** Before this layout shipped, changing a stack's
534
+ > `env.region` between deploys silently overwrote the prior region's state
535
+ > and `cdkd destroy` ran against the wrong region. cdkd now treats the two
536
+ > regions as independent. Use `cdkd state list` to see both, and
537
+ > `cdkd state rm <stack> --stack-region <region>` to prune one without
538
+ > touching the other.
539
+ >
540
+ > **Legacy layout migration:** state files written by cdkd before this
541
+ > layout (`version: 1`, flat `cdkd/{stackName}/state.json`) are still
542
+ > readable. The next cdkd write auto-migrates to the new key and removes
543
+ > the legacy file. An older cdkd binary reading a `version: 2` file fails
544
+ > with a clear "upgrade cdkd" error rather than silently mishandling it.
545
+
526
546
  ### Configuration
527
547
 
528
548
  | Setting | CLI | cdk.json | Env var | Default |
@@ -548,8 +568,9 @@ State schema:
548
568
 
549
569
  ```typescript
550
570
  {
551
- version: 1,
571
+ version: 2,
552
572
  stackName: "MyStack",
573
+ region: "us-east-1",
553
574
  resources: {
554
575
  "MyFunction": {
555
576
  physicalId: "arn:aws:lambda:...",