@go-to-k/cdkd 0.91.4 → 0.92.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
@@ -453,6 +453,47 @@ Two `orphan` variants at different granularities:
453
453
  Both `cdkd destroy` (synth-driven) and `cdkd state destroy`
454
454
  (state-driven, no synth) delete AWS resources + state.
455
455
 
456
+ ## Stack-name prefix on physical names
457
+
458
+ cdkd prepends the **stack name** to physical names you declare in CDK
459
+ code: `new iam.Role(this, 'CRRole', { roleName: 'my-role' })` in stack
460
+ `MyStack` is created in AWS as `MyStack-my-role`. The prefix protects
461
+ cross-stack uniqueness (two stacks declaring `roleName: 'my-role'`
462
+ otherwise collide on a single AWS account). Pre-PR this behavior was
463
+ **inconsistent**: only IAM Role / User / Group / InstanceProfile and
464
+ ELBv2 LoadBalancer / TargetGroup actually got the prefix; Lambda, S3,
465
+ SNS, SQS, DynamoDB, etc. used the user's declared name as-is.
466
+
467
+ `cdkd deploy --no-prefix-user-supplied-names` opts in to skipping
468
+ the prefix on user-declared physical names, making cdkd consistent
469
+ across all resource types. Off by default for backward compatibility.
470
+
471
+ | | Default (no flag) | `--no-prefix-user-supplied-names` |
472
+ | --- | --- | --- |
473
+ | `new iam.Role({ roleName: 'my-role' })` | `MyStack-my-role` | `my-role` |
474
+ | `new s3.Bucket({ bucketName: 'my-bucket' })` | `my-bucket` (already no prefix — Pattern A) | `my-bucket` (unchanged) |
475
+ | `new iam.Role(...)` (no `roleName`) | `MyStack-CRRole-<hash>` (auto-generated, prefix kept for uniqueness) | `MyStack-CRRole-<hash>` (unchanged) |
476
+
477
+ Resolution chain (highest wins): `--no-prefix-user-supplied-names`
478
+ CLI flag → `CDKD_NO_PREFIX_USER_SUPPLIED_NAMES=true` env var →
479
+ `cdk.json` `context.cdkd.noPrefixUserSuppliedNames: true` → default
480
+ `false`.
481
+
482
+ Affects `cdkd deploy` only. Already-deployed stacks deployed under
483
+ the legacy prefixed-name scheme keep working — the flag only controls
484
+ what AWS resource cdkd creates on **future** deploys. Switching the
485
+ flag mid-flight on an existing stack would propose REPLACEMENT on
486
+ every Pattern B resource (the existing AWS resource has the prefixed
487
+ name; the new template intent has the un-prefixed name).
488
+
489
+ Surfaced by [PR #285 `cdkd export`](https://github.com/go-to-k/cdkd/pull/285)
490
+ where the CFn IMPORT changeset's identifier check would fail on a
491
+ synth `RoleName: 'my-role'` vs the AWS-deployed `MyStack-my-role`;
492
+ the export command currently overlays `ResourceIdentifier` onto
493
+ `Properties` to bridge the gap. A future major-version PR will flip
494
+ the default of `--no-prefix-user-supplied-names` to `true`, after
495
+ which the overlay can be dropped.
496
+
456
497
  ## `--remove-protection`: one-shot bypass for protected resources
457
498
 
458
499
  CDK's `new Stack(app, 'X', { terminationProtection: true })` is honored