@go-to-k/cdkd 0.278.20 → 0.278.22

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/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { $ as isThrottlingError, $t as setAwsClients, A as red, At as getLegacyStateBucketName, B as isTerminationProtectionPropagationError, Bt as CFN_TEMPLATE_BODY_LIMIT, C as isStatefulRecreateTargetSync, Ct as runDockerForeground, D as cyan, Dt as Synthesizer, E as bold, Et as getDockerImageBySourceHash, F as ProviderRegistry, Ft as resolveStateBucketWithDefault, G as normalizeAwsTagsToCfn, Gt as expectedOwnerParam, H as cfnRefValueFromPhysicalId, Ht as MIGRATE_TMP_PREFIX, I as findActionableSilentDrops, It as resolveStateBucketWithDefaultAndSource, J as applyRoleArnIfSet, K as resolveExplicitPhysicalId, Kt as AssemblyReader, L as CloudControlProvider, Lt as resolveUseCdkBootstrapAssets, M as IAMRoleProvider, Mt as resolveAutoAssetStorage, N as collectInlinePolicyNamesManagedBySiblings, Nt as resolveCaptureObservedState, O as gray, Ot as synthesisStatusMessage, P as clearOnUpdateRemoval, Pt as resolveSkipPrefix, Q as isRetryableTransientError, Qt as resetAwsClients, R as slowCcOperationTimeoutMs, Rt as stateBucketExistenceConfirmed, S as MULTI_REGION_RECREATE_BLOCKED_TYPES, Sn as withErrorHandling, St as getDockerCmd, T as formatResourceLine, Tt as AssetManifestLoader, U as refStateLookupFromResource, Ut as findLargeInlineResources, V as IntrinsicFunctionResolver, Vt as CFN_TEMPLATE_URL_LIMIT, W as WAFv2WebACLProvider, Wt as uploadCfnTemplate, X as describeTypeWithThrottleRetry, Xt as AwsClients, Y as DiffCalculator, Yt as resolveBucketRegion, Z as withRetry, Zt as getAwsClients, _ as createPreDeleteFinalSnapshot, _t as parseBootstrapMarker, a as DeploymentEventsStore, an as LocalInvokeBuildError$1, at as shouldRetainResource, b as unsupportedFinalSnapshotError, bt as buildDockerImage, c as replayFailedOperations, ct as WorkGraph, d as IMPLICIT_DELETE_DEPENDENCIES, dn as PartialFailureError, dt as loadPublishableAssetManifest, et as DagBuilder, f as computeImplicitDeleteEdges, fn as ProvisioningError, ft as rewriteTemplateAssetReferences, g as ccRoutedFinalSnapshotError, gn as StackTerminationProtectionError, gt as getBootstrapMarkerKey, h as buildFinalSnapshotIdentifier, hn as StackHasActiveImportsError, ht as ensureAssetStorage, i as DeploymentEventsReader, in as DeployCancelledError, it as rebuildClientForBucketRegion, j as yellow, jt as resolveApp, k as green, kt as getDefaultStateBucketName, l as replayRollback, ln as MissingCdkCliError, lt as buildAssetRedirectMap, m as PRE_DELETE_SNAPSHOT_TYPES, mn as ResourceUpdateNotSupportedError, mt as BOOTSTRAP_MARKER_PREFIX, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as LockManager, o as planFailedOps, on as LocalMigrateError, ot as AssetPublisher, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as ResourceTimeoutError, pt as AssetModeResolver, q as assertRegionMatch, qt as processStackMessages, r as DeployEngine, rt as S3StateBackend, s as planRollback, sn as LocalStartServiceError, st as stringifyValue, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as CdkdError, tt as TemplateParser, u as withResourceDeadline, un as NestedStackChildDirectDestroyError, ut as createAssetRedirectResolver, v as isFinalSnapshotError, vt as validateAssetBucketName, w as renderStatefulReason, wt as runDockerStreaming, x as extractDeploymentEventError, xn as normalizeAwsError, xt as formatDockerLoginError, y as refusesFinalSnapshot, yt as validateContainerRepoName, z as disableInstanceApiTermination, zt as warnDeprecatedNoPrefixCliFlag } from "./deploy-engine-Bv3IEbrU.js";
2
+ import { $ as isThrottlingError, $t as setAwsClients, A as red, At as getLegacyStateBucketName, B as isTerminationProtectionPropagationError, Bt as CFN_TEMPLATE_BODY_LIMIT, C as isStatefulRecreateTargetSync, Ct as runDockerForeground, D as cyan, Dt as Synthesizer, E as bold, Et as getDockerImageBySourceHash, F as ProviderRegistry, Ft as resolveStateBucketWithDefault, G as normalizeAwsTagsToCfn, Gt as expectedOwnerParam, H as cfnRefValueFromPhysicalId, Ht as MIGRATE_TMP_PREFIX, I as findActionableSilentDrops, It as resolveStateBucketWithDefaultAndSource, J as applyRoleArnIfSet, K as resolveExplicitPhysicalId, Kt as AssemblyReader, L as CloudControlProvider, Lt as resolveUseCdkBootstrapAssets, M as IAMRoleProvider, Mt as resolveAutoAssetStorage, N as collectInlinePolicyNamesManagedBySiblings, Nt as resolveCaptureObservedState, O as gray, Ot as synthesisStatusMessage, P as clearOnUpdateRemoval, Pt as resolveSkipPrefix, Q as isRetryableTransientError, Qt as resetAwsClients, R as slowCcOperationTimeoutMs, Rt as stateBucketExistenceConfirmed, S as MULTI_REGION_RECREATE_BLOCKED_TYPES, Sn as withErrorHandling, St as getDockerCmd, T as formatResourceLine, Tt as AssetManifestLoader, U as refStateLookupFromResource, Ut as findLargeInlineResources, V as IntrinsicFunctionResolver, Vt as CFN_TEMPLATE_URL_LIMIT, W as WAFv2WebACLProvider, Wt as uploadCfnTemplate, X as describeTypeWithThrottleRetry, Xt as AwsClients, Y as DiffCalculator, Yt as resolveBucketRegion, Z as withRetry, Zt as getAwsClients, _ as createPreDeleteFinalSnapshot, _t as parseBootstrapMarker, a as DeploymentEventsStore, an as LocalInvokeBuildError$1, at as shouldRetainResource, b as unsupportedFinalSnapshotError, bt as buildDockerImage, c as replayFailedOperations, ct as WorkGraph, d as IMPLICIT_DELETE_DEPENDENCIES, dn as PartialFailureError, dt as loadPublishableAssetManifest, et as DagBuilder, f as computeImplicitDeleteEdges, fn as ProvisioningError, ft as rewriteTemplateAssetReferences, g as ccRoutedFinalSnapshotError, gn as StackTerminationProtectionError, gt as getBootstrapMarkerKey, h as buildFinalSnapshotIdentifier, hn as StackHasActiveImportsError, ht as ensureAssetStorage, i as DeploymentEventsReader, in as DeployCancelledError, it as rebuildClientForBucketRegion, j as yellow, jt as resolveApp, k as green, kt as getDefaultStateBucketName, l as replayRollback, ln as MissingCdkCliError, lt as buildAssetRedirectMap, m as PRE_DELETE_SNAPSHOT_TYPES, mn as ResourceUpdateNotSupportedError, mt as BOOTSTRAP_MARKER_PREFIX, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as LockManager, o as planFailedOps, on as LocalMigrateError, ot as AssetPublisher, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as ResourceTimeoutError, pt as AssetModeResolver, q as assertRegionMatch, qt as processStackMessages, r as DeployEngine, rt as S3StateBackend, s as planRollback, sn as LocalStartServiceError, st as stringifyValue, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as CdkdError, tt as TemplateParser, u as withResourceDeadline, un as NestedStackChildDirectDestroyError, ut as createAssetRedirectResolver, v as isFinalSnapshotError, vt as validateAssetBucketName, w as renderStatefulReason, wt as runDockerStreaming, x as extractDeploymentEventError, xn as normalizeAwsError, xt as formatDockerLoginError, y as refusesFinalSnapshot, yt as validateContainerRepoName, z as disableInstanceApiTermination, zt as warnDeprecatedNoPrefixCliFlag } from "./deploy-engine-CkuG2VD5.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BYMEE-BS.js";
4
- import { t as ASGProvider } from "./asg-provider-OB2CvUwn.js";
4
+ import { t as ASGProvider } from "./asg-provider-BBsW05cu.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
- import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
7
+ import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
8
8
  import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreateAccessKeyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreatePolicyCommand, CreatePolicyVersionCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeletePolicyCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetAccessKeyLastUsedCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetPolicyCommand, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListEntitiesForPolicyCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListPoliciesCommand, ListPolicyTagsCommand, ListPolicyVersionsCommand, ListUserPoliciesCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagPolicyCommand, TagUserCommand, UntagPolicyCommand, UntagUserCommand, UpdateAccessKeyCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
