@go-to-k/cdkd 0.275.5 → 0.275.6

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as WorkGraph, A as slowCcOperationTimeoutMs, At as warnDeprecatedNoPrefixCliFlag, B as applyRoleArnIfSet, Bt as resolveBucketRegion, C as yellow, Ct as resolveAutoAssetStorage, D as ProviderRegistry, Dt as resolveStateBucketWithDefaultAndSource, E as clearOnUpdateRemoval, Et as resolveStateBucketWithDefault, F as refStateLookupFromResource, Ft as uploadCfnTemplate, G as DagBuilder, H as describeTypeWithThrottleRetry, Ht as getAwsClients, I as WAFv2WebACLProvider, It as expectedOwnerParam, J as S3StateBackend, K as TemplateParser, Kt as CdkdError, L as normalizeAwsTagsToCfn, Lt as AssemblyReader, M as isTerminationProtectionPropagationError, Mt as CFN_TEMPLATE_URL_LIMIT, N as IntrinsicFunctionResolver, Nt as MIGRATE_TMP_PREFIX, O as findActionableSilentDrops, Ot as resolveUseCdkBootstrapAssets, P as cfnRefValueFromPhysicalId, Pt as findLargeInlineResources, Q as stringifyValue, Qt as LocalStartServiceError, R as resolveExplicitPhysicalId, Rt as processStackMessages, S as red, St as resolveApp, T as collectInlinePolicyNamesManagedBySiblings, Tt as resolveSkipPrefix, U as withRetry, Ut as resetAwsClients, V as DiffCalculator, Vt as AwsClients, W as isRetryableTransientError, Wt as setAwsClients, X as shouldRetainResource, Xt as LocalInvokeBuildError$1, Y as rebuildClientForBucketRegion, Yt as DeployCancelledError, Z as AssetPublisher, Zt as LocalMigrateError, _ as formatResourceLine, _t as getDockerImageBySourceHash, a as DeploymentEventsStore, an as ResourceUpdateNotSupportedError, at as BOOTSTRAP_MARKER_PREFIX, b as gray, bt as getDefaultStateBucketName, c as replayFailedOperations, ct as parseBootstrapMarker, d as IMPLICIT_DELETE_DEPENDENCIES, dt as buildDockerImage, en as MissingCdkCliError, et as buildAssetRedirectMap, f as computeImplicitDeleteEdges, fn as normalizeAwsError, ft as formatDockerLoginError, g as renderStatefulReason, gt as AssetManifestLoader, h as isStatefulRecreateTargetSync, ht as runDockerStreaming, i as DeploymentEventsReader, in as ResourceTimeoutError, it as AssetModeResolver, j as disableInstanceApiTermination, jt as CFN_TEMPLATE_BODY_LIMIT, k as CloudControlProvider, kt as stateBucketExistenceConfirmed, l as replayRollback, lt as validateAssetBucketName, m as MULTI_REGION_RECREATE_BLOCKED_TYPES, mt as runDockerForeground, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as PartialFailureError, nt as loadPublishableAssetManifest, o as planFailedOps, on as StackHasActiveImportsError, ot as ensureAssetStorage, p as extractDeploymentEventError, pn as withErrorHandling, pt as getDockerCmd, q as LockManager, r as DeployEngine, rn as ProvisioningError, rt as rewriteTemplateAssetReferences, s as planRollback, sn as StackTerminationProtectionError, st as getBootstrapMarkerKey, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as NestedStackChildDirectDestroyError, tt as createAssetRedirectResolver, u as withResourceDeadline, ut as validateContainerRepoName, v as bold, vt as Synthesizer, w as IAMRoleProvider, wt as resolveCaptureObservedState, x as green, xt as getLegacyStateBucketName, y as cyan, yt as synthesisStatusMessage, z as assertRegionMatch } from "./deploy-engine-rn1TQits.js";
2
+ import { $ as TemplateParser, $t as CdkdError, A as yellow, At as resolveAutoAssetStorage, B as IntrinsicFunctionResolver, Bt as MIGRATE_TMP_PREFIX, C as renderStatefulReason, Ct as AssetManifestLoader, D as gray, Dt as getDefaultStateBucketName, E as cyan, Et as synthesisStatusMessage, F as findActionableSilentDrops, Ft as resolveUseCdkBootstrapAssets, G as resolveExplicitPhysicalId, Gt as processStackMessages, H as refStateLookupFromResource, Ht as uploadCfnTemplate, I as CloudControlProvider, It as stateBucketExistenceConfirmed, J as DiffCalculator, Jt as AwsClients, K as assertRegionMatch, L as slowCcOperationTimeoutMs, Lt as warnDeprecatedNoPrefixCliFlag, M as collectInlinePolicyNamesManagedBySiblings, Mt as resolveSkipPrefix, N as clearOnUpdateRemoval, Nt as resolveStateBucketWithDefault, O as green, Ot as getLegacyStateBucketName, P as ProviderRegistry, Pt as resolveStateBucketWithDefaultAndSource, Q as DagBuilder, R as disableInstanceApiTermination, Rt as CFN_TEMPLATE_BODY_LIMIT, S as isStatefulRecreateTargetSync, St as runDockerStreaming, T as bold, Tt as Synthesizer, U as WAFv2WebACLProvider, Ut as expectedOwnerParam, V as cfnRefValueFromPhysicalId, Vt as findLargeInlineResources, W as normalizeAwsTagsToCfn, Wt as AssemblyReader, X as withRetry, Xt as resetAwsClients, Y as describeTypeWithThrottleRetry, Yt as getAwsClients, Z as isRetryableTransientError, Zt as setAwsClients, _ as createEbsFinalSnapshot, _t as validateContainerRepoName, a as DeploymentEventsStore, an as LocalStartServiceError, at as stringifyValue, b as extractDeploymentEventError, bn as withErrorHandling, bt as getDockerCmd, c as replayFailedOperations, cn as NestedStackChildDirectDestroyError, ct as createAssetRedirectResolver, d as IMPLICIT_DELETE_DEPENDENCIES, dn as ResourceTimeoutError, dt as AssetModeResolver, et as LockManager, f as computeImplicitDeleteEdges, fn as ResourceUpdateNotSupportedError, ft as BOOTSTRAP_MARKER_PREFIX, g as ccRoutedFinalSnapshotError, gt as validateAssetBucketName, h as buildFinalSnapshotIdentifier, ht as parseBootstrapMarker, i as DeploymentEventsReader, in as LocalMigrateError, it as AssetPublisher, j as IAMRoleProvider, jt as resolveCaptureObservedState, k as red, kt as resolveApp, l as replayRollback, ln as PartialFailureError, lt as loadPublishableAssetManifest, m as PRE_DELETE_SNAPSHOT_TYPES, mn as StackTerminationProtectionError, mt as getBootstrapMarkerKey, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as DeployCancelledError, nt as rebuildClientForBucketRegion, o as planFailedOps, ot as WorkGraph, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as StackHasActiveImportsError, pt as ensureAssetStorage, q as applyRoleArnIfSet, qt as resolveBucketRegion, r as DeployEngine, rn as LocalInvokeBuildError$1, rt as shouldRetainResource, s as planRollback, sn as MissingCdkCliError, st as buildAssetRedirectMap, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as S3StateBackend, u as withResourceDeadline, un as ProvisioningError, ut as rewriteTemplateAssetReferences, v as isFinalSnapshotError, vt as buildDockerImage, w as formatResourceLine, wt as getDockerImageBySourceHash, x as MULTI_REGION_RECREATE_BLOCKED_TYPES, xt as runDockerForeground, y as unsupportedFinalSnapshotError, yn as normalizeAwsError, yt as formatDockerLoginError, z as isTerminationProtectionPropagationError, zt as CFN_TEMPLATE_URL_LIMIT } from "./deploy-engine-D5j6_ZH6.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-D6Y0zhd3.js";
4
+ import { t as ASGProvider } from "./asg-provider-zDD6EIRo.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
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";
@@ -707,6 +707,19 @@ const destroyOptions = [
707
707
  new Option("--remove-protection", "Bypass deletion protection on protected resources by flipping the per-resource protection flag off in-place before delete. Covers stack-level terminationProtection (CDK property) and resource-level protection on AWS::Logs::LogGroup, AWS::RDS::DBInstance, AWS::RDS::DBCluster, AWS::DocDB::DBCluster, AWS::Neptune::DBCluster, AWS::Neptune::DBInstance, AWS::DynamoDB::Table, AWS::EC2::Instance, AWS::Cognito::UserPool, AWS::AutoScaling::AutoScalingGroup, AWS::ElasticLoadBalancingV2::LoadBalancer, AWS::DSQL::Cluster, AWS::NeptuneGraph::Graph, AWS::SMSVOICE::ProtectConfiguration, AWS::VerifiedPermissions::PolicyStore, AWS::EKS::Cluster, AWS::RDS::GlobalCluster, and AWS::DocDB::GlobalCluster.").default(false),
708
708
  allowUnsupportedTypesOption
709
709
  ];
710
+ /**
711
+ * `--skip-final-snapshot` (issue #1352) — the explicit data-loss opt-out for
712
+ * `DeletionPolicy: Snapshot` resources. By default the destroy paths honor
713
+ * the policy (CloudFormation parity): an atomic final-snapshot delete
714
+ * parameter for RDS DBInstance / DBCluster, Neptune / DocDB clusters and
715
+ * ElastiCache CacheCluster, a pre-delete EBS `CreateSnapshot`+wait for
716
+ * `AWS::EC2::Volume`, and a refusal for Snapshot-tagged types cdkd cannot
717
+ * snapshot yet (issue #1353). Attached to `cdkd deploy` (template-removal
718
+ * deletes), `cdkd destroy`, and `cdkd state destroy` — NOT to the shared
719
+ * `destroyOptions` array, which `cdkd orphan` also consumes (orphan never
720
+ * deletes AWS resources, so the flag would be inert noise there).
721
+ */
722
+ const skipFinalSnapshotOption = new Option("--skip-final-snapshot", "Delete resources whose DeletionPolicy is 'Snapshot' WITHOUT creating the final snapshot the policy promises (DATA LOSS — explicit opt-out of CloudFormation parity). By default cdkd creates the final snapshot (RDS / Neptune / DocDB / ElastiCache CacheCluster / EC2 Volume) and refuses to delete Snapshot-tagged types it cannot snapshot yet.").default(false);
710
723
 