9
9
  import { CreateQueueCommand, DeleteQueueCommand, GetQueueAttributesCommand, GetQueueUrlCommand, ListQueueTagsCommand, QueueDoesNotExist, SQSClient, SetQueueAttributesCommand, TagQueueCommand, UntagQueueCommand } from "@aws-sdk/client-sqs";
10
10
  import { CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesCommand, GetTopicAttributesCommand, InvalidParameterException, ListSubscriptionsByTopicCommand, ListTagsForResourceCommand, ListTopicsCommand, NotFoundException, SNSClient, SetTopicAttributesCommand, SubscribeCommand, TagResourceCommand, UnsubscribeCommand, UntagResourceCommand } from "@aws-sdk/client-sns";
@@ -4868,7 +4868,7 @@ function coerceCfnBoolean(value) {
4868
4868
  * S3's CreateBucket is synchronous - no polling needed, unlike CC API which
4869
4869
  * requires async polling (1s→1.5s→2.25s...) adding seconds per resource.
4870
4870
  */
4871
- var S3BucketProvider = class {
4871
+ var S3BucketProvider = class S3BucketProvider {
4872
4872
  s3Client;
4873
4873
  logger = getLogger().child("S3BucketProvider");
4874
4874
  handledProperties = /* @__PURE__ */ new Map([["AWS::S3::Bucket", /* @__PURE__ */ new Set([
@@ -5142,6 +5142,7 @@ var S3BucketProvider = class {
5142
5142
  * - BucketKeyEnabled
5143
5143
  */
5144
5144
  async applyBucketEncryption(bucketName, encryptionConfig) {
5145
+ if (!Array.isArray(encryptionConfig?.ServerSideEncryptionConfiguration)) throw new Error(`BucketEncryption.ServerSideEncryptionConfiguration must be an array (got ${encryptionConfig?.ServerSideEncryptionConfiguration === void 0 ? "undefined" : typeof encryptionConfig.ServerSideEncryptionConfiguration}) — check for an unresolved intrinsic or a mis-nested template value`);
5145
5146
  const rules = encryptionConfig.ServerSideEncryptionConfiguration.map((rule) => {
5146
5147
  const byDefault = rule["ServerSideEncryptionByDefault"];
5147
5148
  return {
@@ -5525,30 +5526,91 @@ var S3BucketProvider = class {
5525
5526
  this.logger.debug(`Applied object lock configuration to bucket ${bucketName}`);
5526
5527
  }
5527
5528
  /**
5528
- * Apply additional bucket configuration after creation
5529
+ * Apply additional bucket configuration after creation.
5530
+ *
5531
+ * `options.skipDiffManaged` is passed by `update()` for the three
5532
+ * sub-configs that moved onto the diff path (`VersioningConfiguration` /
5533
+ * `OwnershipControls` / `BucketEncryption`, issue #1466). They stay here for
5534
+ * CREATE — where there is no previous side to diff against — but on UPDATE
5535
+ * they must go through `applySubConfigDiffs` so a REMOVED property is reset
5536
+ * to the CloudFormation default instead of silently surviving. Applying them
5537
+ * in both places would double-PUT.
5529
5538
  */
5530
- async applyConfiguration(bucketName, properties, skipTags = false) {
5539
+ async applyConfiguration(bucketName, properties, options = {}) {
5540
+ const { skipTags = false, skipDiffManaged = false } = options;
5531
5541
  const versioningConfig = properties["VersioningConfiguration"];
5532
- if (versioningConfig) await this.applyVersioning(bucketName, versioningConfig);
5542
+ if (!skipDiffManaged && versioningConfig) await this.applyVersioning(bucketName, versioningConfig);
5533
5543
  const tags = properties["Tags"];
5534
5544
  if (!skipTags && tags && Array.isArray(tags) && tags.length > 0) await this.applyTags(bucketName, tags);
5535
5545
  const ownershipControls = properties["OwnershipControls"];
5536
- if (ownershipControls?.Rules) {
5537
- await this.s3Client.send(new PutBucketOwnershipControlsCommand({
5538
- Bucket: bucketName,
5539
- OwnershipControls: { Rules: ownershipControls.Rules.map((r) => ({ ObjectOwnership: r.ObjectOwnership })) }
5540
- }));
5541
- this.logger.debug(`Applied ownership controls to bucket ${bucketName}`);
5542
- }
5546
+ const normalizedOwnership = S3BucketProvider.emptyListConfigToUndefined(ownershipControls, "Rules");
5547
+ if (!skipDiffManaged && normalizedOwnership !== void 0) await this.applyOwnershipControls(bucketName, normalizedOwnership);
5543
5548
  const publicAccessBlock = properties["PublicAccessBlockConfiguration"];
5544
5549
  if (publicAccessBlock) await this.applyPublicAccessBlockConfiguration(bucketName, publicAccessBlock);
5545
- const bucketEncryption = properties["BucketEncryption"];
5546
- if (bucketEncryption?.ServerSideEncryptionConfiguration && Array.isArray(bucketEncryption.ServerSideEncryptionConfiguration) && bucketEncryption.ServerSideEncryptionConfiguration.length > 0) await this.applyBucketEncryption(bucketName, bucketEncryption);
5550
+ const normalizedEncryption = S3BucketProvider.emptyListConfigToUndefined(properties["BucketEncryption"], "ServerSideEncryptionConfiguration");
5551
+ if (!skipDiffManaged && normalizedEncryption !== void 0) await this.applyBucketEncryption(bucketName, normalizedEncryption);
5552
+ }
5553
+ /**
5554
+ * CFn property: OwnershipControls
5555
+ * SDK: PutBucketOwnershipControls
5556
+ */
5557
+ async applyOwnershipControls(bucketName, ownershipControls) {
5558
+ if (!Array.isArray(ownershipControls?.Rules)) throw new Error(`OwnershipControls.Rules must be an array (got ${ownershipControls?.Rules === void 0 ? "undefined" : typeof ownershipControls.Rules}) — check for an unresolved intrinsic or a mis-nested template value`);
5559
+ await this.s3Client.send(new PutBucketOwnershipControlsCommand({
5560
+ Bucket: bucketName,
5561
+ OwnershipControls: { Rules: ownershipControls.Rules.map((r) => ({ ObjectOwnership: r.ObjectOwnership })) }
5562
+ }));
5563
+ this.logger.debug(`Applied ownership controls to bucket ${bucketName}`);
5564
+ }
5565
+ /**
5566
+ * Normalize an "empty container" sub-config value to `undefined` so the diff
5567
+ * path cannot mistake a placeholder for a real value.
5568
+ *
5569
+ * `readCurrentState` always-emits placeholder shapes for un-configured
5570
+ * features (`BucketEncryption: { ServerSideEncryptionConfiguration: [] }`,
5571
+ * and the `OwnershipControls: { Rules: [] }` added with issue #1466), and a
5572
+ * `cdkd drift --revert` round-trip feeds those back through `update()`.
5573
+ *
5574
+ * The rule is "empty container == not declared", applied to BOTH sides. Per
5575
+ * pairing that means:
5576
+ * empty desired + absent previous -> no call (without this, a Put with an
5577
+ * empty list, which both APIs reject)
5578
+ * absent desired + empty previous -> no call (without this, a Delete
5579
+ * against a bucket that never had it)
5580
+ * empty desired + REAL previous -> Delete. This one is NOT suppressed
5581
+ * and must not be: it is a genuine
5582
+ * declared -> not-declared transition,
5583
+ * which is exactly what CloudFormation
5584
+ * removes.
5585
+ *
5586
+ * "Empty" is deliberately NARROW. Only two shapes fold to `undefined`:
5587
+ * a block with NO keys at all (`{}`), and a block whose list key holds an
5588
+ * empty array. Everything else — a non-object, an array where the object
5589
+ * belongs (wrong nesting), a block whose list key is absent but which
5590
+ * carries OTHER keys, or a non-array list (an unresolved intrinsic) — is
5591
+ * MALFORMED, not empty, and passes through so the apply call refuses it by
5592
+ * name. Folding any of those to `undefined` would emit a Delete and
5593
+ * silently downgrade a live bucket (KMS -> AES256) while the template still
5594
+ * declares the config.
5595
+ *
5596
+ * NOTE this helper does NOT cover `VersioningConfiguration` (it has no list
5597
+ * key), and that property is NOT malformed-shape-refused anywhere: a
5598
+ * malformed value there still resolves to 'Suspended', matching `main`.
5599
+ * That pre-existing gap is tracked in issue #1471 — see the note in
5600
+ * `applySubConfigDiffs` for why guarding it is not as simple as it looks.
5601
+ */
5602
+ static emptyListConfigToUndefined(config, listKey) {
5603
+ if (config === void 0 || config === null) return void 0;
5604
+ if (typeof config !== "object" || Array.isArray(config)) return config;
5605
+ const list = config[listKey];
5606
+ if (list === void 0 || list === null) return Object.keys(config).length === 0 ? void 0 : config;
5607
+ if (Array.isArray(list) && list.length === 0) return void 0;
5608
+ return config;
5547
5609
  }
5548
5610
  /**
5549
5611
  * Diff CFn-shape sub-config values between previous and new state.
5550
5612
  *
5551
- * Three transitions:
5613
+ * Four transitions:
5552
5614
  * - undefined -> defined (value differs from previous, OR previous undefined): Put
5553
5615
  * - defined -> undefined: Delete
5554
5616
  * - defined -> defined (different): Put
@@ -5593,13 +5655,33 @@ var S3BucketProvider = class {
5593
5655
  * Apply the diff between previous and new sub-configs, issuing Put / Delete
5594
5656
  * SDK calls only for differing keys. Called from `update()`.
5595
5657
  *
5596
- * Versioning / PublicAccessBlock / Tags / OwnershipControls / BucketEncryption
5597
- * stay on `applyConfiguration` (the unconditional always-PUT path) because
5598
- * their AWS APIs don't have a clean "delete" counterpart and they
5599
- * round-trip safely as no-ops when state == AWS-current. The 12 sub-configs
5600
- * below DO have proper Put/Delete pairs so the diff path is preferable.
5658
+ * PublicAccessBlockConfiguration and Tags stay on `applyConfiguration` /
5659
+ * `applyTagDiff`. `PublicAccessBlockConfiguration` is deliberately NOT on the
5660
+ * diff path: a live CloudFormation A/B (issue #1466) confirmed CFn ALSO
5661
+ * leaves the block in place when the property is removed, so cdkd is at
5662
+ * parity and adding an `onRemove` here would CREATE a divergence.
5663
+ *
5664
+ * VersioningConfiguration / OwnershipControls / BucketEncryption used to sit
5665
+ * on that always-PUT path too, on the assumption that their APIs had no clean
5666
+ * "delete" counterpart. That was wrong in all three cases and made removal a
5667
+ * silent no-op (issue #1466): the same A/B showed CFn suspends versioning,
5668
+ * deletes ownership controls, and resets encryption to the SSE-S3 default.
5669
+ * They are now diffed here like every other Put/Delete pair.
5601
5670
  */
5602
5671
  async applySubConfigDiffs(bucketName, properties, previousProperties) {
5672
+ const previousVersioning = previousProperties["VersioningConfiguration"];
5673
+ const nextVersioning = properties["VersioningConfiguration"];
5674
+ const versioningChanged = JSON.stringify(previousVersioning ?? null) !== JSON.stringify(nextVersioning ?? null);
5675
+ const desiredVersioningStatus = nextVersioning == null ? "Suspended" : nextVersioning["Status"] || "Suspended";
5676
+ if (versioningChanged && nextVersioning != null && desiredVersioningStatus !== "Suspended") await this.applyVersioning(bucketName, nextVersioning);
5677
+ await this.diffSubConfig(bucketName, S3BucketProvider.emptyListConfigToUndefined(previousProperties["OwnershipControls"], "Rules"), S3BucketProvider.emptyListConfigToUndefined(properties["OwnershipControls"], "Rules"), async (cfg) => this.applyOwnershipControls(bucketName, cfg), async () => {
5678
+ await this.s3Client.send(new DeleteBucketOwnershipControlsCommand({ Bucket: bucketName }));
5679
+ this.logger.debug(`Deleted ownership controls on bucket ${bucketName}`);
5680
+ });
5681
+ await this.diffSubConfig(bucketName, S3BucketProvider.emptyListConfigToUndefined(previousProperties["BucketEncryption"], "ServerSideEncryptionConfiguration"), S3BucketProvider.emptyListConfigToUndefined(properties["BucketEncryption"], "ServerSideEncryptionConfiguration"), async (cfg) => this.applyBucketEncryption(bucketName, cfg), async () => {
5682
+ await this.s3Client.send(new DeleteBucketEncryptionCommand({ Bucket: bucketName }));
5683
+ this.logger.debug(`Deleted bucket encryption on bucket ${bucketName}`);
5684
+ });
5603
5685
  await this.diffSubConfig(bucketName, previousProperties["LifecycleConfiguration"], properties["LifecycleConfiguration"], async (cfg) => {
5604
5686
  if (!cfg.Rules || !Array.isArray(cfg.Rules) || cfg.Rules.length === 0) return;
5605
5687
  await this.applyLifecycleConfiguration(bucketName, cfg);
@@ -5660,6 +5742,14 @@ var S3BucketProvider = class {
5660
5742
  }));
5661
5743
  this.logger.debug(`Deleted inventory configuration ${id} on bucket ${bucketName}`);
5662
5744
  });
5745
+ if (versioningChanged && desiredVersioningStatus === "Suspended") {
5746
+ const hasObjectLock = (p) => {
5747
+ if (p["ObjectLockEnabled"] === true || p["ObjectLockEnabled"] === "true") return true;
5748
+ return p["ObjectLockConfiguration"]?.["ObjectLockEnabled"] === "Enabled";
5749
+ };
5750
+ if (hasObjectLock(properties) || hasObjectLock(previousProperties)) this.logger.warn(`Bucket ${bucketName}: versioning would be suspended (VersioningConfiguration removed or set to Suspended), but the bucket has Object Lock enabled and S3 does not allow suspending versioning on it. Leaving versioning enabled.`);
5751
+ else await this.applyVersioning(bucketName, { Status: "Suspended" });
5752
+ }
5663
5753
  }
5664
5754
  /**
5665
5755
  * Apply ALL sub-configs unconditionally on initial create. Used by
@@ -5752,7 +5842,10 @@ var S3BucketProvider = class {
5752
5842
  };
5753
5843
  }
5754
5844
  try {
5755
- await this.applyConfiguration(physicalId, properties, true);
5845
+ await this.applyConfiguration(physicalId, properties, {
5846
+ skipTags: true,
5847
+ skipDiffManaged: true
5848
+ });
5756
5849
  await this.applySubConfigDiffs(physicalId, properties, previousProperties);
5757
5850
  await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
5758
5851
  const attributes = await this.buildAttributes(physicalId);
@@ -5804,7 +5897,8 @@ var S3BucketProvider = class {
5804
5897
  * returns `undefined`.
5805
5898
  *
5806
5899
  * Coverage: `BucketName`, `VersioningConfiguration`, `BucketEncryption`,
5807
- * `PublicAccessBlockConfiguration`, `Tags`, plus all 12 sub-configs:
5900
+ * `OwnershipControls`, `PublicAccessBlockConfiguration`, `Tags`, plus all 12
5901
+ * sub-configs:
5808
5902
  * `LifecycleConfiguration`, `CorsConfiguration`, `WebsiteConfiguration`,
5809
5903
  * `LoggingConfiguration`, `NotificationConfiguration`,
5810
5904
  * `ReplicationConfiguration`, `ObjectLockConfiguration`,
@@ -5820,9 +5914,10 @@ var S3BucketProvider = class {
5820
5914
  if (err instanceof NoSuchBucket || e.name === "NotFound" || e.name === "NoSuchBucket" || e.$metadata?.httpStatusCode === 404) return;
5821
5915
  throw err;
5822
5916
  }
5823
- const [versioning, encryption, pab, tags, lifecycle, cors, website, logging, notification, replication, objectLock, accelerate, metrics, analytics, intelligentTier, inventory] = await Promise.all([
5917
+ const [versioning, encryption, ownership, pab, tags, lifecycle, cors, website, logging, notification, replication, objectLock, accelerate, metrics, analytics, intelligentTier, inventory] = await Promise.all([
5824
5918
  this.readVersioning(physicalId),
5825
5919
  this.readEncryption(physicalId),
5920
+ this.readOwnershipControls(physicalId),
5826
5921
  this.readPublicAccessBlock(physicalId),
5827
5922
  this.readTags(physicalId),
5828
5923
  this.readLifecycle(physicalId),
@@ -5842,6 +5937,7 @@ var S3BucketProvider = class {
5842
5937
  BucketName: physicalId,
5843
5938
  VersioningConfiguration: versioning,
5844
5939
  BucketEncryption: encryption,
5940
+ OwnershipControls: ownership,
5845
5941
  PublicAccessBlockConfiguration: pab,
5846
5942
  Tags: tags,
5847
5943
  LifecycleConfiguration: lifecycle,
@@ -5861,6 +5957,22 @@ var S3BucketProvider = class {
5861
5957
  async readVersioning(bucket) {
5862
5958
  return { Status: (await this.s3Client.send(new GetBucketVersioningCommand({ Bucket: bucket }))).Status ?? "Suspended" };
5863
5959
  }
5960
+ /**
5961
+ * OwnershipControls { Rules: [{ ObjectOwnership }] }. Always emit a
5962
+ * placeholder (empty `Rules`) so a console-side change on a bucket that
5963
+ * declares the property surfaces as drift. Added with issue #1466 — without
5964
+ * a read here, `cdkd drift` could not see ownership controls at all, which
5965
+ * is why the removal bug that issue fixes produced no signal from ANY
5966
+ * command.
5967
+ */
5968
+ async readOwnershipControls(bucket) {
5969
+ try {
5970
+ return { Rules: ((await this.s3Client.send(new GetBucketOwnershipControlsCommand({ Bucket: bucket }))).OwnershipControls?.Rules ?? []).map((r) => ({ ObjectOwnership: r.ObjectOwnership })) };
5971
+ } catch (err) {
5972
+ if (err.name === "OwnershipControlsNotFoundError") return { Rules: [] };
5973
+ throw err;
5974
+ }
5975
+ }
5864
5976
  async readEncryption(bucket) {
5865
5977
  try {
5866
5978
  return { ServerSideEncryptionConfiguration: ((await this.s3Client.send(new GetBucketEncryptionCommand({ Bucket: bucket }))).ServerSideEncryptionConfiguration?.Rules ?? []).map((rule) => {
@@ -33019,13 +33131,14 @@ var GlueProvider = class {
33019
33131
  const tableName = tableInput["Name"] ?? properties["Name"];
33020
33132
  if (!tableName) throw new ProvisioningError(`TableInput.Name or top-level Name is required for Glue Table ${logicalId}`, resourceType, logicalId);
33021
33133
  const catalogId = properties["CatalogId"];
33134
+ assertIcebergTableInputAbsent(logicalId, resourceType, properties);
33022
33135
  const openTableFormatInput = properties["OpenTableFormatInput"];
33023
33136
  try {
33024
33137
  await this.getClient().send(new CreateTableCommand$1({
33025
33138
  CatalogId: catalogId,
33026
33139
  DatabaseName: databaseName,
33027
33140
  TableInput: this.buildTableInput(tableInput, tableName),
33028
- ...openTableFormatInput !== void 0 && { OpenTableFormatInput: toSdkOpenTableFormatInput(openTableFormatInput) }
33141
+ ...openTableFormatInput !== void 0 && { OpenTableFormatInput: openTableFormatInput }
33029
33142
  }));
33030
33143
  const physicalId = `${databaseName}|${tableName}`;
33031
33144
  this.logger.debug(`Successfully created Glue Table ${logicalId}: ${physicalId}`);
@@ -33045,6 +33158,8 @@ var GlueProvider = class {
33045
33158
  const tableInput = properties["TableInput"];
33046
33159
  if (!tableInput) throw new ProvisioningError(`TableInput is required for Glue Table update ${logicalId}`, resourceType, logicalId, physicalId);
33047
33160
  const catalogId = properties["CatalogId"];
33161
+ const updateIcebergKey = findIcebergTableInputKey(properties);
33162
+ if (updateIcebergKey !== void 0) this.logger.warn(icebergTableInputRefusalMessage(logicalId, updateIcebergKey, "update"));
33048
33163
  try {
33049
33164
  await this.getClient().send(new UpdateTableCommand$1({
33050
33165
  CatalogId: catalogId,
@@ -33600,32 +33715,100 @@ function sleep$1(ms) {
33600
33715
  return new Promise((resolve) => setTimeout(resolve, ms));
33601
33716
  }
33602
33717
  /**
33603
- * Convert the CFn `AWS::Glue::Table.OpenTableFormatInput` blob to the SDK
33604
- * `OpenTableFormatInput` shape.
33605
- *
33606
- * Every key matches the SDK model except one: CFn's
33607
- * `IcebergInput.IcebergTableInput` is the SDK's
33608
- * `IcebergInput.CreateIcebergTableInput` (@aws-sdk/client-glue `models_1.d.ts`
33609
- * `IcebergInput`). The AWS SDK v3 serializer drops unknown members, so leaving
33610
- * the CFn spelling in place silently discarded the ENTIRE Iceberg table spec
33611
- * (`Location` / `Schema` / `PartitionSpec` / `WriteOrder` / `Properties`) while
33612
- * `CreateTable` still reported success. The renamed object's own members match
33613
- * CFn 1:1, so this is a single key rename.
33614
- *
33615
- * Non-object inputs (an unresolved intrinsic) pass through untouched so AWS
33616
- * surfaces the real validation error.
33617
- */
33618
- function toSdkOpenTableFormatInput(input) {
33619
- const iceberg = input["IcebergInput"];
33620
- if (typeof iceberg !== "object" || iceberg === null || Array.isArray(iceberg) || !("IcebergTableInput" in iceberg)) return input;
33621
- const { IcebergTableInput: icebergTableInput, ...rest } = iceberg;
33622
- return {
33623
- ...input,
33624
- IcebergInput: {
33625
- ...rest,
33626
- CreateIcebergTableInput: icebergTableInput
33627
- }
33628
- };
33718
+ * Both spellings of the Iceberg table spec cdkd refuses inside
33719
+ * `OpenTableFormatInput.IcebergInput`: the CFn registry schema's
33720
+ * `IcebergTableInput` and `@aws-sdk/client-glue`'s `CreateIcebergTableInput`.
33721
+ * A hand-written template can carry either, and neither is deployable, so the
33722
+ * pre-flight matches both and names whichever it found.
33723
+ */
33724
+ const ICEBERG_TABLE_INPUT_KEYS = ["IcebergTableInput", "CreateIcebergTableInput"];
33725
+ /**
33726
+ * Return whichever {@link ICEBERG_TABLE_INPUT_KEYS} spelling the template
33727
+ * carries under `OpenTableFormatInput.IcebergInput`, or `undefined`.
33728
+ *
33729
+ * Non-object shapes at either level (an unresolved intrinsic) are treated as
33730
+ * "absent" so AWS surfaces the real validation error rather than this refusal.
33731
+ */
33732
+ function findIcebergTableInputKey(properties) {
33733
+ const openTableFormatInput = properties["OpenTableFormatInput"];
33734
+ if (typeof openTableFormatInput !== "object" || openTableFormatInput === null || Array.isArray(openTableFormatInput)) return;
33735
+ const iceberg = openTableFormatInput["IcebergInput"];
33736
+ if (typeof iceberg !== "object" || iceberg === null || Array.isArray(iceberg)) return;
33737
+ return ICEBERG_TABLE_INPUT_KEYS.find((key) => key in iceberg);
33738
+ }
33739
+ /**
33740
+ * PRE-FLIGHT REFUSAL of `AWS::Glue::Table`
33741
+ * `OpenTableFormatInput.IcebergInput.IcebergTableInput` (issue #1454).
33742
+ *
33743
+ * **This is a deliberate PARITY DIVERGENCE, and it was a conscious choice.**
33744
+ * cdkd's compatibility target is CloudFormation, and CloudFormation does not
33745
+ * validate this property — it forwards it and lets the deploy roll back. cdkd
33746
+ * refuses it EARLIER and with a better message instead. The justification is
33747
+ * that no user is losing a working deployment: the live probe on issue #1408
33748
+ * (2026-08-09, us-east-1 — 5 raw `glue:CreateTable` shapes plus 5
33749
+ * `AWS::Glue::Table` CloudFormation stacks) proved the property is undeployable
33750
+ * on BOTH paths.
33751
+ *
33752
+ * - **The raw `glue:CreateTable` API — the call cdkd itself makes** — rejects
33753
+ * every `CreateIcebergTableInput` shape: without a
33754
+ * `TableInput.StorageDescriptor` it fails `Location information cannot be
33755
+ * null while creating an iceberg table`, and with one it fails `Table
33756
+ * metadata information present at multiple parts of input request`. The
33757
+ * spec's own `Location` is never read. So this is NOT merely cdkd declining
33758
+ * what CloudFormation declines — cdkd's own path cannot deploy it either.
33759
+ * - **CloudFormation** rolls back all three variants with `Table metadata is
33760
+ * expected only via TableInput or via IcebergTableInputProperties inside
33761
+ * OpenTableFormatInput` — naming a property that exists in NEITHER the CFn
33762
+ * registry schema (`IcebergInput.IcebergTableInput`) NOR
33763
+ * `@aws-sdk/client-glue` (`IcebergInput.CreateIcebergTableInput`). That
33764
+ * three-way contract mismatch is an AWS-side bug.
33765
+ *
33766
+ * Because there is no shape in which the property works, forwarding it can only
33767
+ * produce a late, cryptic AWS error. Failing fast with the working shape spelled
33768
+ * out is strictly more useful.
33769
+ *
33770
+ * **CREATE only — update WARNS instead.** See the comment at the `updateTable`
33771
+ * call site: rollback replays from cdkd STATE, and a table created by a
33772
+ * pre-#1390 build carries the key in its state record, so refusing on update
33773
+ * would make such a table unrollbackable with no template-side remedy. cdkd
33774
+ * does not wire Glue's update-only `UpdateOpenTableFormatInput` shape and
33775
+ * `buildTableInput` is an explicit allow-list, so warning there forwards
33776
+ * nothing and loses no protection. One rollback arm is still exposed — the
33777
+ * reverse-replacement re-create replays a state record through `create()`;
33778
+ * see issue #1463 and the note at the `updateTable` call site.
33779
+ *
33780
+ * **Known bypass: the sticky Cloud Control route.** This is a GlueProvider
33781
+ * pre-flight, so it only runs on the SDK route. When a table's state record
33782
+ * carries `provisionedBy: 'cc-api'`, `ProviderRegistry.getProviderFor` sticky-
33783
+ * routes it to `CloudControlProvider`, which forwards the property to
33784
+ * CloudFormation and gets AWS's rollback instead of this message. That route is
33785
+ * opt-in only (`--recreate-via-cc-api`, or a legacy state record) —
33786
+ * `AWS::Glue::Table` has an empty `silentDrop` map, so no ordinary deploy takes
33787
+ * it. The outcome there is still a failure, just a later and less helpful one,
33788
+ * which is why this is documented rather than duplicated into the CC provider.
33789
+ *
33790
+ * **WARNING before relaxing this refusal.** cdkd used to RENAME the CFn
33791
+ * `IcebergTableInput` to the SDK's `CreateIcebergTableInput` (issue #1390); that
33792
+ * rename existed because the AWS SDK v3 serializer DROPS unknown members, so the
33793
+ * CFn spelling silently discarded the entire Iceberg spec while `CreateTable`
33794
+ * reported success. The rename was removed here as unreachable once this
33795
+ * refusal landed. If AWS ever ships a deployable shape and this check is
33796
+ * relaxed, the rename MUST be restored in the same change — otherwise the
33797
+ * silent-drop bug of #1390 comes straight back.
33798
+ */
33799
+ function assertIcebergTableInputAbsent(logicalId, resourceType, properties, physicalId) {
33800
+ const key = findIcebergTableInputKey(properties);
33801
+ if (key === void 0) return;
33802
+ throw new ProvisioningError(icebergTableInputRefusalMessage(logicalId, key, "create"), resourceType, logicalId, physicalId);
33803
+ }
33804
+ /**
33805
+ * The shared #1454 message body, so the CREATE refusal and the UPDATE warning
33806
+ * cannot drift apart. `mode` only changes the lead clause — everything after it
33807
+ * (the probe evidence and the working shape) is identical, because the user's
33808
+ * next action is the same either way.
33809
+ */
33810
+ function icebergTableInputRefusalMessage(logicalId, key, mode) {
33811
+ return `AWS::Glue::Table ${logicalId}: OpenTableFormatInput.IcebergInput.${key} ${mode === "create" ? `cannot be deployed by AWS in any shape, so cdkd refuses it before calling Glue (issue #1454).` : "cannot be deployed by AWS in any shape and is IGNORED on update — cdkd does not wire Glue's update-only UpdateOpenTableFormatInput shape, so it forwards nothing here and only warns (issue #1454). A CREATE of this table would be refused outright."}\n Live-probed 2026-08-09 in us-east-1 (issue #1408): glue:CreateTable — the API cdkd calls — rejects every Iceberg table spec ("Location information cannot be null while creating an iceberg table" without a TableInput.StorageDescriptor, "Table metadata information present at multiple parts of input request" with one), and CloudFormation rolls the same template back with "Table metadata is expected only via TableInput or via IcebergTableInputProperties inside OpenTableFormatInput" — a property name that exists in neither the CFn registry schema (IcebergInput.IcebergTableInput) nor @aws-sdk/client-glue (IcebergInput.CreateIcebergTableInput).\n Working shape — put the table metadata in TableInput and leave IcebergInput carrying only the create-time directive:\n TableInput: { Name, TableType: 'EXTERNAL_TABLE', StorageDescriptor: { Location: 's3://your-bucket/prefix/', Columns: [...] } }\n OpenTableFormatInput: { IcebergInput: { MetadataOperation: 'CREATE' } } // Version: '2' is also accepted\n Glue then writes the Iceberg metadata itself — the created table comes back with Parameters.table_type = ICEBERG and a populated Parameters.metadata_location.`;
33629
33812
  }
33630
33813
  /**
33631
33814
  * Build the SDK `EncryptionConfiguration` from the CFn-shape input
@@ -65415,7 +65598,7 @@ function createMigrateCommand() {
65415
65598
  */
65416
65599
  function buildProgram() {
65417
65600
  const program = new Command();
65418
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.278.20");
65601
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.278.22");
65419
65602
  program.hook("preAction", (_thisCommand, actionCommand) => {
65420
65603
  const { profile } = actionCommand.optsWithGlobals();
65421
65604
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;