711
724
  //#endregion
712
725
  //#region src/cli/commands/state-file-keys.ts
@@ -25232,10 +25245,10 @@ var RDSProvider = class {
25232
25245
  "EnableIAMDatabaseAuthentication"
25233
25246
  ])]
25234
25247
  ]);
25235
- unhandledByDesign = /* @__PURE__ */ new Map([["AWS::RDS::DBCluster", /* @__PURE__ */ new Map([["DeleteAutomatedBackups", "cdkd hardcodes SkipFinalSnapshot=true on destroy; this CFn lifecycle flag has no equivalent on the runtime path"]])], ["AWS::RDS::DBInstance", /* @__PURE__ */ new Map([
25248
+ unhandledByDesign = /* @__PURE__ */ new Map([["AWS::RDS::DBCluster", /* @__PURE__ */ new Map([["DeleteAutomatedBackups", "delete-time lifecycle flag not threaded through cdkd destroy; final snapshots are governed by DeletionPolicy: Snapshot (issue #1352), which this flag does not control"]])], ["AWS::RDS::DBInstance", /* @__PURE__ */ new Map([
25236
25249
  ["DBSecurityGroups", "EC2-Classic-only feature retired by AWS (2022-08-15); new accounts cannot use this — use VPCSecurityGroups instead"],
25237
25250
  ["ApplyImmediately", "cdkd always applies modifications immediately (rds:ModifyDBInstance.ApplyImmediately=true is hardcoded); users wanting maintenance-window deferral should run aws rds modify-db-instance directly"],
25238
- ["DeleteAutomatedBackups", "cdkd hardcodes SkipFinalSnapshot=true on destroy; this CFn lifecycle flag has no equivalent on the runtime path"]
25251
+ ["DeleteAutomatedBackups", "delete-time lifecycle flag not threaded through cdkd destroy; final snapshots are governed by DeletionPolicy: Snapshot (issue #1352), which this flag does not control"]
25239
25252
  ])]]);
25240
25253
  getClient() {
25241
25254
  if (!this.rdsClient) this.rdsClient = new RDSClient(this.providerRegion ? { region: this.providerRegion } : {});
@@ -25257,11 +25270,11 @@ var RDSProvider = class {
25257
25270
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
25258
25271
  }
25259
25272
  }
25260
- async delete(logicalId, physicalId, resourceType, _properties, context) {
25273
+ async delete(logicalId, physicalId, resourceType, properties, context) {
25261
25274
  switch (resourceType) {
25262
25275
  case "AWS::RDS::DBSubnetGroup": return this.deleteDBSubnetGroup(logicalId, physicalId, resourceType, context);
25263
25276
  case "AWS::RDS::DBCluster": return this.deleteDBCluster(logicalId, physicalId, resourceType, context);
25264
- case "AWS::RDS::DBInstance": return this.deleteDBInstance(logicalId, physicalId, resourceType, context);
25277
+ case "AWS::RDS::DBInstance": return this.deleteDBInstance(logicalId, physicalId, resourceType, properties, context);
25265
25278
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
25266
25279
  }
25267
25280
  }
@@ -25465,10 +25478,15 @@ var RDSProvider = class {
25465
25478
  } catch (disableError) {
25466
25479
  if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(`Could not disable deletion protection for ${physicalId}: ${disableError instanceof Error ? disableError.message : String(disableError)}`);
25467
25480
  }
25481
+ const finalSnapshotId = context?.finalSnapshotIdentifier;
25468
25482
  await this.getClient().send(new DeleteDBClusterCommand({
25469
25483
  DBClusterIdentifier: physicalId,
25470
- SkipFinalSnapshot: true
25484
+ ...finalSnapshotId ? {
25485
+ SkipFinalSnapshot: false,
25486
+ FinalDBSnapshotIdentifier: finalSnapshotId
25487
+ } : { SkipFinalSnapshot: true }
25471
25488
  }));
25489
+ if (finalSnapshotId) this.logger.info(`Deleting DBCluster ${logicalId} with final snapshot ${finalSnapshotId} (DeletionPolicy: Snapshot)`);
25472
25490
  this.logger.debug(`Successfully initiated deletion of DBCluster ${logicalId}`);
25473
25491
  await this.waitForClusterDeleted(physicalId);
25474
25492
  } catch (error) {
@@ -25574,7 +25592,7 @@ var RDSProvider = class {
25574
25592
  throw new ProvisioningError(`Failed to update DBInstance ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
25575
25593
  }
25576
25594
  }
25577
- async deleteDBInstance(logicalId, physicalId, resourceType, context) {
25595
+ async deleteDBInstance(logicalId, physicalId, resourceType, properties, context) {
25578
25596
  this.logger.debug(`Deleting DBInstance ${logicalId}: ${physicalId}`);
25579
25597
  try {
25580
25598
  if (context?.removeProtection === true) try {
@@ -25587,10 +25605,15 @@ var RDSProvider = class {
25587
25605
  } catch (disableError) {
25588
25606
  if (!this.isNotFoundError(disableError, "DBInstanceNotFoundFault")) this.logger.debug(`Could not disable deletion protection for ${physicalId}: ${disableError instanceof Error ? disableError.message : String(disableError)}`);
25589
25607
  }
25608
+ const finalSnapshotId = properties?.["DBClusterIdentifier"] === void 0 ? context?.finalSnapshotIdentifier : void 0;
25590
25609
  await this.getClient().send(new DeleteDBInstanceCommand({
25591
25610
  DBInstanceIdentifier: physicalId,
25592
- SkipFinalSnapshot: true
25611
+ ...finalSnapshotId ? {
25612
+ SkipFinalSnapshot: false,
25613
+ FinalDBSnapshotIdentifier: finalSnapshotId
25614
+ } : { SkipFinalSnapshot: true }
25593
25615
  }));
25616
+ if (finalSnapshotId) this.logger.info(`Deleting DBInstance ${logicalId} with final snapshot ${finalSnapshotId} (DeletionPolicy: Snapshot)`);
25594
25617
  this.logger.debug(`Successfully initiated deletion of DBInstance ${logicalId}`);
25595
25618
  await this.waitForInstanceDeleted(physicalId);
25596
25619
  } catch (error) {
@@ -27106,10 +27129,15 @@ var DocDBProvider = class {
27106
27129
  } catch (disableError) {
27107
27130
  if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(`Could not disable deletion protection for ${physicalId}: ${disableError instanceof Error ? disableError.message : String(disableError)}`);
27108
27131
  }
27132
+ const finalSnapshotId = context?.finalSnapshotIdentifier;
27109
27133
  await this.getClient().send(new DeleteDBClusterCommand$1({
27110
27134
  DBClusterIdentifier: physicalId,
27111
- SkipFinalSnapshot: true
27135
+ ...finalSnapshotId ? {
27136
+ SkipFinalSnapshot: false,
27137
+ FinalDBSnapshotIdentifier: finalSnapshotId
27138
+ } : { SkipFinalSnapshot: true }
27112
27139
  }));
27140
+ if (finalSnapshotId) this.logger.info(`Deleting DocDB DBCluster ${logicalId} with final snapshot ${finalSnapshotId} (DeletionPolicy: Snapshot)`);
27113
27141
  this.logger.debug(`Successfully initiated deletion of DocDB DBCluster ${logicalId}`);
27114
27142
  await this.waitForClusterDeleted(physicalId);
27115
27143
  } catch (error) {
@@ -27731,10 +27759,15 @@ var NeptuneProvider = class {
27731
27759
  } catch (disableError) {
27732
27760
  if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(`Could not disable deletion protection for ${physicalId}: ${disableError instanceof Error ? disableError.message : String(disableError)}`);
27733
27761
  }
27762
+ const finalSnapshotId = context?.finalSnapshotIdentifier;
27734
27763
  await this.getClient().send(new DeleteDBClusterCommand$2({
27735
27764
  DBClusterIdentifier: physicalId,
27736
- SkipFinalSnapshot: true
27765
+ ...finalSnapshotId ? {
27766
+ SkipFinalSnapshot: false,
27767
+ FinalDBSnapshotIdentifier: finalSnapshotId
27768
+ } : { SkipFinalSnapshot: true }
27737
27769
  }));
27770
+ if (finalSnapshotId) this.logger.info(`Deleting Neptune DBCluster ${logicalId} with final snapshot ${finalSnapshotId} (DeletionPolicy: Snapshot)`);
27738
27771
  this.logger.debug(`Successfully initiated deletion of Neptune DBCluster ${logicalId}`);
27739
27772
  await this.waitForClusterDeleted(physicalId);
27740
27773
  } catch (error) {
@@ -29646,7 +29679,12 @@ var ElastiCacheProvider = class {
29646
29679
  async deleteCacheCluster(logicalId, physicalId, resourceType, context) {
29647
29680
  this.logger.debug(`Deleting CacheCluster ${logicalId}: ${physicalId}`);
29648
29681
  try {
29649
- await this.getClient().send(new DeleteCacheClusterCommand({ CacheClusterId: physicalId }));
29682
+ const finalSnapshotId = context?.finalSnapshotIdentifier;
29683
+ await this.getClient().send(new DeleteCacheClusterCommand({
29684
+ CacheClusterId: physicalId,
29685
+ ...finalSnapshotId ? { FinalSnapshotIdentifier: finalSnapshotId } : {}
29686
+ }));
29687
+ if (finalSnapshotId) this.logger.info(`Deleting CacheCluster ${logicalId} with final snapshot ${finalSnapshotId} (DeletionPolicy: Snapshot)`);
29650
29688
  this.logger.debug(`Successfully initiated deletion of CacheCluster ${logicalId}`);
29651
29689
  await this.waitForClusterDeleted(physicalId);
29652
29690
  } catch (error) {
@@ -42784,6 +42822,11 @@ async function runDestroyForStack(stackName, state, ctx) {
42784
42822
  ...resource.provisionedBy && { provisionedBy: resource.provisionedBy }
42785
42823
  });
42786
42824
  try {
42825
+ let finalSnapshotIdentifier;
42826
+ if (resource.deletionPolicy === "Snapshot" && ctx.skipFinalSnapshot !== true) if (ATOMIC_FINAL_SNAPSHOT_TYPES.has(resource.resourceType) && resource.provisionedBy !== "cc-api") finalSnapshotIdentifier = buildFinalSnapshotIdentifier(resource.physicalId, resource.resourceType);
42827
+ else if (ATOMIC_FINAL_SNAPSHOT_TYPES.has(resource.resourceType)) throw ccRoutedFinalSnapshotError(logicalId, resource.resourceType, "--skip-final-snapshot");
42828
+ else if (PRE_DELETE_SNAPSHOT_TYPES.has(resource.resourceType)) await createEbsFinalSnapshot((destroyAwsClients ?? ctx.baseAwsClients).ec2, resource.physicalId, logicalId, logger);
42829
+ else throw unsupportedFinalSnapshotError(logicalId, resource.resourceType, "--skip-final-snapshot");
42787
42830
  const provider = destroyProviderRegistry.getProviderFor({
42788
42831
  resourceType: resource.resourceType,
42789
42832
  provisionedBy: resource.provisionedBy
@@ -42799,7 +42842,8 @@ async function runDestroyForStack(stackName, state, ctx) {
42799
42842
  for (let attempt = 0; attempt <= maxAttempts; attempt++) try {
42800
42843
  await provider.delete(logicalId, resource.physicalId, resource.resourceType, resource.properties, {
42801
42844
  ...state.region !== void 0 && { expectedRegion: state.region },
42802
- ...ctx.removeProtection === true && { removeProtection: true }
42845
+ ...ctx.removeProtection === true && { removeProtection: true },
42846
+ ...finalSnapshotIdentifier !== void 0 && { finalSnapshotIdentifier }
42803
42847
  });
42804
42848
  lastDeleteError = null;
42805
42849
  break;
@@ -42842,7 +42886,7 @@ async function runDestroyForStack(stackName, state, ctx) {
42842
42886
  } catch (error) {
42843
42887
  renderer.removeTask(logicalId);
42844
42888
  const msg = error instanceof Error ? error.message : String(error);
42845
- if (msg.includes("does not exist") || msg.includes("not found") || msg.includes("No policy found") || msg.includes("NoSuchEntity") || msg.includes("NotFoundException")) {
42889
+ if (!isFinalSnapshotError(error) && (msg.includes("does not exist") || msg.includes("not found") || msg.includes("No policy found") || msg.includes("NoSuchEntity") || msg.includes("NotFoundException"))) {
42846
42890
  logger.debug(` ${logicalId} already deleted, removing from state`);
42847
42891
  result.deletedCount++;
42848
42892
  ctx.eventRecorder?.record({
@@ -43145,6 +43189,7 @@ var NestedStackProvider = class {
43145
43189
  ...ctx.exportIndexStore && { exportIndexStore: ctx.exportIndexStore },
43146
43190
  ...ctx.destroyOptions?.profile && { profile: ctx.destroyOptions.profile },
43147
43191
  ...deleteContext?.removeProtection === true && { removeProtection: true },
43192
+ ...(ctx.destroyOptions?.skipFinalSnapshot === true || ctx.options?.skipFinalSnapshot === true) && { skipFinalSnapshot: true },
43148
43193
  ...ctx.destroyOptions?.resourceWarnAfterMs !== void 0 && { resourceWarnAfterMs: ctx.destroyOptions.resourceWarnAfterMs },
43149
43194
  ...ctx.destroyOptions?.resourceTimeoutMs !== void 0 && { resourceTimeoutMs: ctx.destroyOptions.resourceTimeoutMs },
43150
43195
  ...ctx.destroyOptions?.resourceWarnAfterByType && { resourceWarnAfterByType: ctx.destroyOptions.resourceWarnAfterByType },
@@ -44258,6 +44303,8 @@ async function deployCommand(stacks, options) {
44258
44303
  ...recreateViaSdkProviderTargets && recreateViaSdkProviderTargets.size > 0 && { recreateViaSdkProviderTargets },
44259
44304
  ...options.replace && { replace: true },
44260
44305
  ...options.forceStatefulRecreation && { forceStatefulRecreation: true },
44306
+ ...options.skipFinalSnapshot && { skipFinalSnapshot: true },
44307
+ finalSnapshotEc2: stackAwsClients.ec2,
44261
44308
  ...options.strictGetatt && { strictGetAtt: true },
44262
44309
  captureObservedState: resolveCaptureObservedState(options.captureObservedState),
44263
44310
  ...options.resourceWarnAfter?.globalMs !== void 0 && { resourceWarnAfterMs: options.resourceWarnAfter.globalMs },
@@ -44348,6 +44395,7 @@ function createDeployCommand() {
44348
44395
  ...stateOptions,
44349
44396
  ...stackOptions,
44350
44397
  ...deployOptions,
44398
+ skipFinalSnapshotOption,
44351
44399
  ...contextOptions,
44352
44400
  ...annotationMessageOptions
44353
44401
  ].forEach((opt) => cmd.addOption(opt));
@@ -47133,6 +47181,7 @@ async function destroyCommand(stackArgs, options) {
47133
47181
  destroyOptions: {
47134
47182
  ...options.profile && { profile: options.profile },
47135
47183
  ...options.removeProtection === true && { removeProtection: true },
47184
+ ...options.skipFinalSnapshot === true && { skipFinalSnapshot: true },
47136
47185
  ...options.resourceWarnAfter?.globalMs !== void 0 && { resourceWarnAfterMs: options.resourceWarnAfter.globalMs },
47137
47186
  ...options.resourceTimeout?.globalMs !== void 0 && { resourceTimeoutMs: options.resourceTimeout.globalMs },
47138
47187
  ...options.resourceWarnAfter?.perTypeMs && { resourceWarnAfterByType: options.resourceWarnAfter.perTypeMs },
@@ -47148,6 +47197,7 @@ async function destroyCommand(stackArgs, options) {
47148
47197
  stateBucket,
47149
47198
  skipConfirmation: options.yes || options.force,
47150
47199
  removeProtection: options.removeProtection === true,
47200
+ skipFinalSnapshot: options.skipFinalSnapshot === true,
47151
47201
  exportIndexStore,
47152
47202
  ...options.allowUnsupportedTypes?.length && { allowUnsupportedTypes: options.allowUnsupportedTypes },
47153
47203
  ...options.resourceWarnAfter?.globalMs !== void 0 && { resourceWarnAfterMs: options.resourceWarnAfter.globalMs },
@@ -47203,6 +47253,7 @@ function createDestroyCommand() {
47203
47253
  ...stackOptions,
47204
47254
  ...destroyOptions,
47205
47255
  ...resourceTimeoutOptions,
47256
+ skipFinalSnapshotOption,
47206
47257
  ...contextOptions
47207
47258
  ].forEach((opt) => cmd.addOption(opt));
47208
47259
  cmd.addOption(deprecatedRegionOption);
@@ -50615,6 +50666,7 @@ async function stateDestroyCommand(stackArgs, options) {
50615
50666
  destroyOptions: {
50616
50667
  ...options.profile && { profile: options.profile },
50617
50668
  ...options.removeProtection === true && { removeProtection: true },
50669
+ ...options.skipFinalSnapshot === true && { skipFinalSnapshot: true },
50618
50670
  ...options.resourceWarnAfter?.globalMs !== void 0 && { resourceWarnAfterMs: options.resourceWarnAfter.globalMs },
50619
50671
  ...options.resourceTimeout?.globalMs !== void 0 && { resourceTimeoutMs: options.resourceTimeout.globalMs },
50620
50672
  ...options.resourceWarnAfter?.perTypeMs && { resourceWarnAfterByType: options.resourceWarnAfter.perTypeMs },
@@ -50630,6 +50682,7 @@ async function stateDestroyCommand(stackArgs, options) {
50630
50682
  stateBucket: setup.bucket,
50631
50683
  skipConfirmation: options.yes || options.all === true,
50632
50684
  removeProtection: options.removeProtection === true,
50685
+ skipFinalSnapshot: options.skipFinalSnapshot === true,
50633
50686
  exportIndexStore: setup.exportIndexStore,
50634
50687
  ...options.allowUnsupportedTypes?.length && { allowUnsupportedTypes: options.allowUnsupportedTypes },
50635
50688
  ...options.resourceWarnAfter?.globalMs !== void 0 && { resourceWarnAfterMs: options.resourceWarnAfter.globalMs },
@@ -50669,7 +50722,8 @@ function createStateDestroyCommand() {
50669
50722
  ...commonOptions,
50670
50723
  ...stateOptions,
50671
50724
  ...resourceTimeoutOptions,
50672
- allowUnsupportedTypesOption
50725
+ allowUnsupportedTypesOption,
50726
+ skipFinalSnapshotOption
50673
50727
  ].forEach((opt) => cmd.addOption(opt));
50674
50728
  cmd.addOption(deprecatedRegionOption);
50675
50729
  return cmd;
@@ -63649,7 +63703,7 @@ function createMigrateCommand() {
63649
63703
  */
63650
63704
  function buildProgram() {
63651
63705
  const program = new Command();
63652
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.275.5");
63706
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.275.6");
63653
63707
  program.hook("preAction", (_thisCommand, actionCommand) => {
63654
63708
  const { profile } = actionCommand.optsWithGlobals();
63655
63709
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;