@go-to-k/cdkd 0.288.0 → 0.288.2

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.
@@ -1,8 +1,8 @@
1
- import { $ as createMaskedRetryLogger, $n as runDockerStreaming, $r as StackTerminationProtectionError, $t as carriesSecretMask, A as WARM_THROUGHPUT_MEMBERS, An as rewriteTemplateAssetReferences, At as replayWarn, B as yellow, Bn as validateContainerRepoName, Bt as s3BucketWebsiteUrl, C as unsupportedFinalSnapshotError, Cn as shouldRetainResource, Cr as displaySafe, Ct as normalizeAwsTagsToCfn, D as isStatefulRecreateTargetForReplace, Dn as buildAssetRedirectMap, Dr as derivePartitionAndUrlSuffix, Dt as configBooleanRefusal, E as MULTI_REGION_RECREATE_BLOCKED_TYPES, En as WorkGraph, Er as canonicalizeRegion, Et as coerceCfnBoolean, F as bold, Fn as getBootstrapMarkerKey, Fr as setAwsClients, Ft as producerRegionsFromState, G as secretBearingStateKeyWarning, Gn as describeDockerExecFailure, Gr as LocalStartServiceError, Gt as findSilentDropProperties, H as collectPublishedOutputNames, Hn as describeAwsFailure, Hr as DynamicReferenceRegionAmbiguousError, Ht as DiffCalculator, I as cyan, In as isCrossRegionRedirect, It as s3BucketArn, J as IAMRoleProvider, Jn as formatDockerLoginError, Jr as PartialFailureError, Jt as DagBuilder, K as stateKeySecretExposure, Kn as describeDockerFailure, Kt as describeTypeWithThrottleRetry, L as gray, Ln as parseBootstrapMarker, Lr as CdkdError, Lt as s3BucketDomainName, M as isWarmThroughputDecrease, Mn as BOOTSTRAP_MARKER_PREFIX, Mr as AwsClients, Mt as requireConfigObject, N as toFiniteNumber, Nn as assertAssetBucketRegion, Nr as getAwsClients, Nt as requireConfigString, O as isStatefulRecreateTargetSync, On as createAssetRedirectResolver, Or as AssemblyReader, Ot as configStringRefusal, P as formatResourceLine, Pn as ensureAssetStorage, Pr as resetAwsClients, Pt as classifyReplaySecretRegion, Q as wouldReturnToSdkProvider, Qn as runDockerForeground, Qr as StackHasActiveImportsError, Qt as TEMPLATE_SOURCED_RULES, R as green, Rn as readBootstrapMarkerBody, Rt as s3BucketDualStackDomainName, S as refusesFinalSnapshot, Sn as importableOutputs, Sr as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, St as WAFv2WebACLProvider, T as extractDeploymentEventError, Tn as stringifyValue, Tr as PARTITION_TABLE, Tt as assertRegionMatch, U as exportAliasCollisionScrubWarning, Un as buildDockerImage, Ur as IntrinsicResolutionRefusalError, Ut as INTRINSIC_KEYS, V as collectDeclaredOutputNames, Vn as buildDenyExternalAccessPolicy, Vr as DeployCancelledError, Vt as applyRoleArnIfSet, W as isExportAliasCollision, Wn as describeDockerCapturedOutput, Wr as LocalInvokeBuildError$1, Wt as findActionableSilentDrops, X as clearOnUpdateRemoval, Xn as partitionSensitiveEnv, Xr as ResourceTimeoutError, Xt as STATE_SOURCED_CROSS_GENERATION_RULES, Y as collectInlinePolicyNamesManagedBySiblings, Yn as getDockerCmd, Yr as ProvisioningError, Yt as TemplateParser, Z as ProviderRegistry, Zn as redactDockerArgvValues, Zr as ResourceUpdateNotSupportedError, Zt as STATE_SOURCED_READBACK_RULES, _ as PRE_DELETE_SNAPSHOT_TYPES, _n as shellQuote, _r as CFN_TEMPLATE_BODY_LIMIT, _t as coerceParameterTypedValue, a as DeploymentEventsStore, ai as withErrorHandling, an as maskSecretsInText, ar as synthesisStatusMessage, at as isInterruptedWaitError, b as createPreDeleteFinalSnapshot, bn as exportNamesCarriedFrom, br as findLargeInlineResources, bt as parameterTypeMayLoseSecretIdentity, c as replayFailedOperations, ci as isThrottlingError, cn as redactSecretsForState, cr as resolveApp, ct as slowCcOperationTimeoutMs, d as updatePartialReason, di as markRedactedCause, dn as S3StateBackend, dr as resolveSkipPrefix, dt as deleteSkipReason, en as createSecretMasker, er as escapeRegExp, et as maskDeep, f as withResourceDeadline, fi as retryClassificationText, fn as rebuildClientForBucketRegion, fr as resolveStateBucketWithDefault, ft as disableInstanceApiTermination, g as ATOMIC_FINAL_SNAPSHOT_TYPES, gn as forceQuitRecoveryClause, gr as warnDeprecatedNoPrefixCliFlag, gt as cfnRefValueFromPhysicalId, h as computeImplicitDeleteEdges, hn as buildLockContentionMessage, hr as stateBucketExistenceConfirmed, ht as carriesDynamicReference, i as DeploymentEventsReader, ii as normalizeAwsError, in as maskSecretsInError, ir as Synthesizer, it as interruptWatchListenerCount, j as coerceWarmThroughput$1, jn as AssetModeResolver, jr as resolveBucketRegion, jt as requireConfigArray, k as renderStatefulReason, kn as loadPublishableAssetManifest, kr as processStackMessages, kt as readConfigString, l as replayRollback, li as isTransientServerError, ln as scrubResourceRecord, lr as resolveAutoAssetStorage, lt as UNSPECIFIED_SKIP_REASON, m as IMPLICIT_DELETE_DEPENDENCIES, mn as buildForceUnlockCommand, mr as resolveUseCdkBootstrapAssets, mt as IntrinsicFunctionResolver, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as errorCauseChain, nr as AssetManifestLoader, nt as beginCommandInterruptScope, o as planFailedOps, oi as isMarkedNonRetryable, on as recordMaskOnlyValue, or as getDefaultStateBucketName, ot as startInterruptWatch, p as maskingRetryLogger, pn as UNRENDERABLE, pr as resolveStateBucketWithDefaultAndSource, pt as isTerminationProtectionPropagationError, q as getCurrentResourceSecrets, qn as dockerSpawnEnvWithSensitive, qr as NestedStackChildDirectDestroyError, qt as withRetry, r as DeployEngine, rn as isSingleDynamicReferenceToken, rr as getDockerImageBySourceHash, rt as endCommandInterruptScope, s as planRollback, si as isRetryableTransientError, sn as recoverMaskedOutput, sr as getLegacyStateBucketName, st as CloudControlProvider, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as dynamicReferenceTokens, tr as stripControlChars, tt as maskerOrIdentity, u as updatePartialMessage, ui as markNonRetryable, un as LockManager, ur as resolveCaptureObservedState, ut as deleteIndeterminateGuards, v as buildFinalSnapshotIdentifier, vn as CUSTOM_RESOURCE_RESPONSE_PREFIX, vr as CFN_TEMPLATE_URL_LIMIT, vt as getAccountInfo, w as makeCanonicalizePropertiesFn, wn as AssetPublisher, wr as expectedOwnerParam, wt as resolveExplicitPhysicalId, x as isFinalSnapshotError, xn as importableOutputKeys, xr as uploadCfnTemplate, xt as refStateLookupFromResource, y as ccRoutedFinalSnapshotError, yn as DEFAULT_STATE_PREFIX, yr as MIGRATE_TMP_PREFIX, yt as isUnboundTemplateParameter, z as red, zn as validateAssetBucketName, zr as CrossAccountSecretRefusalError, zt as s3BucketRegionalDomainName } from "./deploy-engine-DF3fAY6q.js";
1
+ import { $ as createMaskedRetryLogger, $n as runDockerStreaming, $r as StackTerminationProtectionError, $t as carriesSecretMask, A as WARM_THROUGHPUT_MEMBERS, An as rewriteTemplateAssetReferences, At as replayWarn, B as yellow, Bn as validateContainerRepoName, Bt as s3BucketWebsiteUrl, C as unsupportedFinalSnapshotError, Cn as shouldRetainResource, Cr as displaySafe, Ct as normalizeAwsTagsToCfn, D as isStatefulRecreateTargetForReplace, Dn as buildAssetRedirectMap, Dr as derivePartitionAndUrlSuffix, Dt as configBooleanRefusal, E as MULTI_REGION_RECREATE_BLOCKED_TYPES, En as WorkGraph, Er as canonicalizeRegion, Et as coerceCfnBoolean, F as bold, Fn as getBootstrapMarkerKey, Fr as setAwsClients, Ft as producerRegionsFromState, G as secretBearingStateKeyWarning, Gn as describeDockerExecFailure, Gr as LocalStartServiceError, Gt as findSilentDropProperties, H as collectPublishedOutputNames, Hn as describeAwsFailure, Hr as DynamicReferenceRegionAmbiguousError, Ht as DiffCalculator, I as cyan, In as isCrossRegionRedirect, It as s3BucketArn, J as IAMRoleProvider, Jn as formatDockerLoginError, Jr as PartialFailureError, Jt as DagBuilder, K as stateKeySecretExposure, Kn as describeDockerFailure, Kt as describeTypeWithThrottleRetry, L as gray, Ln as parseBootstrapMarker, Lr as CdkdError, Lt as s3BucketDomainName, M as isWarmThroughputDecrease, Mn as BOOTSTRAP_MARKER_PREFIX, Mr as AwsClients, Mt as requireConfigObject, N as toFiniteNumber, Nn as assertAssetBucketRegion, Nr as getAwsClients, Nt as requireConfigString, O as isStatefulRecreateTargetSync, On as createAssetRedirectResolver, Or as AssemblyReader, Ot as configStringRefusal, P as formatResourceLine, Pn as ensureAssetStorage, Pr as resetAwsClients, Pt as classifyReplaySecretRegion, Q as wouldReturnToSdkProvider, Qn as runDockerForeground, Qr as StackHasActiveImportsError, Qt as TEMPLATE_SOURCED_RULES, R as green, Rn as readBootstrapMarkerBody, Rt as s3BucketDualStackDomainName, S as refusesFinalSnapshot, Sn as importableOutputs, Sr as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, St as WAFv2WebACLProvider, T as extractDeploymentEventError, Tn as stringifyValue, Tr as PARTITION_TABLE, Tt as assertRegionMatch, U as exportAliasCollisionScrubWarning, Un as buildDockerImage, Ur as IntrinsicResolutionRefusalError, Ut as INTRINSIC_KEYS, V as collectDeclaredOutputNames, Vn as buildDenyExternalAccessPolicy, Vr as DeployCancelledError, Vt as applyRoleArnIfSet, W as isExportAliasCollision, Wn as describeDockerCapturedOutput, Wr as LocalInvokeBuildError$1, Wt as findActionableSilentDrops, X as clearOnUpdateRemoval, Xn as partitionSensitiveEnv, Xr as ResourceTimeoutError, Xt as STATE_SOURCED_CROSS_GENERATION_RULES, Y as collectInlinePolicyNamesManagedBySiblings, Yn as getDockerCmd, Yr as ProvisioningError, Yt as TemplateParser, Z as ProviderRegistry, Zn as redactDockerArgvValues, Zr as ResourceUpdateNotSupportedError, Zt as STATE_SOURCED_READBACK_RULES, _ as PRE_DELETE_SNAPSHOT_TYPES, _n as shellQuote, _r as CFN_TEMPLATE_BODY_LIMIT, _t as coerceParameterTypedValue, a as DeploymentEventsStore, ai as withErrorHandling, an as maskSecretsInText, ar as synthesisStatusMessage, at as isInterruptedWaitError, b as createPreDeleteFinalSnapshot, bn as exportNamesCarriedFrom, br as findLargeInlineResources, bt as parameterTypeMayLoseSecretIdentity, c as replayFailedOperations, ci as isThrottlingError, cn as redactSecretsForState, cr as resolveApp, ct as slowCcOperationTimeoutMs, d as updatePartialReason, di as markRedactedCause, dn as S3StateBackend, dr as resolveSkipPrefix, dt as deleteSkipReason, en as createSecretMasker, er as escapeRegExp, et as maskDeep, f as withResourceDeadline, fi as retryClassificationText, fn as rebuildClientForBucketRegion, fr as resolveStateBucketWithDefault, ft as disableInstanceApiTermination, g as ATOMIC_FINAL_SNAPSHOT_TYPES, gn as forceQuitRecoveryClause, gr as warnDeprecatedNoPrefixCliFlag, gt as cfnRefValueFromPhysicalId, h as computeImplicitDeleteEdges, hn as buildLockContentionMessage, hr as stateBucketExistenceConfirmed, ht as carriesDynamicReference, i as DeploymentEventsReader, ii as normalizeAwsError, in as maskSecretsInError, ir as Synthesizer, it as interruptWatchListenerCount, j as coerceWarmThroughput$1, jn as AssetModeResolver, jr as resolveBucketRegion, jt as requireConfigArray, k as renderStatefulReason, kn as loadPublishableAssetManifest, kr as processStackMessages, kt as readConfigString, l as replayRollback, li as isTransientServerError, ln as scrubResourceRecord, lr as resolveAutoAssetStorage, lt as UNSPECIFIED_SKIP_REASON, m as IMPLICIT_DELETE_DEPENDENCIES, mn as buildForceUnlockCommand, mr as resolveUseCdkBootstrapAssets, mt as IntrinsicFunctionResolver, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as errorCauseChain, nr as AssetManifestLoader, nt as beginCommandInterruptScope, o as planFailedOps, oi as isMarkedNonRetryable, on as recordMaskOnlyValue, or as getDefaultStateBucketName, ot as startInterruptWatch, p as maskingRetryLogger, pn as UNRENDERABLE, pr as resolveStateBucketWithDefaultAndSource, pt as isTerminationProtectionPropagationError, q as getCurrentResourceSecrets, qn as dockerSpawnEnvWithSensitive, qr as NestedStackChildDirectDestroyError, qt as withRetry, r as DeployEngine, rn as isSingleDynamicReferenceToken, rr as getDockerImageBySourceHash, rt as endCommandInterruptScope, s as planRollback, si as isRetryableTransientError, sn as recoverMaskedOutput, sr as getLegacyStateBucketName, st as CloudControlProvider, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as dynamicReferenceTokens, tr as stripControlChars, tt as maskerOrIdentity, u as updatePartialMessage, ui as markNonRetryable, un as LockManager, ur as resolveCaptureObservedState, ut as deleteIndeterminateGuards, v as buildFinalSnapshotIdentifier, vn as CUSTOM_RESOURCE_RESPONSE_PREFIX, vr as CFN_TEMPLATE_URL_LIMIT, vt as getAccountInfo, w as makeCanonicalizePropertiesFn, wn as AssetPublisher, wr as expectedOwnerParam, wt as resolveExplicitPhysicalId, x as isFinalSnapshotError, xn as importableOutputKeys, xr as uploadCfnTemplate, xt as refStateLookupFromResource, y as ccRoutedFinalSnapshotError, yn as DEFAULT_STATE_PREFIX, yr as MIGRATE_TMP_PREFIX, yt as isUnboundTemplateParameter, z as red, zn as validateAssetBucketName, zr as CrossAccountSecretRefusalError, zt as s3BucketRegionalDomainName } from "./deploy-engine-Cxt3gn8N.js";
2
2
  import { _ as withStackName, c as PATTERN_B_NAME_OPTIONS, f as generateResourceName, g as withSkipPrefix, i as reserveStdoutForPayload, l as PATTERN_B_NAME_PROPERTIES, m as getCurrentStackName, n as getLogger, o as runStackBuffered, p as generateResourceNameWithFallback, s as getLiveRenderer, u as PATTERN_B_RESOURCE_TYPES } from "./logger-Dw-3y48G.js";
3
3
  import { t as awsClientDefaults } from "./aws-client-defaults-D-iYiIJ6.js";
4
- import { t as getCdkdVersion } from "./version-BQMDIEQY.js";
5
- import { r as protectedReplacementAdvice, t as ASGProvider } from "./asg-provider-DQCVYO5-.js";
4
+ import { t as getCdkdVersion } from "./version-BRByznpy.js";
5
+ import { r as protectedReplacementAdvice, t as ASGProvider } from "./asg-provider-DUlRn84u.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { createHash, randomBytes, randomUUID } from "node:crypto";
8
8
  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, NotFound, 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";
@@ -1780,15 +1780,16 @@ async function bootstrapCommand(options) {
1780
1780
  });
1781
1781
  }
1782
1782
  let skipStateBucketConfig = false;
1783
- if (bucketExists) if (!options.force) {
1784
- if (!options.assets) {
1785
- logger.warn(`Bucket ${bucketName} already exists. Use --force to reconfigure (this will not delete existing state)`);
1786
- return;
1787
- }
1788
- logger.info(`State bucket ${bucketName} already exists — skipping reconfiguration (use --force to reconfigure)`);
1789
- skipStateBucketConfig = true;
1790
- } else logger.info("--force specified, continuing with existing bucket");
1791
- else {
1783
+ if (bucketExists) {
1784
+ if (!options.force) {
1785
+ if (!options.assets) {
1786
+ logger.warn(`Bucket ${bucketName} already exists. Use --force to reconfigure (this will not delete existing state)`);
1787
+ return;
1788
+ }
1789
+ logger.info(`State bucket ${bucketName} already exists — skipping reconfiguration (use --force to reconfigure)`);
1790
+ skipStateBucketConfig = true;
1791
+ } else logger.info("--force specified, continuing with existing bucket");
1792
+ } else {
1792
1793
  logger.info(`Creating S3 bucket: ${bucketName} in region ${region}`);
1793
1794
  const createBucketParams = { Bucket: bucketName };
1794
1795
  if (region !== "us-east-1") createBucketParams.CreateBucketConfiguration = { LocationConstraint: region };
@@ -4173,7 +4174,8 @@ var IAMPolicyProvider = class {
4173
4174
  };
4174
4175
  }
4175
4176
  const onNotFound = async (target) => {
4176
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, `${physicalId} (${target})`);
4177
+ const clientRegion = await this.iamClient.config.region();
4178
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, `${physicalId} (${target})`);
4177
4179
  };
4178
4180
  try {
4179
4181
  if (legacyRoleFromPhysicalId) {
@@ -4493,7 +4495,8 @@ var IAMManagedPolicyProvider = class {
4493
4495
  await this.iamClient.send(new GetPolicyCommand({ PolicyArn: physicalId }));
4494
4496
  } catch (error) {
4495
4497
  if (error instanceof NoSuchEntityException) {
4496
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
4498
+ const clientRegion = await this.iamClient.config.region();
4499
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
4497
4500
  this.logger.debug(`Managed policy ${physicalId} does not exist, skipping deletion`);
4498
4501
  return;
4499
4502
  }
@@ -4970,7 +4973,8 @@ var IAMInstanceProfileProvider = class {
4970
4973
  roles = (await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }))).InstanceProfile?.Roles?.map((r) => r.RoleName).filter((name) => !!name) || [];
4971
4974
  } catch (error) {
4972
4975
  if (error instanceof NoSuchEntityException) {
4973
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
4976
+ const clientRegion = await this.iamClient.config.region();
4977
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
4974
4978
  this.logger.debug(`Instance profile ${physicalId} does not exist, skipping deletion`);
4975
4979
  return;
4976
4980
  }
@@ -4989,7 +4993,8 @@ var IAMInstanceProfileProvider = class {
4989
4993
  this.logger.debug(`Successfully deleted IAM instance profile ${logicalId}`);
4990
4994
  } catch (error) {
4991
4995
  if (error instanceof NoSuchEntityException) {
4992
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
4996
+ const clientRegion = await this.iamClient.config.region();
4997
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
4993
4998
  this.logger.debug(`Instance profile ${physicalId} does not exist, skipping deletion`);
4994
4999
  return;
4995
5000
  }
@@ -5390,7 +5395,8 @@ var IAMAccessKeyProvider = class {
5390
5395
  this.logger.debug(`Successfully deleted IAM access key ${logicalId}`);
5391
5396
  } catch (error) {
5392
5397
  if (error instanceof NoSuchEntityException) {
5393
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
5398
+ const clientRegion = await this.iamClient.config.region();
5399
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
5394
5400
  this.logger.debug(`Access key ${physicalId} does not exist, skipping deletion`);
5395
5401
  return;
5396
5402
  }
@@ -5719,7 +5725,8 @@ var IAMUserGroupProvider = class {
5719
5725
  await this.iamClient.send(new GetUserCommand({ UserName: physicalId }));
5720
5726
  } catch (error) {
5721
5727
  if (error instanceof NoSuchEntityException) {
5722
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
5728
+ const clientRegion = await this.iamClient.config.region();
5729
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
5723
5730
  this.logger.debug(`User ${physicalId} does not exist, skipping deletion`);
5724
5731
  return;
5725
5732
  }
@@ -5983,7 +5990,8 @@ var IAMUserGroupProvider = class {
5983
5990
  this.logger.debug(`Successfully deleted IAM group ${logicalId}`);
5984
5991
  } catch (error) {
5985
5992
  if (error instanceof NoSuchEntityException) {
5986
- assertRegionMatch(await this.iamClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
5993
+ const clientRegion = await this.iamClient.config.region();
5994
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
5987
5995
  this.logger.debug(`Group ${physicalId} does not exist, skipping deletion`);
5988
5996
  return;
5989
5997
  }
@@ -6829,7 +6837,8 @@ const EVENTBRIDGE_DEFAULT_ENABLED = true;
6829
6837
  * correct once every declared-but-unusable value has been refused.
6830
6838
  */
6831
6839
  function eventBridgeEnabledOf(eb) {
6832
- return coerceCfnBoolean(isPlainObject$1(eb) ? eb["EventBridgeEnabled"] : void 0) ?? EVENTBRIDGE_DEFAULT_ENABLED;
6840
+ const declared = isPlainObject$1(eb) ? eb["EventBridgeEnabled"] : void 0;
6841
+ return coerceCfnBoolean(declared) ?? EVENTBRIDGE_DEFAULT_ENABLED;
6833
6842
  }
6834
6843
  /** The notification families whose empty declaration is never SENT (issue #1759). */
6835
6844
  const NOTIFICATION_LIST_KEYS = [
@@ -9424,15 +9433,18 @@ var S3BucketProvider = class S3BucketProvider {
9424
9433
  };
9425
9434
  const replayOnUnusable = replayWarn(this.logger, context).onUnusable;
9426
9435
  const notifConfig = properties["NotificationConfiguration"];
9427
- if (notifConfig) if (!await this.applyNotificationConfiguration(bucketName, notifConfig, replayOnUnusable)) overrides.set("NotificationConfiguration", void 0);
9428
- else recordEffectiveFold("NotificationConfiguration", effectiveNotificationConfiguration(notifConfig));
9436
+ if (notifConfig) {
9437
+ if (!await this.applyNotificationConfiguration(bucketName, notifConfig, replayOnUnusable)) overrides.set("NotificationConfiguration", void 0);
9438
+ else recordEffectiveFold("NotificationConfiguration", effectiveNotificationConfiguration(notifConfig));
9439
+ }
9429
9440
  const corsConfig = properties["CorsConfiguration"];
9430
9441
  if (corsConfig?.CorsRules && Array.isArray(corsConfig.CorsRules) && corsConfig.CorsRules.length > 0) await this.applyCorsConfiguration(bucketName, corsConfig);
9431
9442
  else if (corsConfig != null) this.announceCreateEmptyCollectionSkip("CorsConfiguration", "CorsConfiguration.CorsRules");
9432
9443
  const lifecycleConfig = properties["LifecycleConfiguration"];
9433
- if (lifecycleConfig?.Rules && Array.isArray(lifecycleConfig.Rules) && lifecycleConfig.Rules.length > 0) if (!await this.applyLifecycleConfiguration(bucketName, lifecycleConfig, replayOnUnusable)) overrides.set("LifecycleConfiguration", void 0);
9434
- else recordEffectiveFold("LifecycleConfiguration", effectiveLifecycleConfiguration(lifecycleConfig));
9435
- else if (lifecycleConfig != null) this.announceCreateEmptyCollectionSkip("LifecycleConfiguration", "LifecycleConfiguration.Rules");
9444
+ if (lifecycleConfig?.Rules && Array.isArray(lifecycleConfig.Rules) && lifecycleConfig.Rules.length > 0) {
9445
+ if (!await this.applyLifecycleConfiguration(bucketName, lifecycleConfig, replayOnUnusable)) overrides.set("LifecycleConfiguration", void 0);
9446
+ else recordEffectiveFold("LifecycleConfiguration", effectiveLifecycleConfiguration(lifecycleConfig));
9447
+ } else if (lifecycleConfig != null) this.announceCreateEmptyCollectionSkip("LifecycleConfiguration", "LifecycleConfiguration.Rules");
9436
9448
  const loggingConfig = properties["LoggingConfiguration"];
9437
9449
  const loggingRefusal = replayOnUnusable ? configStringRefusal(loggingConfig, "DestinationBucketName", "", "AWS::S3::Bucket LoggingConfiguration") : void 0;
9438
9450
  if (loggingRefusal !== void 0) {
@@ -9839,7 +9851,8 @@ var S3BucketProvider = class S3BucketProvider {
9839
9851
  await this.deleteBucketWithEmptyRetry(logicalId, physicalId, allowAutoEmpty);
9840
9852
  } catch (error) {
9841
9853
  if (error instanceof NoSuchBucket) {
9842
- assertRegionMatch(await this.s3Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
9854
+ const clientRegion = await this.s3Client.config.region();
9855
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
9843
9856
  this.logger.debug(`Bucket ${physicalId} does not exist, skipping deletion`);
9844
9857
  return;
9845
9858
  }
@@ -10081,7 +10094,8 @@ var S3BucketProvider = class S3BucketProvider {
10081
10094
  }
10082
10095
  async readTags(bucket) {
10083
10096
  try {
10084
- return normalizeAwsTagsToCfn((await this.s3Client.send(new GetBucketTaggingCommand({ Bucket: bucket }))).TagSet);
10097
+ const resp = await this.s3Client.send(new GetBucketTaggingCommand({ Bucket: bucket }));
10098
+ return normalizeAwsTagsToCfn(resp.TagSet);
10085
10099
  } catch (err) {
10086
10100
  if (err.name === "NoSuchTagSet") return [];
10087
10101
  throw err;
@@ -10773,12 +10787,14 @@ var S3BucketPolicyProvider = class {
10773
10787
  this.logger.debug(`Successfully deleted S3 bucket policy ${logicalId}`);
10774
10788
  } catch (error) {
10775
10789
  if (error instanceof NoSuchBucket) {
10776
- assertRegionMatch(await this.s3Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
10790
+ const clientRegion = await this.s3Client.config.region();
10791
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
10777
10792
  this.logger.debug(`Bucket ${physicalId} does not exist, skipping policy deletion`);
10778
10793
  return;
10779
10794
  }
10780
10795
  if (error instanceof Error && (error.name === "NoSuchBucketPolicy" || error.message.includes("does not have"))) {
10781
- assertRegionMatch(await this.s3Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
10796
+ const clientRegion = await this.s3Client.config.region();
10797
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
10782
10798
  this.logger.debug(`Bucket policy for ${physicalId} does not exist, skipping`);
10783
10799
  return;
10784
10800
  }
@@ -11252,7 +11268,8 @@ var SQSQueueProvider = class {
11252
11268
  this.logger.debug(`Successfully deleted SQS queue ${logicalId}`);
11253
11269
  } catch (error) {
11254
11270
  if (error instanceof QueueDoesNotExist) {
11255
- assertRegionMatch(await this.sqsClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
11271
+ const clientRegion = await this.sqsClient.config.region();
11272
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
11256
11273
  this.logger.debug(`SQS queue ${physicalId} does not exist, skipping deletion`);
11257
11274
  return;
11258
11275
  }
@@ -11416,7 +11433,8 @@ var SQSQueueProvider = class {
11416
11433
  result["RedriveAllowPolicy"] = attributes["RedriveAllowPolicy"];
11417
11434
  }
11418
11435
  try {
11419
- result["Tags"] = normalizeAwsTagsToCfn((await this.sqsClient.send(new ListQueueTagsCommand({ QueueUrl: physicalId }))).Tags);
11436
+ const tagsResp = await this.sqsClient.send(new ListQueueTagsCommand({ QueueUrl: physicalId }));
11437
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
11420
11438
  } catch (err) {
11421
11439
  if (err instanceof QueueDoesNotExist) return void 0;
11422
11440
  throw err;
@@ -11548,7 +11566,8 @@ var SQSQueuePolicyProvider = class {
11548
11566
  this.logger.debug(`Successfully deleted SQS queue policy ${logicalId}`);
11549
11567
  } catch (error) {
11550
11568
  if (error instanceof Error && (error.name === "QueueDoesNotExist" || error.message.includes("does not exist"))) {
11551
- assertRegionMatch(await this.sqsClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
11569
+ const clientRegion = await this.sqsClient.config.region();
11570
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
11552
11571
  this.logger.debug(`Queue ${physicalId} does not exist, skipping policy deletion`);
11553
11572
  return;
11554
11573
  }
@@ -11997,7 +12016,8 @@ var SNSTopicProvider = class {
11997
12016
  this.logger.debug(`Successfully deleted SNS topic ${logicalId}`);
11998
12017
  } catch (error) {
11999
12018
  if (error instanceof NotFoundException) {
12000
- assertRegionMatch(await this.snsClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
12019
+ const clientRegion = await this.snsClient.config.region();
12020
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
12001
12021
  this.logger.debug(`SNS topic ${physicalId} does not exist, skipping deletion`);
12002
12022
  return;
12003
12023
  }
@@ -12098,7 +12118,8 @@ var SNSTopicProvider = class {
12098
12118
  }
12099
12119
  result["DeliveryStatusLogging"] = mapDeliveryStatusLogging(attrs, stateProtocolCaseMap(properties?.["DeliveryStatusLogging"]));
12100
12120
  try {
12101
- result["Tags"] = normalizeAwsTagsToCfn((await this.snsClient.send(new ListTagsForResourceCommand({ ResourceArn: physicalId }))).Tags);
12121
+ const tagsResp = await this.snsClient.send(new ListTagsForResourceCommand({ ResourceArn: physicalId }));
12122
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
12102
12123
  } catch (err) {
12103
12124
  if (err instanceof NotFoundException) return void 0;
12104
12125
  throw err;
@@ -12628,7 +12649,8 @@ var SNSSubscriptionProvider = class {
12628
12649
  this.logger.debug(`Successfully deleted SNS subscription ${logicalId}`);
12629
12650
  } catch (error) {
12630
12651
  if (error instanceof NotFoundException) {
12631
- assertRegionMatch(await this.snsClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
12652
+ const clientRegion = await this.snsClient.config.region();
12653
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
12632
12654
  this.logger.debug(`Subscription ${physicalId} does not exist, skipping deletion`);
12633
12655
  return;
12634
12656
  }
@@ -12820,7 +12842,8 @@ var SNSTopicPolicyProvider = class {
12820
12842
  this.logger.debug(`Removed policy from topic ${topicArn}`);
12821
12843
  } catch (error) {
12822
12844
  if (error instanceof Error && (error.name === "NotFoundException" || error.name === "NotFound" || error.message.includes("not found") || error.message.includes("does not exist") || error.message.includes("Invalid parameter"))) {
12823
- assertRegionMatch(await getAwsClients().sns.config.region(), context?.expectedRegion, resourceType, logicalId, topicArn);
12845
+ const clientRegion = await getAwsClients().sns.config.region();
12846
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, topicArn);
12824
12847
  this.logger.debug(`Topic ${topicArn} not found or policy already removed, skipping`);
12825
12848
  continue;
12826
12849
  }
@@ -13047,12 +13070,12 @@ var LambdaFunctionProvider = class {
13047
13070
  */
13048
13071
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::Lambda::Function", /* @__PURE__ */ new Map([["PublishToLatestPublished", "CloudFormation-only version-publishing directive with no AWS SDK equivalent"]])]]);
13049
13072
  cleanupDeleteRetryDelayMs = 2e3;
13050
- eniWaitTimeoutMs = 600 * 1e3;
13073
+ eniWaitTimeoutMs = 6e5;
13051
13074
  eniWaitInitialDelayMs = 1e4;
13052
13075
  eniWaitMaxDelayMs = 1e4;
13053
13076
  functionUpdateMaxWaitSeconds = 600;
13054
13077
  eniInitialSleepMs = 1e4;
13055
- eniDeleteRetryBudgetMs = 1800 * 1e3;
13078
+ eniDeleteRetryBudgetMs = 18e5;
13056
13079
  eniDeleteRetryIntervalMs = 15e3;
13057
13080
  constructor() {
13058
13081
  const awsClients = getAwsClients();
@@ -13189,7 +13212,7 @@ var LambdaFunctionProvider = class {
13189
13212
  const deleteMessage = deleteError instanceof Error ? deleteError.message : String(deleteError);
13190
13213
  cleanupFailure = deleteMessage;
13191
13214
  if (!/currently in the following state|ResourceConflict/i.test(deleteMessage)) break;
13192
- if (attempt < LAMBDA_CLEANUP_DELETE_MAX_ATTEMPTS - 1) await new Promise((resolve) => setTimeout(resolve, this.cleanupDeleteRetryDelayMs * (attempt + 1)));
13215
+ if (attempt < 2) await new Promise((resolve) => setTimeout(resolve, this.cleanupDeleteRetryDelayMs * (attempt + 1)));
13193
13216
  }
13194
13217
  if (cleanupFailure !== void 0) this.logger.error(`Cleanup DeleteFunction failed for ${ctx.logicalId} after ${ctx.apiName} failure — function may be orphaned: ${cleanupFailure}`);
13195
13218
  throw new ProvisioningError(`Failed to set ${ctx.propertyName} on Lambda function ${ctx.logicalId} (function was deleted to maintain atomicity): ${message}`, ctx.resourceType, ctx.logicalId, ctx.functionName, error instanceof Error ? error : void 0);
@@ -13306,15 +13329,17 @@ var LambdaFunctionProvider = class {
13306
13329
  this.logger.debug(`Updated RecursiveLoop for Lambda function ${physicalId} to '${newRecursiveLoop}'`);
13307
13330
  }
13308
13331
  const newReservedConcurrentExecutions = properties["ReservedConcurrentExecutions"];
13309
- if (newReservedConcurrentExecutions !== previousProperties["ReservedConcurrentExecutions"]) if (newReservedConcurrentExecutions === void 0) {
13310
- await this.lambdaClient.send(new DeleteFunctionConcurrencyCommand({ FunctionName: physicalId }));
13311
- this.logger.debug(`Cleared ReservedConcurrentExecutions for Lambda function ${physicalId} (template removed the property)`);
13312
- } else {
13313
- await this.lambdaClient.send(new PutFunctionConcurrencyCommand({
13314
- FunctionName: physicalId,
13315
- ReservedConcurrentExecutions: newReservedConcurrentExecutions
13316
- }));
13317
- this.logger.debug(`Updated ReservedConcurrentExecutions for Lambda function ${physicalId} to ${newReservedConcurrentExecutions}`);
13332
+ if (newReservedConcurrentExecutions !== previousProperties["ReservedConcurrentExecutions"]) {
13333
+ if (newReservedConcurrentExecutions === void 0) {
13334
+ await this.lambdaClient.send(new DeleteFunctionConcurrencyCommand({ FunctionName: physicalId }));
13335
+ this.logger.debug(`Cleared ReservedConcurrentExecutions for Lambda function ${physicalId} (template removed the property)`);
13336
+ } else {
13337
+ await this.lambdaClient.send(new PutFunctionConcurrencyCommand({
13338
+ FunctionName: physicalId,
13339
+ ReservedConcurrentExecutions: newReservedConcurrentExecutions
13340
+ }));
13341
+ this.logger.debug(`Updated ReservedConcurrentExecutions for Lambda function ${physicalId} to ${newReservedConcurrentExecutions}`);
13342
+ }
13318
13343
  }
13319
13344
  if (codeSigningChanged && newCodeSigningConfigArn !== void 0) {
13320
13345
  await this.lambdaClient.send(new PutFunctionCodeSigningConfigCommand({
@@ -13373,7 +13398,8 @@ var LambdaFunctionProvider = class {
13373
13398
  this.logger.debug(`Detached VPC config from Lambda ${physicalId} before deletion`);
13374
13399
  } catch (error) {
13375
13400
  if (error instanceof ResourceNotFoundException) {
13376
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
13401
+ const clientRegion = await this.lambdaClient.config.region();
13402
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
13377
13403
  return;
13378
13404
  }
13379
13405
  this.logger.warn(`Pre-delete VPC detach failed for ${physicalId}: ${error instanceof Error ? error.message : String(error)} — continuing with delete`);
@@ -13385,7 +13411,8 @@ var LambdaFunctionProvider = class {
13385
13411
  this.logger.debug(`Successfully deleted Lambda function ${logicalId}`);
13386
13412
  } catch (error) {
13387
13413
  if (error instanceof ResourceNotFoundException) {
13388
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
13414
+ const clientRegion = await this.lambdaClient.config.region();
13415
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
13389
13416
  this.logger.debug(`Lambda function ${physicalId} does not exist, skipping deletion`);
13390
13417
  return;
13391
13418
  }
@@ -14119,7 +14146,8 @@ var LambdaPermissionProvider = class {
14119
14146
  this.logger.debug(`Successfully deleted Lambda permission ${logicalId}`);
14120
14147
  } catch (error) {
14121
14148
  if (error instanceof ResourceNotFoundException) {
14122
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
14149
+ const clientRegion = await this.lambdaClient.config.region();
14150
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
14123
14151
  this.logger.debug(`Lambda permission ${physicalId} does not exist, skipping deletion`);
14124
14152
  return;
14125
14153
  }
@@ -14345,7 +14373,8 @@ var LambdaUrlProvider = class {
14345
14373
  this.logger.debug(`Successfully deleted Lambda URL ${logicalId}`);
14346
14374
  } catch (error) {
14347
14375
  if (error instanceof ResourceNotFoundException) {
14348
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
14376
+ const clientRegion = await this.lambdaClient.config.region();
14377
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
14349
14378
  this.logger.debug(`Lambda URL ${physicalId} does not exist, skipping deletion`);
14350
14379
  return;
14351
14380
  }
@@ -14839,7 +14868,8 @@ var LambdaEventSourceMappingProvider = class {
14839
14868
  await this.lambdaClient.send(new GetEventSourceMappingCommand({ UUID: physicalId }));
14840
14869
  } catch (error) {
14841
14870
  if (error instanceof ResourceNotFoundException) {
14842
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
14871
+ const clientRegion = await this.lambdaClient.config.region();
14872
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
14843
14873
  this.logger.debug(`Event source mapping ${physicalId} does not exist, skipping deletion`);
14844
14874
  return;
14845
14875
  }
@@ -14849,7 +14879,8 @@ var LambdaEventSourceMappingProvider = class {
14849
14879
  this.logger.debug(`Successfully deleted event source mapping ${logicalId}`);
14850
14880
  } catch (error) {
14851
14881
  if (error instanceof ResourceNotFoundException) {
14852
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
14882
+ const clientRegion = await this.lambdaClient.config.region();
14883
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
14853
14884
  this.logger.debug(`Event source mapping ${physicalId} does not exist, skipping deletion`);
14854
14885
  return;
14855
14886
  }
@@ -15112,7 +15143,8 @@ var LambdaLayerVersionProvider = class {
15112
15143
  this.logger.debug(`Successfully deleted Lambda layer version ${logicalId}`);
15113
15144
  } catch (error) {
15114
15145
  if (error instanceof ResourceNotFoundException) {
15115
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
15146
+ const clientRegion = await this.lambdaClient.config.region();
15147
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
15116
15148
  this.logger.debug(`Lambda layer version ${physicalId} does not exist, skipping deletion`);
15117
15149
  return;
15118
15150
  }
@@ -15312,8 +15344,10 @@ function compositeIdSeparatorRefusal(resourceType, logicalId, segments, maskSecr
15312
15344
  */
15313
15345
  function packCompositeId(resourceType, logicalId, segments, options) {
15314
15346
  const refusal = compositeIdSeparatorRefusal(resourceType, logicalId, segments, options?.maskSecrets);
15315
- if (refusal !== void 0) if (options?.onRefusal) options.onRefusal(`${refusal} Continuing with the ambiguous id because the value comes from a cdkd state record, which no template edit can repair; the same value is REFUSED on a template-path create.`);
15316
- else throw new ProvisioningError(refusal, resourceType, logicalId);
15347
+ if (refusal !== void 0) {
15348
+ if (options?.onRefusal) options.onRefusal(`${refusal} Continuing with the ambiguous id because the value comes from a cdkd state record, which no template edit can repair; the same value is REFUSED on a template-path create.`);
15349
+ else throw new ProvisioningError(refusal, resourceType, logicalId);
15350
+ }
15317
15351
  return segments.map((segment) => String(segment.value)).join("|");
15318
15352
  }
15319
15353
  /** Render the expected id shape, e.g. `<databaseName>|<tableName>`. */
@@ -15556,7 +15590,8 @@ var LambdaEventInvokeConfigProvider = class {
15556
15590
  this.logger.debug(`Successfully deleted Lambda EventInvokeConfig ${logicalId}`);
15557
15591
  } catch (error) {
15558
15592
  if (error instanceof ResourceNotFoundException) {
15559
- assertRegionMatch(await this.lambdaClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
15593
+ const clientRegion = await this.lambdaClient.config.region();
15594
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
15560
15595
  this.logger.debug(`Lambda EventInvokeConfig ${physicalId} does not exist, skipping deletion`);
15561
15596
  return;
15562
15597
  }
@@ -15799,7 +15834,8 @@ var LambdaMicrovmImageProvider = class {
15799
15834
  await this.client.send(new DeleteMicrovmImageCommand({ imageIdentifier: physicalId }));
15800
15835
  } catch (error) {
15801
15836
  if (error instanceof ResourceNotFoundException$8) {
15802
- assertRegionMatch(await this.client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
15837
+ const clientRegion = await this.client.config.region();
15838
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
15803
15839
  this.logger.debug(`MicroVM image ${physicalId} does not exist, skipping deletion`);
15804
15840
  return;
15805
15841
  }
@@ -15874,7 +15910,8 @@ var LambdaMicrovmImageProvider = class {
15874
15910
  }
15875
15911
  const result = {};
15876
15912
  if (name !== void 0) result["Name"] = name;
15877
- result["Tags"] = normalizeAwsTagsToCfn((await this.client.send(new ListTagsCommand$1({ Resource: physicalId }))).Tags);
15913
+ const tagsResp = await this.client.send(new ListTagsCommand$1({ Resource: physicalId }));
15914
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
15878
15915
  return result;
15879
15916
  }
15880
15917
  /**
@@ -16726,7 +16763,7 @@ const DYNAMODB_DELETE_POLL_COST_MS = INDEX_SETTLE_POLL_INTERVAL_MS + 200;
16726
16763
  * having spent different amounts; this is the ceiling on the total, and a total
16727
16764
  * does not need to know which terms produced it.
16728
16765
  */
16729
- const DYNAMODB_DELETE_BUDGET_MS = 26 * 6e4;
16766
+ const DYNAMODB_DELETE_BUDGET_MS = 156e4;
16730
16767
  /**
16731
16768
  * What both DynamoDB providers self-report through `getMinResourceTimeoutMs()`.
16732
16769
  *
@@ -16911,7 +16948,7 @@ function autoScalingRetriesWithinDeleteBudget(budget, defaultMaxRetries) {
16911
16948
  * to ~6 min of retry backoff, which at ~8s a retry is ~45 retries spread across
16912
16949
  * however many calls the table's index and replica count produce.
16913
16950
  */
16914
- const AUTO_SCALING_TEARDOWN_RESERVE_MS = 20 * 6e4;
16951
+ const AUTO_SCALING_TEARDOWN_RESERVE_MS = 12e5;
16915
16952
  /** `withRetry`'s capped backoff step (`maxDelayMs`), the cost of one retry. */
16916
16953
  const AUTO_SCALING_RETRY_STEP_MS = 8e3;
16917
16954
  /**
@@ -17882,7 +17919,10 @@ var DynamoDBTableProvider = class {
17882
17919
  } });
17883
17920
  const billingMode = billingModeUnusable ? prevBillingMode : requestedBillingMode;
17884
17921
  const billingOrThroughputChanged = billingMode !== prevBillingMode || JSON.stringify(properties["ProvisionedThroughput"]) !== JSON.stringify(previousProperties["ProvisionedThroughput"]);
17885
- if (billingOrThroughputChanged && billingMode === "PROVISIONED" && (prevBillingMode === "PAY_PER_REQUEST" || liveBillingMode === "PAY_PER_REQUEST") && properties["OnDemandThroughput"] !== void 0) throw new ProvisioningError(`AWS::DynamoDB::Table ${logicalId}: the template flips BillingMode to PROVISIONED${properties["BillingMode"] === void 0 ? " (BillingMode is absent from the template, which CloudFormation resets to PROVISIONED)" : ""} while still declaring OnDemandThroughput, which AWS accepts only on a PAY_PER_REQUEST table. Nothing was applied. Remove OnDemandThroughput, or keep BillingMode: PAY_PER_REQUEST.`, logicalId, resourceType);
17922
+ if (billingOrThroughputChanged && billingMode === "PROVISIONED" && (prevBillingMode === "PAY_PER_REQUEST" || liveBillingMode === "PAY_PER_REQUEST") && properties["OnDemandThroughput"] !== void 0) {
17923
+ const absentNote = properties["BillingMode"] === void 0 ? " (BillingMode is absent from the template, which CloudFormation resets to PROVISIONED)" : "";
17924
+ throw new ProvisioningError(`AWS::DynamoDB::Table ${logicalId}: the template flips BillingMode to PROVISIONED${absentNote} while still declaring OnDemandThroughput, which AWS accepts only on a PAY_PER_REQUEST table. Nothing was applied. Remove OnDemandThroughput, or keep BillingMode: PAY_PER_REQUEST.`, logicalId, resourceType);
17925
+ }
17886
17926
  const liveIndexes = table?.GlobalSecondaryIndexes ?? [];
17887
17927
  const desiredIndexByName = /* @__PURE__ */ new Map();
17888
17928
  for (const entry of Array.isArray(properties["GlobalSecondaryIndexes"]) ? properties["GlobalSecondaryIndexes"] : []) {
@@ -18172,7 +18212,8 @@ var DynamoDBTableProvider = class {
18172
18212
  this.protectionFlips.release(deleteBudgetKey(physicalId, context?.expectedRegion));
18173
18213
  } catch (error) {
18174
18214
  if (error instanceof ResourceNotFoundException$1) {
18175
- assertRegionMatch(await this.dynamoDBClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
18215
+ const clientRegion = await this.dynamoDBClient.config.region();
18216
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
18176
18217
  this.logger.debug(`DynamoDB table ${physicalId} does not exist, skipping deletion`);
18177
18218
  this.deleteBudgets.release(deleteBudgetKey(physicalId, context?.expectedRegion));
18178
18219
  this.protectionFlips.release(deleteBudgetKey(physicalId, context?.expectedRegion));
@@ -19146,7 +19187,8 @@ var DynamoDBTableProvider = class {
19146
19187
  if (table.DeletionProtectionEnabled !== void 0) result["DeletionProtectionEnabled"] = table.DeletionProtectionEnabled;
19147
19188
  if (table.TableClassSummary?.TableClass) result["TableClass"] = table.TableClassSummary.TableClass;
19148
19189
  if (table.TableArn) try {
19149
- result["Tags"] = normalizeAwsTagsToCfn((await this.dynamoDBClient.send(new ListTagsOfResourceCommand({ ResourceArn: table.TableArn }))).Tags);
19190
+ const tagsResp = await this.dynamoDBClient.send(new ListTagsOfResourceCommand({ ResourceArn: table.TableArn }));
19191
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
19150
19192
  } catch (err) {
19151
19193
  if (err instanceof ResourceNotFoundException$1) return void 0;
19152
19194
  throw err;
@@ -20219,10 +20261,14 @@ var DynamoDBGlobalTableProvider = class {
20219
20261
  const onDemand = { ...gsi.OnDemandThroughput };
20220
20262
  const unresolvedMembers = [];
20221
20263
  if (!billingFlipped && previousOnDemand) {
20222
- if (previousOnDemand.MaxReadRequestUnits !== void 0 && onDemand.MaxReadRequestUnits === void 0) if (declared?.readDeclared) unresolvedMembers.push("MaxReadRequestUnits");
20223
- else onDemand.MaxReadRequestUnits = ON_DEMAND_LIMIT_RESET;
20224
- if (previousOnDemand.MaxWriteRequestUnits !== void 0 && onDemand.MaxWriteRequestUnits === void 0) if (declared?.writeDeclared) unresolvedMembers.push("MaxWriteRequestUnits");
20225
- else onDemand.MaxWriteRequestUnits = ON_DEMAND_LIMIT_RESET;
20264
+ if (previousOnDemand.MaxReadRequestUnits !== void 0 && onDemand.MaxReadRequestUnits === void 0) {
20265
+ if (declared?.readDeclared) unresolvedMembers.push("MaxReadRequestUnits");
20266
+ else onDemand.MaxReadRequestUnits = ON_DEMAND_LIMIT_RESET;
20267
+ }
20268
+ if (previousOnDemand.MaxWriteRequestUnits !== void 0 && onDemand.MaxWriteRequestUnits === void 0) {
20269
+ if (declared?.writeDeclared) unresolvedMembers.push("MaxWriteRequestUnits");
20270
+ else onDemand.MaxWriteRequestUnits = ON_DEMAND_LIMIT_RESET;
20271
+ }
20226
20272
  }
20227
20273
  if (Object.keys(onDemand).length > 0) update.OnDemandThroughput = onDemand;
20228
20274
  if (!billingFlipped && gsi.ProvisionedThroughput) update.ProvisionedThroughput = gsi.ProvisionedThroughput;
@@ -20811,7 +20857,8 @@ var DynamoDBGlobalTableProvider = class {
20811
20857
  this.protectionFlips.release(deleteBudgetKey(physicalId, context?.expectedRegion));
20812
20858
  } catch (error) {
20813
20859
  if (error instanceof ResourceNotFoundException$1) {
20814
- assertRegionMatch(await this.dynamoDBClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
20860
+ const clientRegion = await this.dynamoDBClient.config.region();
20861
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
20815
20862
  this.logger.debug(`DynamoDB GlobalTable ${physicalId} does not exist, skipping`);
20816
20863
  this.deleteBudgets.release(deleteBudgetKey(physicalId, context?.expectedRegion));
20817
20864
  this.protectionFlips.release(deleteBudgetKey(physicalId, context?.expectedRegion));
@@ -20922,7 +20969,8 @@ var DynamoDBGlobalTableProvider = class {
20922
20969
  const subs = await this.readReplicaSubSpecs(client, tableNameForSubs, regionLabel);
20923
20970
  Object.assign(entry, subs);
20924
20971
  if (replicaArn) try {
20925
- entry["Tags"] = normalizeAwsTagsToCfn((await client.send(new ListTagsOfResourceCommand({ ResourceArn: replicaArn }))).Tags);
20972
+ const tagsResp = await client.send(new ListTagsOfResourceCommand({ ResourceArn: replicaArn }));
20973
+ entry["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
20926
20974
  } catch (tagErr) {
20927
20975
  if (tagErr instanceof ResourceNotFoundException$1) {
20928
20976
  if (isLocal) throw tagErr;
@@ -23152,7 +23200,8 @@ var LogsLogGroupProvider = class {
23152
23200
  const nextClass = normalizeClass(properties["LogGroupClass"]);
23153
23201
  if (prevClass !== nextClass) {
23154
23202
  const replaceFlags = "--replace --force-stateful-recreation";
23155
- throw new ResourceUpdateNotSupportedError("AWS::Logs::LogGroup", logicalId, `the LogGroupClass ('${prevClass}' -> '${nextClass}') cannot be changed after creation. ${isTruthyCfnBoolean(previousProperties["DeletionProtectionEnabled"]) ? `cdkd's recorded properties for this log group carry DeletionProtectionEnabled, so ${replaceFlags} alone will NOT succeed while AWS still has it on: the replacement normally deletes the log group, AWS refuses that delete while protection is on, and cdkd deploy has no --remove-protection flag to clear it (only cdkd destroy and cdkd state destroy act on one). Read "Deletion protection blocks a replacement" in docs/cli-deploy-safety.md BEFORE you disable anything: whether disabling helps at all, and what the flag ends up as, depend on your UpdateReplacePolicy and on whether the deploy completes — neither of which this refusal can see. Then disable deletion protection — \`aws logs put-log-group-deletion-protection --log-group-identifier '${physicalId}' --no-deletion-protection-enabled\`, or via the console — and re-deploy with ${replaceFlags} to delete + recreate the log group under the new class (its stored log events are lost). Setting DeletionProtectionEnabled: false in the template does NOT clear it in the same deploy: this refusal fires before that property is applied, so that route needs its own deploy with the LogGroupClass change reverted. Or revert the LogGroupClass change and keep the current class.` : `Re-deploy with ${replaceFlags} to delete + recreate the log group under the new class (its stored log events are lost), or revert the LogGroupClass change.`} Note --force-stateful-recreation has NO per-resource granularity: it clears the data guard for every replacement target in the run`);
23203
+ const remedy = isTruthyCfnBoolean(previousProperties["DeletionProtectionEnabled"]) ? `cdkd's recorded properties for this log group carry DeletionProtectionEnabled, so ${replaceFlags} alone will NOT succeed while AWS still has it on: the replacement normally deletes the log group, AWS refuses that delete while protection is on, and cdkd deploy has no --remove-protection flag to clear it (only cdkd destroy and cdkd state destroy act on one). Read "Deletion protection blocks a replacement" in docs/cli-deploy-safety.md BEFORE you disable anything: whether disabling helps at all, and what the flag ends up as, depend on your UpdateReplacePolicy and on whether the deploy completes — neither of which this refusal can see. Then disable deletion protection — \`aws logs put-log-group-deletion-protection --log-group-identifier '${physicalId}' --no-deletion-protection-enabled\`, or via the console — and re-deploy with ${replaceFlags} to delete + recreate the log group under the new class (its stored log events are lost). Setting DeletionProtectionEnabled: false in the template does NOT clear it in the same deploy: this refusal fires before that property is applied, so that route needs its own deploy with the LogGroupClass change reverted. Or revert the LogGroupClass change and keep the current class.` : `Re-deploy with ${replaceFlags} to delete + recreate the log group under the new class (its stored log events are lost), or revert the LogGroupClass change.`;
23204
+ throw new ResourceUpdateNotSupportedError("AWS::Logs::LogGroup", logicalId, `the LogGroupClass ('${prevClass}' -> '${nextClass}') cannot be changed after creation. ${remedy} Note --force-stateful-recreation has NO per-resource granularity: it clears the data guard for every replacement target in the run`);
23156
23205
  }
23157
23206
  const rawRetention = properties["RetentionInDays"];
23158
23207
  const rawPreviousRetention = previousProperties["RetentionInDays"];
@@ -23170,18 +23219,22 @@ var LogsLogGroupProvider = class {
23170
23219
  else await this.logsClient.send(new DisassociateKmsKeyCommand({ logGroupName: physicalId }));
23171
23220
  this.logger.debug(`Updated KMS key association for log group ${physicalId}`);
23172
23221
  }
23173
- if (retentionInDays !== oldRetentionInDays || !sameRawRetention && Boolean(rawPreviousRetention) && oldRetentionInDays === void 0) if (retentionInDays !== void 0 && retentionInDays > 0) await this.logsClient.send(new PutRetentionPolicyCommand({
23174
- logGroupName: physicalId,
23175
- retentionInDays
23176
- }));
23177
- else await this.logsClient.send(new DeleteRetentionPolicyCommand({ logGroupName: physicalId }));
23178
- if (JSON.stringify(properties["DataProtectionPolicy"]) !== JSON.stringify(previousProperties["DataProtectionPolicy"])) if (properties["DataProtectionPolicy"]) {
23179
- const policyDocument = typeof properties["DataProtectionPolicy"] === "string" ? properties["DataProtectionPolicy"] : JSON.stringify(properties["DataProtectionPolicy"]);
23180
- await this.logsClient.send(new PutDataProtectionPolicyCommand({
23181
- logGroupIdentifier: physicalId,
23182
- policyDocument
23222
+ if (retentionInDays !== oldRetentionInDays || !sameRawRetention && Boolean(rawPreviousRetention) && oldRetentionInDays === void 0) {
23223
+ if (retentionInDays !== void 0 && retentionInDays > 0) await this.logsClient.send(new PutRetentionPolicyCommand({
23224
+ logGroupName: physicalId,
23225
+ retentionInDays
23183
23226
  }));
23184
- } else await this.logsClient.send(new DeleteDataProtectionPolicyCommand({ logGroupIdentifier: physicalId }));
23227
+ else await this.logsClient.send(new DeleteRetentionPolicyCommand({ logGroupName: physicalId }));
23228
+ }
23229
+ if (JSON.stringify(properties["DataProtectionPolicy"]) !== JSON.stringify(previousProperties["DataProtectionPolicy"])) {
23230
+ if (properties["DataProtectionPolicy"]) {
23231
+ const policyDocument = typeof properties["DataProtectionPolicy"] === "string" ? properties["DataProtectionPolicy"] : JSON.stringify(properties["DataProtectionPolicy"]);
23232
+ await this.logsClient.send(new PutDataProtectionPolicyCommand({
23233
+ logGroupIdentifier: physicalId,
23234
+ policyDocument
23235
+ }));
23236
+ } else await this.logsClient.send(new DeleteDataProtectionPolicyCommand({ logGroupIdentifier: physicalId }));
23237
+ }
23185
23238
  if (properties["DeletionProtectionEnabled"] !== previousProperties["DeletionProtectionEnabled"]) {
23186
23239
  const next = properties["DeletionProtectionEnabled"];
23187
23240
  if (next !== void 0) await this.logsClient.send(new PutLogGroupDeletionProtectionCommand({
@@ -23206,18 +23259,20 @@ var LogsLogGroupProvider = class {
23206
23259
  }
23207
23260
  const newFieldIndex = properties["FieldIndexPolicies"];
23208
23261
  const oldFieldIndex = previousProperties["FieldIndexPolicies"];
23209
- if (JSON.stringify(newFieldIndex) !== JSON.stringify(oldFieldIndex)) if (newFieldIndex && newFieldIndex.length > 0) {
23210
- if (newFieldIndex.length > 1) this.logger.debug(`Log group ${physicalId} declares ${newFieldIndex.length} FieldIndexPolicies; AWS only supports one log-group-level field index policy. Applying the first.`);
23211
- const first = newFieldIndex[0];
23212
- const policyDocument = typeof first === "string" ? first : JSON.stringify(first);
23213
- await this.logsClient.send(new PutIndexPolicyCommand({
23214
- logGroupIdentifier: physicalId,
23215
- policyDocument
23216
- }));
23217
- } else try {
23218
- await this.logsClient.send(new DeleteIndexPolicyCommand({ logGroupIdentifier: physicalId }));
23219
- } catch (err) {
23220
- if (!(err instanceof ResourceNotFoundException$5)) throw err;
23262
+ if (JSON.stringify(newFieldIndex) !== JSON.stringify(oldFieldIndex)) {
23263
+ if (newFieldIndex && newFieldIndex.length > 0) {
23264
+ if (newFieldIndex.length > 1) this.logger.debug(`Log group ${physicalId} declares ${newFieldIndex.length} FieldIndexPolicies; AWS only supports one log-group-level field index policy. Applying the first.`);
23265
+ const first = newFieldIndex[0];
23266
+ const policyDocument = typeof first === "string" ? first : JSON.stringify(first);
23267
+ await this.logsClient.send(new PutIndexPolicyCommand({
23268
+ logGroupIdentifier: physicalId,
23269
+ policyDocument
23270
+ }));
23271
+ } else try {
23272
+ await this.logsClient.send(new DeleteIndexPolicyCommand({ logGroupIdentifier: physicalId }));
23273
+ } catch (err) {
23274
+ if (!(err instanceof ResourceNotFoundException$5)) throw err;
23275
+ }
23221
23276
  }
23222
23277
  const newTags = properties["Tags"];
23223
23278
  const oldTags = previousProperties["Tags"];
@@ -23264,7 +23319,8 @@ var LogsLogGroupProvider = class {
23264
23319
  this.logger.debug(`Successfully deleted log group ${logicalId}`);
23265
23320
  } catch (error) {
23266
23321
  if (error instanceof ResourceNotFoundException$5) {
23267
- assertRegionMatch(await this.logsClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
23322
+ const clientRegion = await this.logsClient.config.region();
23323
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
23268
23324
  this.logger.debug(`Log group ${physicalId} does not exist, skipping deletion`);
23269
23325
  return;
23270
23326
  }
@@ -23363,7 +23419,8 @@ var LogsLogGroupProvider = class {
23363
23419
  if (found.arn) {
23364
23420
  const arnForTags = found.arn.replace(/:\*$/, "");
23365
23421
  try {
23366
- tags = normalizeAwsTagsToCfn((await this.logsClient.send(new ListTagsForResourceCommand$5({ resourceArn: arnForTags }))).tags);
23422
+ const tagsResp = await this.logsClient.send(new ListTagsForResourceCommand$5({ resourceArn: arnForTags }));
23423
+ tags = normalizeAwsTagsToCfn(tagsResp.tags);
23367
23424
  } catch (err) {
23368
23425
  if (err instanceof ResourceNotFoundException$5) return void 0;
23369
23426
  throw err;
@@ -23527,7 +23584,8 @@ var CloudWatchAlarmProvider = class {
23527
23584
  this.logger.debug(`Successfully deleted CloudWatch alarm ${logicalId}`);
23528
23585
  } catch (error) {
23529
23586
  if (error instanceof Error && error.name === "ResourceNotFound") {
23530
- assertRegionMatch(await this.cloudWatchClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
23587
+ const clientRegion = await this.cloudWatchClient.config.region();
23588
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
23531
23589
  this.logger.debug(`Alarm ${physicalId} does not exist, skipping deletion`);
23532
23590
  return;
23533
23591
  }
@@ -23718,7 +23776,8 @@ var CloudWatchAlarmProvider = class {
23718
23776
  if (alarm.EvaluateLowSampleCountPercentile !== void 0) result["EvaluateLowSampleCountPercentile"] = alarm.EvaluateLowSampleCountPercentile;
23719
23777
  if (alarm.ThresholdMetricId !== void 0) result["ThresholdMetricId"] = alarm.ThresholdMetricId;
23720
23778
  if (alarm.AlarmArn) try {
23721
- result["Tags"] = normalizeAwsTagsToCfn((await this.cloudWatchClient.send(new ListTagsForResourceCommand$4({ ResourceARN: alarm.AlarmArn }))).Tags);
23779
+ const tagsResp = await this.cloudWatchClient.send(new ListTagsForResourceCommand$4({ ResourceARN: alarm.AlarmArn }));
23780
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
23722
23781
  } catch (err) {
23723
23782
  this.logger.debug(`CloudWatch ListTagsForResource(${alarm.AlarmArn}) failed: ${err instanceof Error ? err.message : String(err)}`);
23724
23783
  }
@@ -23856,7 +23915,8 @@ var CloudWatchAnomalyDetectorProvider = class {
23856
23915
  this.logger.debug(`Successfully deleted CloudWatch anomaly detector ${logicalId}`);
23857
23916
  } catch (error) {
23858
23917
  if (error instanceof ResourceNotFoundException$4) {
23859
- assertRegionMatch(await this.cloudWatchClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
23918
+ const clientRegion = await this.cloudWatchClient.config.region();
23919
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
23860
23920
  this.logger.debug(`Anomaly detector ${physicalId} does not exist, skipping deletion`);
23861
23921
  return;
23862
23922
  }
@@ -24136,7 +24196,8 @@ var SecretsManagerSecretProvider = class {
24136
24196
  this.logger.debug(`Successfully deleted secret ${logicalId}`);
24137
24197
  } catch (error) {
24138
24198
  if (error instanceof ResourceNotFoundException$3) {
24139
- assertRegionMatch(await this.smClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
24199
+ const clientRegion = await this.smClient.config.region();
24200
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
24140
24201
  this.logger.debug(`Secret ${physicalId} does not exist, skipping deletion`);
24141
24202
  return;
24142
24203
  }
@@ -24530,7 +24591,8 @@ var SSMParameterProvider = class {
24530
24591
  * `import()` now refuses it — and not here. Do not re-add it.
24531
24592
  */
24532
24593
  async buildParameterArnUnguarded(name, mask) {
24533
- const accountInfo = await getAccountInfo(await this.ssmClient.config.region());
24594
+ const region = await this.ssmClient.config.region();
24595
+ const accountInfo = await getAccountInfo(region);
24534
24596
  if (accountInfo.fabricated) {
24535
24597
  this.logger.warn(mask(`Cannot determine the AWS account (STS is unreachable, and the resolved account id is a placeholder), so the Arn attribute for SSM parameter ${name} would be fabricated and is NOT recorded. An Fn::GetAtt on it will fail until a later deploy resolves the account.`));
24536
24598
  return;
@@ -24664,7 +24726,8 @@ var SSMParameterProvider = class {
24664
24726
  this.logger.debug(`Successfully deleted SSM parameter ${logicalId}`);
24665
24727
  } catch (error) {
24666
24728
  if (error instanceof ParameterNotFound) {
24667
- assertRegionMatch(await this.ssmClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
24729
+ const clientRegion = await this.ssmClient.config.region();
24730
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
24668
24731
  this.logger.debug(`Parameter ${physicalId} does not exist, skipping deletion`);
24669
24732
  return;
24670
24733
  }
@@ -24748,10 +24811,11 @@ var SSMParameterProvider = class {
24748
24811
  } catch {}
24749
24812
  if (!policiesEmitted) result["Policies"] = [];
24750
24813
  try {
24751
- const tagArr = normalizeAwsTagsToCfn((await this.ssmClient.send(new ListTagsForResourceCommand$2({
24814
+ const tagsResp = await this.ssmClient.send(new ListTagsForResourceCommand$2({
24752
24815
  ResourceType: "Parameter",
24753
24816
  ResourceId: physicalId
24754
- }))).TagList);
24817
+ }));
24818
+ const tagArr = normalizeAwsTagsToCfn(tagsResp.TagList);
24755
24819
  result["Tags"] = Object.fromEntries(tagArr.map((t) => [t.Key, t.Value]));
24756
24820
  } catch {}
24757
24821
  return result;
@@ -25113,7 +25177,8 @@ var EventBridgeRuleProvider = class {
25113
25177
  }))).Targets || []).map((t) => t.Id).filter((id) => id !== void 0);
25114
25178
  } catch (error) {
25115
25179
  if (error instanceof ResourceNotFoundException$2) {
25116
- assertRegionMatch(await this.eventBridgeClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
25180
+ const clientRegion = await this.eventBridgeClient.config.region();
25181
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
25117
25182
  this.logger.debug(`Rule ${ruleName} does not exist, skipping deletion`);
25118
25183
  return;
25119
25184
  }
@@ -25134,7 +25199,8 @@ var EventBridgeRuleProvider = class {
25134
25199
  this.logger.debug(`Successfully deleted EventBridge rule ${logicalId}`);
25135
25200
  } catch (error) {
25136
25201
  if (error instanceof ResourceNotFoundException$2) {
25137
- assertRegionMatch(await this.eventBridgeClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
25202
+ const clientRegion = await this.eventBridgeClient.config.region();
25203
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
25138
25204
  this.logger.debug(`Rule ${ruleName} does not exist, skipping deletion`);
25139
25205
  return;
25140
25206
  }
@@ -25206,7 +25272,8 @@ var EventBridgeRuleProvider = class {
25206
25272
  if (!(err instanceof ResourceNotFoundException$2)) throw err;
25207
25273
  }
25208
25274
  try {
25209
- result["Tags"] = normalizeAwsTagsToCfn((await this.eventBridgeClient.send(new ListTagsForResourceCommand$1({ ResourceARN: physicalId }))).Tags);
25275
+ const tagsResp = await this.eventBridgeClient.send(new ListTagsForResourceCommand$1({ ResourceARN: physicalId }));
25276
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
25210
25277
  } catch (err) {
25211
25278
  if (!(err instanceof ResourceNotFoundException$2)) throw err;
25212
25279
  }
@@ -25443,13 +25510,15 @@ var EventBridgeBusProvider = class {
25443
25510
  this.logger.debug(`Successfully deleted EventBus ${logicalId}`);
25444
25511
  } catch (error) {
25445
25512
  if (error instanceof ResourceNotFoundException$2) {
25446
- assertRegionMatch(await this.eventBridgeClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
25513
+ const clientRegion = await this.eventBridgeClient.config.region();
25514
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
25447
25515
  this.logger.debug(`EventBus ${physicalId} does not exist, skipping`);
25448
25516
  return;
25449
25517
  }
25450
25518
  const msg = error instanceof Error ? error.message : String(error);
25451
25519
  if (msg.includes("does not exist")) {
25452
- assertRegionMatch(await this.eventBridgeClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
25520
+ const clientRegion = await this.eventBridgeClient.config.region();
25521
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
25453
25522
  this.logger.debug(`EventBus ${physicalId} does not exist, skipping`);
25454
25523
  return;
25455
25524
  }
@@ -25534,7 +25603,8 @@ var EventBridgeBusProvider = class {
25534
25603
  result["Policy"] = resp.Policy;
25535
25604
  }
25536
25605
  if (resp.Arn) try {
25537
- result["Tags"] = normalizeAwsTagsToCfn((await this.eventBridgeClient.send(new ListTagsForResourceCommand$1({ ResourceARN: resp.Arn }))).Tags);
25606
+ const tagsResp = await this.eventBridgeClient.send(new ListTagsForResourceCommand$1({ ResourceARN: resp.Arn }));
25607
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
25538
25608
  } catch (err) {
25539
25609
  if (err instanceof ResourceNotFoundException$2) return void 0;
25540
25610
  throw err;
@@ -26297,7 +26367,8 @@ var EC2Provider = class {
26297
26367
  return;
26298
26368
  } catch (error) {
26299
26369
  if (this.isNotFoundError(error)) {
26300
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26370
+ const clientRegion = await this.ec2Client.config.region();
26371
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26301
26372
  this.logger.debug(`VPC ${physicalId} does not exist, skipping deletion`);
26302
26373
  return;
26303
26374
  }
@@ -26470,7 +26541,8 @@ var EC2Provider = class {
26470
26541
  return;
26471
26542
  } catch (error) {
26472
26543
  if (this.isNotFoundError(error)) {
26473
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26544
+ const clientRegion = await this.ec2Client.config.region();
26545
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26474
26546
  this.logger.debug(`Subnet ${physicalId} does not exist, skipping deletion`);
26475
26547
  return;
26476
26548
  }
@@ -26556,7 +26628,8 @@ var EC2Provider = class {
26556
26628
  this.logger.debug(`Successfully deleted InternetGateway ${logicalId}`);
26557
26629
  } catch (error) {
26558
26630
  if (this.isNotFoundError(error)) {
26559
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26631
+ const clientRegion = await this.ec2Client.config.region();
26632
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26560
26633
  this.logger.debug(`InternetGateway ${physicalId} does not exist, skipping deletion`);
26561
26634
  return;
26562
26635
  }
@@ -26608,13 +26681,15 @@ var EC2Provider = class {
26608
26681
  publicIp = response.PublicIp;
26609
26682
  await this.applyTags(allocationId, properties, logicalId);
26610
26683
  const instanceId = properties["InstanceId"];
26611
- if (instanceId) if (process.env["CDKD_NO_WAIT"] === "true") this.logger.warn(`EIP ${logicalId} (${allocationId}) was NOT associated with ${instanceId}: --no-wait skips the instance running-state wait, and AssociateAddress rejects an instance that is not yet running. Verify and associate once the instance is running: aws ec2 describe-instances --instance-ids ${instanceId} --query 'Reservations[].Instances[].State.Name' && aws ec2 associate-address --allocation-id ${allocationId} --instance-id ${instanceId}`);
26612
- else {
26613
- await this.ec2Client.send(new AssociateAddressCommand({
26614
- AllocationId: allocationId,
26615
- InstanceId: instanceId
26616
- }));
26617
- this.logger.debug(`Associated EIP ${logicalId} (${allocationId}) to ${instanceId}`);
26684
+ if (instanceId) {
26685
+ if (process.env["CDKD_NO_WAIT"] === "true") this.logger.warn(`EIP ${logicalId} (${allocationId}) was NOT associated with ${instanceId}: --no-wait skips the instance running-state wait, and AssociateAddress rejects an instance that is not yet running. Verify and associate once the instance is running: aws ec2 describe-instances --instance-ids ${instanceId} --query 'Reservations[].Instances[].State.Name' && aws ec2 associate-address --allocation-id ${allocationId} --instance-id ${instanceId}`);
26686
+ else {
26687
+ await this.ec2Client.send(new AssociateAddressCommand({
26688
+ AllocationId: allocationId,
26689
+ InstanceId: instanceId
26690
+ }));
26691
+ this.logger.debug(`Associated EIP ${logicalId} (${allocationId}) to ${instanceId}`);
26692
+ }
26618
26693
  }
26619
26694
  this.logger.debug(`Successfully created EIP ${logicalId}: ${allocationId} (${publicIp})`);
26620
26695
  } catch (error) {
@@ -26639,19 +26714,21 @@ var EC2Provider = class {
26639
26714
  await this.applyTagDiff(allocationId, previousProperties["Tags"], properties["Tags"]);
26640
26715
  const oldInstanceId = previousProperties["InstanceId"];
26641
26716
  const newInstanceId = properties["InstanceId"];
26642
- if (oldInstanceId !== newInstanceId) if (newInstanceId) try {
26643
- await this.ec2Client.send(new AssociateAddressCommand({
26644
- AllocationId: allocationId,
26645
- InstanceId: newInstanceId,
26646
- AllowReassociation: true
26647
- }));
26648
- } catch (error) {
26649
- if (process.env["CDKD_NO_WAIT"] === "true" && this.isIncorrectInstanceStateError(error)) this.logger.warn(`EIP ${logicalId} (${allocationId}) was NOT associated with ${newInstanceId}: --no-wait skips the instance running-state wait, and AssociateAddress rejects an instance that is not yet running. Verify and associate once the instance is running: aws ec2 describe-instances --instance-ids ${newInstanceId} --query 'Reservations[].Instances[].State.Name' && aws ec2 associate-address --allocation-id ${allocationId} --instance-id ${newInstanceId} --allow-reassociation`);
26650
- else throw error;
26651
- }
26652
- else {
26653
- const associationId = (await this.ec2Client.send(new DescribeAddressesCommand({ AllocationIds: [allocationId] }))).Addresses?.[0]?.AssociationId;
26654
- if (associationId) await this.ec2Client.send(new DisassociateAddressCommand({ AssociationId: associationId }));
26717
+ if (oldInstanceId !== newInstanceId) {
26718
+ if (newInstanceId) try {
26719
+ await this.ec2Client.send(new AssociateAddressCommand({
26720
+ AllocationId: allocationId,
26721
+ InstanceId: newInstanceId,
26722
+ AllowReassociation: true
26723
+ }));
26724
+ } catch (error) {
26725
+ if (process.env["CDKD_NO_WAIT"] === "true" && this.isIncorrectInstanceStateError(error)) this.logger.warn(`EIP ${logicalId} (${allocationId}) was NOT associated with ${newInstanceId}: --no-wait skips the instance running-state wait, and AssociateAddress rejects an instance that is not yet running. Verify and associate once the instance is running: aws ec2 describe-instances --instance-ids ${newInstanceId} --query 'Reservations[].Instances[].State.Name' && aws ec2 associate-address --allocation-id ${allocationId} --instance-id ${newInstanceId} --allow-reassociation`);
26726
+ else throw error;
26727
+ }
26728
+ else {
26729
+ const associationId = (await this.ec2Client.send(new DescribeAddressesCommand({ AllocationIds: [allocationId] }))).Addresses?.[0]?.AssociationId;
26730
+ if (associationId) await this.ec2Client.send(new DisassociateAddressCommand({ AssociationId: associationId }));
26731
+ }
26655
26732
  }
26656
26733
  }
26657
26734
  return {
@@ -26675,7 +26752,8 @@ var EC2Provider = class {
26675
26752
  this.logger.debug(`Successfully deleted EIP ${logicalId}`);
26676
26753
  } catch (error) {
26677
26754
  if (this.isNotFoundError(error)) {
26678
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26755
+ const clientRegion = await this.ec2Client.config.region();
26756
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26679
26757
  this.logger.debug(`EIP ${physicalId} does not exist, skipping deletion`);
26680
26758
  return;
26681
26759
  }
@@ -26742,7 +26820,8 @@ var EC2Provider = class {
26742
26820
  this.logger.debug(`Successfully deleted VPCGatewayAttachment ${logicalId}`);
26743
26821
  } catch (error) {
26744
26822
  if (this.isNotFoundError(error)) {
26745
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26823
+ const clientRegion = await this.ec2Client.config.region();
26824
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26746
26825
  this.logger.debug(`VPCGatewayAttachment ${physicalId} does not exist, skipping deletion`);
26747
26826
  return;
26748
26827
  }
@@ -26800,7 +26879,8 @@ var EC2Provider = class {
26800
26879
  await this.ec2Client.send(new DeleteNatGatewayCommand({ NatGatewayId: physicalId }));
26801
26880
  } catch (error) {
26802
26881
  if (this.isNotFoundError(error)) {
26803
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26882
+ const clientRegion = await this.ec2Client.config.region();
26883
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26804
26884
  this.logger.debug(`NatGateway ${physicalId} does not exist, skipping deletion`);
26805
26885
  return;
26806
26886
  }
@@ -26855,7 +26935,8 @@ var EC2Provider = class {
26855
26935
  this.logger.debug(`Successfully deleted RouteTable ${logicalId}`);
26856
26936
  } catch (error) {
26857
26937
  if (this.isNotFoundError(error)) {
26858
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
26938
+ const clientRegion = await this.ec2Client.config.region();
26939
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26859
26940
  this.logger.debug(`RouteTable ${physicalId} does not exist, skipping deletion`);
26860
26941
  return;
26861
26942
  }
@@ -26953,7 +27034,8 @@ var EC2Provider = class {
26953
27034
  this.logger.debug(`Successfully deleted Route ${logicalId}`);
26954
27035
  } catch (error) {
26955
27036
  if (this.isNotFoundError(error)) {
26956
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
27037
+ const clientRegion = await this.ec2Client.config.region();
27038
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26957
27039
  this.logger.debug(`Route ${physicalId} does not exist, skipping deletion`);
26958
27040
  return;
26959
27041
  }
@@ -26991,7 +27073,8 @@ var EC2Provider = class {
26991
27073
  this.logger.debug(`Successfully deleted SubnetRouteTableAssociation ${logicalId}`);
26992
27074
  } catch (error) {
26993
27075
  if (this.isNotFoundError(error)) {
26994
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
27076
+ const clientRegion = await this.ec2Client.config.region();
27077
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
26995
27078
  this.logger.debug(`SubnetRouteTableAssociation ${physicalId} does not exist, skipping deletion`);
26996
27079
  return;
26997
27080
  }
@@ -27142,7 +27225,8 @@ var EC2Provider = class {
27142
27225
  return;
27143
27226
  } catch (error) {
27144
27227
  if (this.isNotFoundError(error)) {
27145
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
27228
+ const clientRegion = await this.ec2Client.config.region();
27229
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
27146
27230
  this.logger.debug(`SecurityGroup ${physicalId} does not exist, skipping deletion`);
27147
27231
  return;
27148
27232
  }
@@ -27372,7 +27456,8 @@ var EC2Provider = class {
27372
27456
  this.logger.debug(`Successfully deleted SecurityGroupIngress ${logicalId}`);
27373
27457
  } catch (error) {
27374
27458
  if (this.isNotFoundError(error)) {
27375
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
27459
+ const clientRegion = await this.ec2Client.config.region();
27460
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
27376
27461
  this.logger.debug(`SecurityGroupIngress ${physicalId} does not exist, skipping deletion`);
27377
27462
  return;
27378
27463
  }
@@ -27431,10 +27516,12 @@ var EC2Provider = class {
27431
27516
  maxDelay: 5
27432
27517
  }, { InstanceIds: [instanceId] });
27433
27518
  } else this.logger.debug(`Instance ${instanceId} launched (skipping running-state wait per --no-wait)`);
27434
- if (iamInstanceProfile) if (process.env["CDKD_NO_WAIT"] === "true") {
27435
- const profileRef = iamInstanceProfile.arn ?? iamInstanceProfile.name;
27436
- this.logger.warn(`Skipped the IAM instance profile association check for ${logicalId} (${instanceId}) because --no-wait leaves the instance in 'pending', where AssociateIamInstanceProfile is rejected. RunInstances associates the profile asynchronously and can complete with NO profile attached when the profile was created moments earlier. Verify with: aws ec2 describe-iam-instance-profile-associations --filters Name=instance-id,Values=${instanceId} — and if it is missing, re-associate with: aws ec2 associate-iam-instance-profile --instance-id ${instanceId} --iam-instance-profile ${iamInstanceProfile.arn ? `Arn=${profileRef}` : `Name=${profileRef}`}`);
27437
- } else await this.ensureIamInstanceProfileAssociated(instanceId, iamInstanceProfile.arn, iamInstanceProfile.name, logicalId);
27519
+ if (iamInstanceProfile) {
27520
+ if (process.env["CDKD_NO_WAIT"] === "true") {
27521
+ const profileRef = iamInstanceProfile.arn ?? iamInstanceProfile.name;
27522
+ this.logger.warn(`Skipped the IAM instance profile association check for ${logicalId} (${instanceId}) because --no-wait leaves the instance in 'pending', where AssociateIamInstanceProfile is rejected. RunInstances associates the profile asynchronously and can complete with NO profile attached when the profile was created moments earlier. Verify with: aws ec2 describe-iam-instance-profile-associations --filters Name=instance-id,Values=${instanceId} — and if it is missing, re-associate with: aws ec2 associate-iam-instance-profile --instance-id ${instanceId} --iam-instance-profile ${iamInstanceProfile.arn ? `Arn=${profileRef}` : `Name=${profileRef}`}`);
27523
+ } else await this.ensureIamInstanceProfileAssociated(instanceId, iamInstanceProfile.arn, iamInstanceProfile.name, logicalId);
27524
+ }
27438
27525
  const runningInstance = (await this.ec2Client.send(new DescribeInstancesCommand({ InstanceIds: [instanceId] }))).Reservations?.[0]?.Instances?.[0];
27439
27526
  const attributes = {
27440
27527
  InstanceId: instanceId,
@@ -27644,8 +27731,10 @@ var EC2Provider = class {
27644
27731
  }));
27645
27732
  const newMonitoring = this.coerceBool(properties["Monitoring"]);
27646
27733
  const oldMonitoring = this.coerceBool(previousProperties["Monitoring"]);
27647
- if (newMonitoring !== void 0 && newMonitoring !== oldMonitoring) if (newMonitoring) await this.ec2Client.send(new MonitorInstancesCommand({ InstanceIds: [physicalId] }));
27648
- else await this.ec2Client.send(new UnmonitorInstancesCommand({ InstanceIds: [physicalId] }));
27734
+ if (newMonitoring !== void 0 && newMonitoring !== oldMonitoring) {
27735
+ if (newMonitoring) await this.ec2Client.send(new MonitorInstancesCommand({ InstanceIds: [physicalId] }));
27736
+ else await this.ec2Client.send(new UnmonitorInstancesCommand({ InstanceIds: [physicalId] }));
27737
+ }
27649
27738
  const newMetadata = this.buildMetadataOptions(properties);
27650
27739
  const oldMetadata = this.buildMetadataOptions(previousProperties);
27651
27740
  if (newMetadata !== void 0 && !this.shallowEqual(newMetadata, oldMetadata)) await this.ec2Client.send(new ModifyInstanceMetadataOptionsCommand({
@@ -27691,7 +27780,8 @@ var EC2Provider = class {
27691
27780
  return;
27692
27781
  } catch (error) {
27693
27782
  if (this.isNotFoundError(error)) {
27694
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
27783
+ const clientRegion = await this.ec2Client.config.region();
27784
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
27695
27785
  this.logger.debug(`EC2 Instance ${physicalId} already terminated (not found), treating as success`);
27696
27786
  return;
27697
27787
  }
@@ -27996,7 +28086,8 @@ var EC2Provider = class {
27996
28086
  this.logger.debug(`Successfully deleted NetworkAcl ${logicalId}`);
27997
28087
  } catch (error) {
27998
28088
  if (this.isNotFoundError(error)) {
27999
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
28089
+ const clientRegion = await this.ec2Client.config.region();
28090
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
28000
28091
  this.logger.debug(`NetworkAcl ${physicalId} does not exist, skipping deletion`);
28001
28092
  return;
28002
28093
  }
@@ -28080,7 +28171,8 @@ var EC2Provider = class {
28080
28171
  this.logger.debug(`Successfully deleted NetworkAclEntry ${logicalId}`);
28081
28172
  } catch (error) {
28082
28173
  if (this.isNotFoundError(error)) {
28083
- assertRegionMatch(await this.ec2Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
28174
+ const clientRegion = await this.ec2Client.config.region();
28175
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
28084
28176
  this.logger.debug(`NetworkAclEntry ${physicalId} does not exist, skipping deletion`);
28085
28177
  return;
28086
28178
  }
@@ -28722,8 +28814,10 @@ var EC2Provider = class {
28722
28814
  if (route.DestinationCidrBlock !== void 0) result["DestinationCidrBlock"] = route.DestinationCidrBlock;
28723
28815
  else if (route.DestinationIpv6CidrBlock !== void 0) result["DestinationIpv6CidrBlock"] = route.DestinationIpv6CidrBlock;
28724
28816
  else if (route.DestinationPrefixListId !== void 0) result["DestinationPrefixListId"] = route.DestinationPrefixListId;
28725
- if (route.GatewayId !== void 0) if (route.GatewayId.startsWith("vpce-")) result["VpcEndpointId"] = route.GatewayId;
28726
- else result["GatewayId"] = route.GatewayId;
28817
+ if (route.GatewayId !== void 0) {
28818
+ if (route.GatewayId.startsWith("vpce-")) result["VpcEndpointId"] = route.GatewayId;
28819
+ else result["GatewayId"] = route.GatewayId;
28820
+ }
28727
28821
  if (route.NatGatewayId !== void 0) result["NatGatewayId"] = route.NatGatewayId;
28728
28822
  if (route.InstanceId !== void 0) result["InstanceId"] = route.InstanceId;
28729
28823
  if (route.NetworkInterfaceId !== void 0) result["NetworkInterfaceId"] = route.NetworkInterfaceId;
@@ -29577,7 +29671,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
29577
29671
  this.logger.debug(`Successfully deleted API Gateway Authorizer ${logicalId}`);
29578
29672
  } catch (error) {
29579
29673
  if (error instanceof NotFoundException$1) {
29580
- assertRegionMatch(await this.apiGatewayClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
29674
+ const clientRegion = await this.apiGatewayClient.config.region();
29675
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
29581
29676
  this.logger.debug(`API Gateway Authorizer ${physicalId} does not exist, skipping deletion`);
29582
29677
  return;
29583
29678
  }
@@ -29669,7 +29764,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
29669
29764
  this.logger.debug(`Successfully deleted API Gateway Resource ${logicalId}`);
29670
29765
  } catch (error) {
29671
29766
  if (error instanceof NotFoundException$1) {
29672
- assertRegionMatch(await this.apiGatewayClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
29767
+ const clientRegion = await this.apiGatewayClient.config.region();
29768
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
29673
29769
  this.logger.debug(`API Gateway Resource ${physicalId} does not exist, skipping deletion`);
29674
29770
  return;
29675
29771
  }
@@ -29731,7 +29827,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
29731
29827
  this.logger.debug(`Successfully deleted API Gateway Deployment ${logicalId}`);
29732
29828
  } catch (error) {
29733
29829
  if (error instanceof NotFoundException$1) {
29734
- assertRegionMatch(await this.apiGatewayClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
29830
+ const clientRegion = await this.apiGatewayClient.config.region();
29831
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
29735
29832
  this.logger.debug(`API Gateway Deployment ${physicalId} does not exist, skipping deletion`);
29736
29833
  return;
29737
29834
  }
@@ -29982,7 +30079,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
29982
30079
  this.logger.debug(`Successfully deleted API Gateway Stage ${logicalId}`);
29983
30080
  } catch (error) {
29984
30081
  if (error instanceof NotFoundException$1) {
29985
- assertRegionMatch(await this.apiGatewayClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
30082
+ const clientRegion = await this.apiGatewayClient.config.region();
30083
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
29986
30084
  this.logger.debug(`API Gateway Stage ${physicalId} does not exist, skipping deletion`);
29987
30085
  return;
29988
30086
  }
@@ -30291,7 +30389,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
30291
30389
  this.logger.debug(`Successfully deleted API Gateway Method ${logicalId}`);
30292
30390
  } catch (error) {
30293
30391
  if (error instanceof NotFoundException$1) {
30294
- assertRegionMatch(await this.apiGatewayClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
30392
+ const clientRegion = await this.apiGatewayClient.config.region();
30393
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
30295
30394
  this.logger.debug(`API Gateway Method ${physicalId} does not exist, skipping deletion`);
30296
30395
  return;
30297
30396
  }
@@ -31009,7 +31108,8 @@ var ApiGatewayV2Provider = class {
31009
31108
  this.logger.debug(`Successfully deleted API Gateway V2 Api ${logicalId}`);
31010
31109
  } catch (error) {
31011
31110
  if (error instanceof NotFoundException$3) {
31012
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
31111
+ const clientRegion = await this.getClient().config.region();
31112
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
31013
31113
  this.logger.debug(`API Gateway V2 Api ${physicalId} does not exist, skipping deletion`);
31014
31114
  return;
31015
31115
  }
@@ -31061,7 +31161,8 @@ var ApiGatewayV2Provider = class {
31061
31161
  this.logger.debug(`Successfully deleted API Gateway V2 Stage ${logicalId}`);
31062
31162
  } catch (error) {
31063
31163
  if (error instanceof NotFoundException$3) {
31064
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
31164
+ const clientRegion = await this.getClient().config.region();
31165
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
31065
31166
  this.logger.debug(`API Gateway V2 Stage ${physicalId} does not exist, skipping deletion`);
31066
31167
  return;
31067
31168
  }
@@ -31121,7 +31222,8 @@ var ApiGatewayV2Provider = class {
31121
31222
  this.logger.debug(`Successfully deleted API Gateway V2 Integration ${logicalId}`);
31122
31223
  } catch (error) {
31123
31224
  if (error instanceof NotFoundException$3) {
31124
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
31225
+ const clientRegion = await this.getClient().config.region();
31226
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
31125
31227
  this.logger.debug(`API Gateway V2 Integration ${physicalId} does not exist, skipping deletion`);
31126
31228
  return;
31127
31229
  }
@@ -31174,7 +31276,8 @@ var ApiGatewayV2Provider = class {
31174
31276
  this.logger.debug(`Successfully deleted API Gateway V2 Route ${logicalId}`);
31175
31277
  } catch (error) {
31176
31278
  if (error instanceof NotFoundException$3) {
31177
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
31279
+ const clientRegion = await this.getClient().config.region();
31280
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
31178
31281
  this.logger.debug(`API Gateway V2 Route ${physicalId} does not exist, skipping deletion`);
31179
31282
  return;
31180
31283
  }
@@ -31227,7 +31330,8 @@ var ApiGatewayV2Provider = class {
31227
31330
  this.logger.debug(`Successfully deleted API Gateway V2 Authorizer ${logicalId}`);
31228
31331
  } catch (error) {
31229
31332
  if (error instanceof NotFoundException$3) {
31230
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
31333
+ const clientRegion = await this.getClient().config.region();
31334
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
31231
31335
  this.logger.debug(`API Gateway V2 Authorizer ${physicalId} does not exist, skipping deletion`);
31232
31336
  return;
31233
31337
  }
@@ -32368,7 +32472,8 @@ var CloudFrontOAIProvider = class {
32368
32472
  etag = (await this.cloudFrontClient.send(new GetCloudFrontOriginAccessIdentityCommand({ Id: physicalId }))).ETag;
32369
32473
  } catch (error) {
32370
32474
  if (error instanceof NoSuchCloudFrontOriginAccessIdentity) {
32371
- assertRegionMatch(await this.cloudFrontClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
32475
+ const clientRegion = await this.cloudFrontClient.config.region();
32476
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
32372
32477
  this.logger.debug(`OAI ${physicalId} does not exist, skipping deletion`);
32373
32478
  return;
32374
32479
  }
@@ -32381,7 +32486,8 @@ var CloudFrontOAIProvider = class {
32381
32486
  this.logger.debug(`Successfully deleted CloudFront OAI ${logicalId}`);
32382
32487
  } catch (error) {
32383
32488
  if (error instanceof NoSuchCloudFrontOriginAccessIdentity) {
32384
- assertRegionMatch(await this.cloudFrontClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
32489
+ const clientRegion = await this.cloudFrontClient.config.region();
32490
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
32385
32491
  this.logger.debug(`OAI ${physicalId} does not exist, skipping deletion`);
32386
32492
  return;
32387
32493
  }
@@ -32705,7 +32811,8 @@ var CloudFrontOACProvider = class {
32705
32811
  * region matches the region the resource was recorded in.
32706
32812
  */
32707
32813
  async assertDeleteRegion(resourceType, logicalId, physicalId, context) {
32708
- assertRegionMatch(await this.cloudFrontClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
32814
+ const clientRegion = await this.cloudFrontClient.config.region();
32815
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
32709
32816
  }
32710
32817
  };
32711
32818
 
@@ -33012,7 +33119,8 @@ var CloudFrontDistributionProvider = class {
33012
33119
  config = getConfigResponse.DistributionConfig;
33013
33120
  } catch (error) {
33014
33121
  if (error instanceof NoSuchDistribution) {
33015
- assertRegionMatch(await this.cloudFrontClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
33122
+ const clientRegion = await this.cloudFrontClient.config.region();
33123
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
33016
33124
  this.logger.debug(`Distribution ${physicalId} does not exist, skipping deletion`);
33017
33125
  return;
33018
33126
  }
@@ -33039,7 +33147,8 @@ var CloudFrontDistributionProvider = class {
33039
33147
  this.logger.debug(`Successfully deleted CloudFront Distribution ${logicalId}`);
33040
33148
  } catch (error) {
33041
33149
  if (error instanceof NoSuchDistribution) {
33042
- assertRegionMatch(await this.cloudFrontClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
33150
+ const clientRegion = await this.cloudFrontClient.config.region();
33151
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
33043
33152
  this.logger.debug(`Distribution ${physicalId} does not exist, skipping deletion`);
33044
33153
  return;
33045
33154
  }
@@ -33178,7 +33287,7 @@ var CloudFrontDistributionProvider = class {
33178
33287
  * warning applies), `false` on budget exhaustion.
33179
33288
  */
33180
33289
  async waitForDistributionStable(distributionId, expectedEnabled) {
33181
- const budgetMs = Math.max(1200 * 1e3, resolvedResourceTimeoutMs("AWS::CloudFront::Distribution") ?? 0);
33290
+ const budgetMs = Math.max(12e5, resolvedResourceTimeoutMs("AWS::CloudFront::Distribution") ?? 0);
33182
33291
  const deadline = Date.now() + budgetMs;
33183
33292
  let delay = 5e3;
33184
33293
  const maxDelay = 1e4;
@@ -33943,7 +34052,8 @@ var AgentCoreRuntimeProvider = class {
33943
34052
  this.logger.debug(`Successfully deleted BedrockAgentCore Runtime ${logicalId}`);
33944
34053
  } catch (error) {
33945
34054
  if (error instanceof ResourceNotFoundException$6) {
33946
- assertRegionMatch(await this.client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
34055
+ const clientRegion = await this.client.config.region();
34056
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
33947
34057
  this.logger.debug(`Runtime ${physicalId} does not exist, skipping deletion`);
33948
34058
  return;
33949
34059
  }
@@ -34513,7 +34623,8 @@ var AgentCoreEvaluatorProvider = class {
34513
34623
  this.logger.debug(`Successfully deleted BedrockAgentCore Evaluator ${logicalId}`);
34514
34624
  } catch (error) {
34515
34625
  if (error instanceof ResourceNotFoundException$6) {
34516
- assertRegionMatch(await this.client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
34626
+ const clientRegion = await this.client.config.region();
34627
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
34517
34628
  this.logger.debug(`Evaluator ${physicalId} does not exist, skipping deletion`);
34518
34629
  return;
34519
34630
  }
@@ -34728,7 +34839,8 @@ var StepFunctionsProvider = class {
34728
34839
  this.logger.debug(`Successfully deleted Step Functions state machine ${logicalId}`);
34729
34840
  } catch (error) {
34730
34841
  if (error instanceof StateMachineDoesNotExist) {
34731
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
34842
+ const clientRegion = await this.getClient().config.region();
34843
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
34732
34844
  this.logger.debug(`Step Functions state machine ${physicalId} does not exist, skipping deletion`);
34733
34845
  return;
34734
34846
  }
@@ -34797,7 +34909,8 @@ var StepFunctionsProvider = class {
34797
34909
  result["EncryptionConfiguration"] = ec;
34798
34910
  }
34799
34911
  try {
34800
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$11({ resourceArn: physicalId }))).tags);
34912
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$11({ resourceArn: physicalId }));
34913
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.tags);
34801
34914
  } catch (err) {
34802
34915
  if (!(err instanceof StateMachineDoesNotExist)) throw err;
34803
34916
  }
@@ -35376,7 +35489,8 @@ var ECSProvider = class {
35376
35489
  this.logger.debug(`Successfully deleted ECS cluster ${logicalId}`);
35377
35490
  } catch (error) {
35378
35491
  if (this.isClusterNotFoundException(error)) {
35379
- assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
35492
+ const clientRegion = await client.config.region();
35493
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
35380
35494
  this.logger.debug(`ECS cluster ${physicalId} not found, skipping deletion`);
35381
35495
  return;
35382
35496
  }
@@ -35437,7 +35551,8 @@ var ECSProvider = class {
35437
35551
  this.logger.debug(`Successfully deregistered ECS task definition ${logicalId}`);
35438
35552
  } catch (error) {
35439
35553
  if (this.isNotFoundException(error)) {
35440
- assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
35554
+ const clientRegion = await client.config.region();
35555
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
35441
35556
  this.logger.debug(`ECS task definition ${physicalId} not found, skipping deletion`);
35442
35557
  return;
35443
35558
  }
@@ -35659,7 +35774,8 @@ var ECSProvider = class {
35659
35774
  this.logger.debug(`Scaled down ECS service ${physicalId} to 0`);
35660
35775
  } catch (error) {
35661
35776
  if (this.isServiceNotFoundException(error)) {
35662
- assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
35777
+ const clientRegion = await client.config.region();
35778
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
35663
35779
  this.logger.debug(`ECS service ${physicalId} not found during scale down, skipping deletion`);
35664
35780
  return;
35665
35781
  }
@@ -35673,7 +35789,8 @@ var ECSProvider = class {
35673
35789
  this.logger.debug(`Successfully deleted ECS service ${logicalId}`);
35674
35790
  } catch (error) {
35675
35791
  if (this.isServiceNotFoundException(error)) {
35676
- assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
35792
+ const clientRegion = await client.config.region();
35793
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
35677
35794
  this.logger.debug(`ECS service ${physicalId} not found, skipping deletion`);
35678
35795
  return;
35679
35796
  }
@@ -37267,15 +37384,18 @@ var ELBv2Provider = class {
37267
37384
  for (const [k, v] of Object.entries(p)) if (!handledKeys.has(k)) out[k] = v;
37268
37385
  return out;
37269
37386
  };
37270
- if (JSON.stringify(stripHandled(properties)) !== JSON.stringify(stripHandled(previousProperties))) throw new ResourceUpdateNotSupportedError("AWS::ElasticLoadBalancingV2::LoadBalancer", logicalId, "ELBv2 LoadBalancer Name / Type / Scheme are immutable on AWS — none of the ELBv2 Modify* / Set* APIs accept these fields; they are fixed at creation. cdkd handles LoadBalancerAttributes / Subnets / SubnetMappings / SecurityGroups / IpAddressType / Tags in-place. " + (this.normalizeAttributes(previousProperties["LoadBalancerAttributes"]).some((a) => a.Key === "deletion_protection.enabled" && isTruthyCfnBoolean(a.Value)) ? protectedReplacementAdvice({
37271
- evidence: "cdkd's recorded properties for this load balancer carry LoadBalancerAttributes deletion_protection.enabled=true",
37272
- replaceFlags: "cdkd deploy --replace",
37273
- disable: {
37274
- before: "aws elbv2 modify-load-balancer-attributes --load-balancer-arn",
37275
- identifier: physicalId,
37276
- after: "--attributes Key=deletion_protection.enabled,Value=false"
37277
- }
37278
- }) : "For Name / Type / Scheme re-deploy with cdkd deploy --replace, or destroy + redeploy the stack."));
37387
+ if (JSON.stringify(stripHandled(properties)) !== JSON.stringify(stripHandled(previousProperties))) {
37388
+ const remedy = this.normalizeAttributes(previousProperties["LoadBalancerAttributes"]).some((a) => a.Key === "deletion_protection.enabled" && isTruthyCfnBoolean(a.Value)) ? protectedReplacementAdvice({
37389
+ evidence: "cdkd's recorded properties for this load balancer carry LoadBalancerAttributes deletion_protection.enabled=true",
37390
+ replaceFlags: "cdkd deploy --replace",
37391
+ disable: {
37392
+ before: "aws elbv2 modify-load-balancer-attributes --load-balancer-arn",
37393
+ identifier: physicalId,
37394
+ after: "--attributes Key=deletion_protection.enabled,Value=false"
37395
+ }
37396
+ }) : "For Name / Type / Scheme re-deploy with cdkd deploy --replace, or destroy + redeploy the stack.";
37397
+ throw new ResourceUpdateNotSupportedError("AWS::ElasticLoadBalancingV2::LoadBalancer", logicalId, "ELBv2 LoadBalancer Name / Type / Scheme are immutable on AWS — none of the ELBv2 Modify* / Set* APIs accept these fields; they are fixed at creation. cdkd handles LoadBalancerAttributes / Subnets / SubnetMappings / SecurityGroups / IpAddressType / Tags in-place. " + remedy);
37398
+ }
37279
37399
  const submittedAttrs = this.diffAttributes(this.normalizeAttributes(properties["LoadBalancerAttributes"]), this.normalizeAttributes(previousProperties["LoadBalancerAttributes"]), this.attributeRemovalResolver(LOAD_BALANCER_ATTRIBUTE_DEFAULTS));
37280
37400
  if (submittedAttrs.length > 0) {
37281
37401
  await this.getClient().send(new ModifyLoadBalancerAttributesCommand({
@@ -37409,7 +37529,8 @@ var ELBv2Provider = class {
37409
37529
  this.logger.debug(`Successfully deleted LoadBalancer ${logicalId}`);
37410
37530
  } catch (error) {
37411
37531
  if (this.isNotFoundError(error)) {
37412
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
37532
+ const clientRegion = await this.getClient().config.region();
37533
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
37413
37534
  this.logger.debug(`LoadBalancer ${physicalId} does not exist, skipping deletion`);
37414
37535
  return;
37415
37536
  }
@@ -37574,7 +37695,8 @@ var ELBv2Provider = class {
37574
37695
  this.logger.debug(`Successfully deleted TargetGroup ${logicalId}`);
37575
37696
  } catch (error) {
37576
37697
  if (this.isNotFoundError(error)) {
37577
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
37698
+ const clientRegion = await this.getClient().config.region();
37699
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
37578
37700
  this.logger.debug(`TargetGroup ${physicalId} does not exist, skipping deletion`);
37579
37701
  return;
37580
37702
  }
@@ -37694,7 +37816,8 @@ var ELBv2Provider = class {
37694
37816
  this.logger.debug(`Successfully deleted Listener ${logicalId}`);
37695
37817
  } catch (error) {
37696
37818
  if (this.isNotFoundError(error)) {
37697
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
37819
+ const clientRegion = await this.getClient().config.region();
37820
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
37698
37821
  this.logger.debug(`Listener ${physicalId} does not exist, skipping deletion`);
37699
37822
  return;
37700
37823
  }
@@ -38424,7 +38547,8 @@ var RDSProvider = class {
38424
38547
  this.logger.debug(`Successfully deleted DBSubnetGroup ${logicalId}`);
38425
38548
  } catch (error) {
38426
38549
  if (this.isNotFoundError(error, "DBSubnetGroupNotFoundFault")) {
38427
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
38550
+ const clientRegion = await this.getClient().config.region();
38551
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
38428
38552
  this.logger.debug(`DBSubnetGroup ${physicalId} does not exist, skipping deletion`);
38429
38553
  return;
38430
38554
  }
@@ -38582,7 +38706,8 @@ var RDSProvider = class {
38582
38706
  await this.waitForClusterDeleted(physicalId);
38583
38707
  } catch (error) {
38584
38708
  if (this.isNotFoundError(error, "DBClusterNotFoundFault")) {
38585
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
38709
+ const clientRegion = await this.getClient().config.region();
38710
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
38586
38711
  this.logger.debug(`DBCluster ${physicalId} does not exist, skipping deletion`);
38587
38712
  return;
38588
38713
  }
@@ -38709,7 +38834,8 @@ var RDSProvider = class {
38709
38834
  await this.waitForInstanceDeleted(physicalId);
38710
38835
  } catch (error) {
38711
38836
  if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) {
38712
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
38837
+ const clientRegion = await this.getClient().config.region();
38838
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
38713
38839
  this.logger.debug(`DBInstance ${physicalId} does not exist, skipping deletion`);
38714
38840
  return;
38715
38841
  }
@@ -38980,7 +39106,8 @@ var RDSProvider = class {
38980
39106
  */
38981
39107
  async attachTags(result, arn) {
38982
39108
  try {
38983
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$10({ ResourceName: arn }))).TagList);
39109
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$10({ ResourceName: arn }));
39110
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
38984
39111
  } catch (err) {
38985
39112
  this.logger.debug(`RDS ListTagsForResource(${arn}) failed: ${err instanceof Error ? err.message : String(err)}`);
38986
39113
  }
@@ -39032,7 +39159,7 @@ var RDSProvider = class {
39032
39159
  //#endregion
39033
39160
  //#region src/provisioning/providers/rds-dbproxy-provider.ts
39034
39161
  const POLL_INTERVAL_MS$1 = 5e3;
39035
- const POLL_TIMEOUT_MS$1 = 1800 * 1e3;
39162
+ const POLL_TIMEOUT_MS$1 = 18e5;
39036
39163
  /**
39037
39164
  * AWS RDS DBProxy Provider
39038
39165
  *
@@ -39195,7 +39322,8 @@ var RDSDBProxyProvider = class {
39195
39322
  await client.send(new DeleteDBProxyCommand({ DBProxyName: physicalId }));
39196
39323
  } catch (error) {
39197
39324
  if (error instanceof DBProxyNotFoundFault) {
39198
- assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
39325
+ const clientRegion = await client.config.region();
39326
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
39199
39327
  this.logger.debug(`DBProxy ${physicalId} already gone, treating as success`);
39200
39328
  return;
39201
39329
  }
@@ -39278,7 +39406,8 @@ var RDSDBProxyProvider = class {
39278
39406
  }))
39279
39407
  };
39280
39408
  if (p.DBProxyArn) try {
39281
- result["Tags"] = normalizeAwsTagsToCfn((await client.send(new ListTagsForResourceCommand$10({ ResourceName: p.DBProxyArn }))).TagList ?? []);
39409
+ const tagResp = await client.send(new ListTagsForResourceCommand$10({ ResourceName: p.DBProxyArn }));
39410
+ result["Tags"] = normalizeAwsTagsToCfn(tagResp.TagList ?? []);
39282
39411
  } catch (error) {
39283
39412
  this.logger.debug(`ListTagsForResource failed for ${physicalId}: ${error instanceof Error ? error.message : String(error)}`);
39284
39413
  result["Tags"] = [];
@@ -39370,7 +39499,7 @@ var RDSDBProxyProvider = class {
39370
39499
  //#endregion
39371
39500
  //#region src/provisioning/providers/rds-dbproxy-endpoint-provider.ts
39372
39501
  const POLL_INTERVAL_MS = 5e3;
39373
- const POLL_TIMEOUT_MS = 1800 * 1e3;
39502
+ const POLL_TIMEOUT_MS = 18e5;
39374
39503
  /**
39375
39504
  * AWS RDS DBProxyEndpoint Provider
39376
39505
  *
@@ -39518,7 +39647,8 @@ var RDSDBProxyEndpointProvider = class {
39518
39647
  await client.send(new DeleteDBProxyEndpointCommand({ DBProxyEndpointName: physicalId }));
39519
39648
  } catch (error) {
39520
39649
  if (error instanceof DBProxyEndpointNotFoundFault || error instanceof DBProxyNotFoundFault) {
39521
- assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
39650
+ const clientRegion = await client.config.region();
39651
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
39522
39652
  this.logger.debug(`DBProxyEndpoint ${physicalId} or parent already gone, treating as success`);
39523
39653
  return;
39524
39654
  }
@@ -39587,7 +39717,8 @@ var RDSDBProxyEndpointProvider = class {
39587
39717
  TargetRole: e.TargetRole ?? "READ_WRITE"
39588
39718
  };
39589
39719
  if (e.DBProxyEndpointArn) try {
39590
- result["Tags"] = normalizeAwsTagsToCfn((await client.send(new ListTagsForResourceCommand$10({ ResourceName: e.DBProxyEndpointArn }))).TagList ?? []);
39720
+ const tagResp = await client.send(new ListTagsForResourceCommand$10({ ResourceName: e.DBProxyEndpointArn }));
39721
+ result["Tags"] = normalizeAwsTagsToCfn(tagResp.TagList ?? []);
39591
39722
  } catch (error) {
39592
39723
  this.logger.debug(`ListTagsForResource failed for ${physicalId}: ${error instanceof Error ? error.message : String(error)}`);
39593
39724
  result["Tags"] = [];
@@ -39880,7 +40011,8 @@ var RDSDBProxyTargetGroupProvider = class {
39880
40011
  }));
39881
40012
  } catch (error) {
39882
40013
  if (error instanceof DBProxyNotFoundFault || error instanceof DBProxyTargetGroupNotFoundFault || error instanceof DBProxyTargetNotFoundFault) {
39883
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
40014
+ const clientRegion = await this.getClient().config.region();
40015
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
39884
40016
  this.logger.debug(`${dbProxyName}/${targetGroupName} or its target is already gone, treating as success`);
39885
40017
  return;
39886
40018
  }
@@ -40129,7 +40261,8 @@ var DocDBProvider = class {
40129
40261
  this.logger.debug(`Successfully deleted DocDB DBSubnetGroup ${logicalId}`);
40130
40262
  } catch (error) {
40131
40263
  if (this.isNotFoundError(error, "DBSubnetGroupNotFoundFault")) {
40132
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
40264
+ const clientRegion = await this.getClient().config.region();
40265
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
40133
40266
  this.logger.debug(`DocDB DBSubnetGroup ${physicalId} does not exist, skipping deletion`);
40134
40267
  return;
40135
40268
  }
@@ -40245,7 +40378,8 @@ var DocDBProvider = class {
40245
40378
  await this.waitForClusterDeleted(physicalId);
40246
40379
  } catch (error) {
40247
40380
  if (this.isNotFoundError(error, "DBClusterNotFoundFault")) {
40248
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
40381
+ const clientRegion = await this.getClient().config.region();
40382
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
40249
40383
  this.logger.debug(`DocDB DBCluster ${physicalId} does not exist, skipping deletion`);
40250
40384
  return;
40251
40385
  }
@@ -40323,7 +40457,8 @@ var DocDBProvider = class {
40323
40457
  await this.waitForInstanceDeleted(physicalId);
40324
40458
  } catch (error) {
40325
40459
  if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) {
40326
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
40460
+ const clientRegion = await this.getClient().config.region();
40461
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
40327
40462
  this.logger.debug(`DocDB DBInstance ${physicalId} does not exist, skipping deletion`);
40328
40463
  return;
40329
40464
  }
@@ -40564,7 +40699,8 @@ var DocDBProvider = class {
40564
40699
  */
40565
40700
  async attachTags(result, arn) {
40566
40701
  try {
40567
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$12({ ResourceName: arn }))).TagList);
40702
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$12({ ResourceName: arn }));
40703
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
40568
40704
  } catch (err) {
40569
40705
  this.logger.debug(`DocDB ListTagsForResource(${arn}) failed: ${err instanceof Error ? err.message : String(err)}`);
40570
40706
  }
@@ -40765,7 +40901,8 @@ var NeptuneProvider = class {
40765
40901
  this.logger.debug(`Successfully deleted Neptune DBSubnetGroup ${logicalId}`);
40766
40902
  } catch (error) {
40767
40903
  if (this.isNotFoundError(error, "DBSubnetGroupNotFoundFault")) {
40768
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
40904
+ const clientRegion = await this.getClient().config.region();
40905
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
40769
40906
  this.logger.debug(`Neptune DBSubnetGroup ${physicalId} does not exist, skipping deletion`);
40770
40907
  return;
40771
40908
  }
@@ -40878,7 +41015,8 @@ var NeptuneProvider = class {
40878
41015
  await this.waitForClusterDeleted(physicalId);
40879
41016
  } catch (error) {
40880
41017
  if (this.isNotFoundError(error, "DBClusterNotFoundFault")) {
40881
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
41018
+ const clientRegion = await this.getClient().config.region();
41019
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
40882
41020
  this.logger.debug(`Neptune DBCluster ${physicalId} does not exist, skipping deletion`);
40883
41021
  return;
40884
41022
  }
@@ -40972,7 +41110,8 @@ var NeptuneProvider = class {
40972
41110
  await this.waitForInstanceDeleted(physicalId);
40973
41111
  } catch (error) {
40974
41112
  if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) {
40975
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
41113
+ const clientRegion = await this.getClient().config.region();
41114
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
40976
41115
  this.logger.debug(`Neptune DBInstance ${physicalId} does not exist, skipping deletion`);
40977
41116
  return;
40978
41117
  }
@@ -41203,7 +41342,8 @@ var NeptuneProvider = class {
41203
41342
  */
41204
41343
  async attachTags(result, arn) {
41205
41344
  try {
41206
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$13({ ResourceName: arn }))).TagList);
41345
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$13({ ResourceName: arn }));
41346
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
41207
41347
  } catch (err) {
41208
41348
  this.logger.debug(`Neptune ListTagsForResource(${arn}) failed: ${err instanceof Error ? err.message : String(err)}`);
41209
41349
  }
@@ -41666,7 +41806,8 @@ var Route53Provider = class {
41666
41806
  this.logger.debug(`Successfully deleted hosted zone ${logicalId}`);
41667
41807
  } catch (error) {
41668
41808
  if (error instanceof Error && error.name === "NoSuchHostedZone") {
41669
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
41809
+ const clientRegion = await this.getClient().config.region();
41810
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
41670
41811
  this.logger.debug(`Hosted zone ${physicalId} does not exist, skipping deletion`);
41671
41812
  return;
41672
41813
  }
@@ -41863,7 +42004,8 @@ var Route53Provider = class {
41863
42004
  hostedZoneId = await this.resolveHostedZoneId(properties, logicalId, resourceType, physicalId, { requireUnambiguousZoneName: true });
41864
42005
  } catch (error) {
41865
42006
  if (error instanceof HostedZoneNameNotFoundError) {
41866
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
42007
+ const clientRegion = await this.getClient().config.region();
42008
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
41867
42009
  this.logger.warn(`Hosted zone "${String(properties?.["HostedZoneName"])}" for record set ${logicalId} (${physicalId}) no longer exists; treating the record as already deleted and dropping it from state.`);
41868
42010
  return;
41869
42011
  }
@@ -41889,7 +42031,8 @@ var Route53Provider = class {
41889
42031
  this.logger.debug(`Successfully deleted record set ${logicalId}`);
41890
42032
  } catch (error) {
41891
42033
  if (error instanceof Error && (error.name === "InvalidChangeBatch" || error.message.includes("it was not found"))) {
41892
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
42034
+ const clientRegion = await this.getClient().config.region();
42035
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
41893
42036
  this.logger.debug(`Record set ${physicalId} does not exist, skipping deletion`);
41894
42037
  return;
41895
42038
  }
@@ -42362,10 +42505,11 @@ var Route53Provider = class {
42362
42505
  });
42363
42506
  const idTail = physicalId.replace(/^\/hostedzone\//, "");
42364
42507
  try {
42365
- result["HostedZoneTags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$8({
42508
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$8({
42366
42509
  ResourceType: "hostedzone",
42367
42510
  ResourceId: idTail
42368
- }))).ResourceTagSet?.Tags);
42511
+ }));
42512
+ result["HostedZoneTags"] = normalizeAwsTagsToCfn(tagsResp.ResourceTagSet?.Tags);
42369
42513
  } catch (err) {
42370
42514
  this.logger.debug(`Route53 ListTagsForResource(${idTail}) failed: ${err instanceof Error ? err.message : String(err)}`);
42371
42515
  }
@@ -44028,7 +44172,8 @@ var CognitoUserPoolProvider = class {
44028
44172
  needsFlip = (await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: physicalId }))).UserPool?.DeletionProtection === "ACTIVE";
44029
44173
  } catch (descError) {
44030
44174
  if (descError instanceof ResourceNotFoundException$9) {
44031
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
44175
+ const clientRegion = await this.getClient().config.region();
44176
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
44032
44177
  this.logger.debug(`Cognito User Pool ${physicalId} does not exist, skipping deletion`);
44033
44178
  return;
44034
44179
  }
@@ -44051,7 +44196,8 @@ var CognitoUserPoolProvider = class {
44051
44196
  this.logger.debug(`Successfully deleted Cognito User Pool ${logicalId}`);
44052
44197
  } catch (error) {
44053
44198
  if (error instanceof ResourceNotFoundException$9) {
44054
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
44199
+ const clientRegion = await this.getClient().config.region();
44200
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
44055
44201
  this.logger.debug(`Cognito User Pool ${physicalId} does not exist, skipping deletion`);
44056
44202
  return;
44057
44203
  }
@@ -44302,7 +44448,8 @@ var ElastiCacheProvider = class {
44302
44448
  this.logger.debug(`Successfully deleted CacheSubnetGroup ${logicalId}`);
44303
44449
  } catch (error) {
44304
44450
  if (this.isNotFoundError(error, "CacheSubnetGroupNotFoundFault")) {
44305
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
44451
+ const clientRegion = await this.getClient().config.region();
44452
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
44306
44453
  this.logger.debug(`CacheSubnetGroup ${physicalId} does not exist, skipping deletion`);
44307
44454
  return;
44308
44455
  }
@@ -44428,7 +44575,8 @@ var ElastiCacheProvider = class {
44428
44575
  await this.waitForClusterDeleted(physicalId);
44429
44576
  } catch (error) {
44430
44577
  if (this.isNotFoundError(error, "CacheClusterNotFoundFault")) {
44431
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
44578
+ const clientRegion = await this.getClient().config.region();
44579
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
44432
44580
  this.logger.debug(`CacheCluster ${physicalId} does not exist, skipping deletion`);
44433
44581
  return;
44434
44582
  }
@@ -44635,7 +44783,8 @@ var ElastiCacheProvider = class {
44635
44783
  /** Best-effort tag fetch — failures omit the key without breaking the read. */
44636
44784
  async attachTags(result, arn) {
44637
44785
  try {
44638
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$7({ ResourceName: arn }))).TagList);
44786
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$7({ ResourceName: arn }));
44787
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
44639
44788
  } catch (err) {
44640
44789
  this.logger.debug(`ElastiCache ListTagsForResource(${arn}) failed: ${err instanceof Error ? err.message : String(err)}`);
44641
44790
  }
@@ -44969,7 +45118,8 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
44969
45118
  this.logger.debug(`Successfully deleted Cloud Map namespace ${logicalId}`);
44970
45119
  } catch (error) {
44971
45120
  if (error instanceof NamespaceNotFound) {
44972
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
45121
+ const clientRegion = await this.getClient().config.region();
45122
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
44973
45123
  this.logger.debug(`Namespace ${physicalId} does not exist, skipping deletion`);
44974
45124
  return;
44975
45125
  }
@@ -45299,7 +45449,8 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
45299
45449
  this.logger.debug(`Successfully deleted service discovery service ${logicalId}`);
45300
45450
  } catch (error) {
45301
45451
  if (error instanceof ServiceNotFound) {
45302
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
45452
+ const clientRegion = await this.getClient().config.region();
45453
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
45303
45454
  this.logger.debug(`Service ${physicalId} does not exist, skipping deletion`);
45304
45455
  return;
45305
45456
  }
@@ -45430,7 +45581,10 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
45430
45581
  if (targets) return targets["NAMESPACE"] || targets["SERVICE"] || operationId;
45431
45582
  return operationId;
45432
45583
  }
45433
- if (status === "FAIL") throw new ProvisioningError(`Operation failed for ${logicalId}: ${maskerOrIdentity(maskSecrets)(result.Operation?.ErrorMessage || "Unknown error")}`, resourceType, logicalId);
45584
+ if (status === "FAIL") {
45585
+ const errorMessage = maskerOrIdentity(maskSecrets)(result.Operation?.ErrorMessage || "Unknown error");
45586
+ throw new ProvisioningError(`Operation failed for ${logicalId}: ${errorMessage}`, resourceType, logicalId);
45587
+ }
45434
45588
  await new Promise((resolve) => setTimeout(resolve, delay));
45435
45589
  delay = Math.min(delay * 2, 1e4);
45436
45590
  }
@@ -45596,7 +45750,8 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
45596
45750
  /** Best-effort tag fetch via `ListTagsForResource(ResourceARN)`. */
45597
45751
  async attachTags(result, arn) {
45598
45752
  try {
45599
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$14({ ResourceARN: arn }))).Tags);
45753
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$14({ ResourceARN: arn }));
45754
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
45600
45755
  } catch (err) {
45601
45756
  this.logger.debug(`ServiceDiscovery ListTagsForResource(${arn}) failed: ${err instanceof Error ? err.message : String(err)}`);
45602
45757
  }
@@ -45844,7 +45999,8 @@ var AppSyncProvider = class {
45844
45999
  * at most one `GetCallerIdentity` per deploy.
45845
46000
  */
45846
46001
  async buildAppSyncArn(suffix, regionOverride) {
45847
- const accountInfo = await getAccountInfo(regionOverride ?? this.providerRegion ?? await this.getClient().config.region());
46002
+ const region = regionOverride ?? this.providerRegion ?? await this.getClient().config.region();
46003
+ const accountInfo = await getAccountInfo(region);
45848
46004
  if (accountInfo.fabricated) throw new Error(`cannot determine the AWS account (STS is unreachable, and the resolved account id is a placeholder), so an ARN for ${suffix} would be fabricated`);
45849
46005
  const { partition } = derivePartitionAndUrlSuffix(accountInfo.region);
45850
46006
  return `arn:${partition}:appsync:${canonicalizeRegion(accountInfo.region)}:${accountInfo.accountId}:${suffix}`;
@@ -46880,7 +47036,8 @@ var AppSyncProvider = class {
46880
47036
  this.logger.debug(`Successfully deleted GraphQL API ${logicalId}`);
46881
47037
  } catch (error) {
46882
47038
  if (this.isNotFoundError(error)) {
46883
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
47039
+ const clientRegion = await this.getClient().config.region();
47040
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
46884
47041
  this.logger.debug(`GraphQL API ${physicalId} does not exist, skipping deletion`);
46885
47042
  return;
46886
47043
  }
@@ -46972,7 +47129,8 @@ var AppSyncProvider = class {
46972
47129
  this.logger.debug(`Successfully deleted DataSource ${logicalId}`);
46973
47130
  } catch (error) {
46974
47131
  if (this.isNotFoundError(error)) {
46975
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
47132
+ const clientRegion = await this.getClient().config.region();
47133
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
46976
47134
  this.logger.debug(`DataSource ${physicalId} does not exist, skipping deletion`);
46977
47135
  return;
46978
47136
  }
@@ -47040,7 +47198,8 @@ var AppSyncProvider = class {
47040
47198
  this.logger.debug(`Successfully deleted Resolver ${logicalId}`);
47041
47199
  } catch (error) {
47042
47200
  if (this.isNotFoundError(error)) {
47043
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
47201
+ const clientRegion = await this.getClient().config.region();
47202
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
47044
47203
  this.logger.debug(`Resolver ${physicalId} does not exist, skipping deletion`);
47045
47204
  return;
47046
47205
  }
@@ -47097,7 +47256,8 @@ var AppSyncProvider = class {
47097
47256
  this.logger.debug(`Successfully deleted ApiKey ${logicalId}`);
47098
47257
  } catch (error) {
47099
47258
  if (this.isNotFoundError(error)) {
47100
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
47259
+ const clientRegion = await this.getClient().config.region();
47260
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
47101
47261
  this.logger.debug(`ApiKey ${physicalId} does not exist, skipping deletion`);
47102
47262
  return;
47103
47263
  }
@@ -47756,7 +47916,8 @@ var GlueProvider = class {
47756
47916
  this.logger.debug(`Successfully deleted Glue Database ${logicalId}`);
47757
47917
  } catch (error) {
47758
47918
  if (error instanceof EntityNotFoundException) {
47759
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
47919
+ const clientRegion = await this.getClient().config.region();
47920
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
47760
47921
  logCatalogScopedDeleteSkip(this.logger, target, "Database", logicalId, physicalId);
47761
47922
  return;
47762
47923
  }
@@ -47859,7 +48020,8 @@ var GlueProvider = class {
47859
48020
  this.logger.debug(`Successfully deleted Glue Table ${logicalId}`);
47860
48021
  } catch (error) {
47861
48022
  if (error instanceof EntityNotFoundException) {
47862
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
48023
+ const clientRegion = await this.getClient().config.region();
48024
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
47863
48025
  logCatalogScopedDeleteSkip(this.logger, target, "Table", logicalId, physicalId);
47864
48026
  return;
47865
48027
  }
@@ -48470,10 +48632,7 @@ var GlueProvider = class {
48470
48632
  case "pipe-in-name":
48471
48633
  this.logger.warn(`AWS::Glue::Table ${input.logicalId}: cannot be imported because a name contains '|', which cdkd currently uses as the separator in this type's physical id (<databaseName>|<tableName>). Adopting it would record an id cdkd cannot decode back to the same table. CloudFormation manages such a table fine; this is a cdkd limitation tracked in https://github.com/go-to-k/cdkd/issues/1672. Until it is lifted, rename the table or database to omit '|', or manage this resource outside cdkd.`);
48472
48634
  break;
48473
- case "unpairable":
48474
- this.logger.warn(`AWS::Glue::Table ${input.logicalId}: cannot resolve a database for physical id '${input.knownPhysicalId}'. ` + (input.knownPhysicalId === "" ? `The supplied physical id is empty. ` : "The template's DatabaseName is absent or is an unresolved intrinsic, so the bare table name cannot be paired. ") + `Pass the composite form instead: --resource '${input.logicalId}=<databaseName>|<tableName>' (quote it — '|' is a shell pipe).`);
48475
- break;
48476
- case "unidentified": break;
48635
+ case "unpairable": this.logger.warn(`AWS::Glue::Table ${input.logicalId}: cannot resolve a database for physical id '${input.knownPhysicalId}'. ` + (input.knownPhysicalId === "" ? `The supplied physical id is empty. ` : "The template's DatabaseName is absent or is an unresolved intrinsic, so the bare table name cannot be paired. ") + `Pass the composite form instead: --resource '${input.logicalId}=<databaseName>|<tableName>' (quote it — '|' is a shell pipe).`);
48477
48636
  }
48478
48637
  return null;
48479
48638
  }
@@ -48578,7 +48737,8 @@ var GlueWorkflowProvider = class {
48578
48737
  this.logger.debug(`Successfully deleted Glue Workflow ${logicalId}`);
48579
48738
  } catch (error) {
48580
48739
  if (error instanceof EntityNotFoundException) {
48581
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
48740
+ const clientRegion = await this.getClient().config.region();
48741
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
48582
48742
  this.logger.debug(`Glue Workflow ${physicalId} does not exist, skipping deletion`);
48583
48743
  return;
48584
48744
  }
@@ -48622,7 +48782,8 @@ var GlueWorkflowProvider = class {
48622
48782
  const arn = await this.buildWorkflowArn(physicalId);
48623
48783
  let tags = [];
48624
48784
  try {
48625
- tags = normalizeAwsTagsToCfn((await this.getClient().send(new GetTagsCommand({ ResourceArn: arn }))).Tags);
48785
+ const tagResp = await this.getClient().send(new GetTagsCommand({ ResourceArn: arn }));
48786
+ tags = normalizeAwsTagsToCfn(tagResp.Tags);
48626
48787
  } catch (err) {
48627
48788
  this.logger.debug(`GetTags failed for Glue Workflow ${physicalId}: ${err instanceof Error ? err.message : String(err)}`);
48628
48789
  }
@@ -48716,7 +48877,8 @@ var GlueSecurityConfigurationProvider = class {
48716
48877
  this.logger.debug(`Successfully deleted Glue SecurityConfiguration ${logicalId}`);
48717
48878
  } catch (error) {
48718
48879
  if (error instanceof EntityNotFoundException) {
48719
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
48880
+ const clientRegion = await this.getClient().config.region();
48881
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
48720
48882
  this.logger.debug(`Glue SecurityConfiguration ${physicalId} does not exist, skipping deletion`);
48721
48883
  return;
48722
48884
  }
@@ -48987,7 +49149,8 @@ async function resolveAccountId(stsClient) {
48987
49149
  async function fetchGlueTags(client, stsClient, resource, name, accountId, logger) {
48988
49150
  try {
48989
49151
  const arn = await buildGlueResourceArn(client, stsClient, resource, name, accountId);
48990
- return normalizeAwsTagsToCfn((await client.send(new GetTagsCommand({ ResourceArn: arn }))).Tags);
49152
+ const resp = await client.send(new GetTagsCommand({ ResourceArn: arn }));
49153
+ return normalizeAwsTagsToCfn(resp.Tags);
48991
49154
  } catch (err) {
48992
49155
  logger.debug(`GetTags failed for ${resource}/${name}: ${err instanceof Error ? err.message : String(err)}`);
48993
49156
  return [];
@@ -49111,7 +49274,8 @@ var GlueJobProvider = class {
49111
49274
  await this.getClient().send(new DeleteJobCommand({ JobName: physicalId }));
49112
49275
  } catch (error) {
49113
49276
  if (error instanceof EntityNotFoundException) {
49114
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
49277
+ const clientRegion = await this.getClient().config.region();
49278
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
49115
49279
  this.logger.debug(`Glue Job ${physicalId} does not exist, skipping deletion`);
49116
49280
  return;
49117
49281
  }
@@ -49495,7 +49659,8 @@ var GlueCrawlerProvider = class {
49495
49659
  await this.getClient().send(new DeleteCrawlerCommand({ Name: physicalId }));
49496
49660
  } catch (error) {
49497
49661
  if (error instanceof EntityNotFoundException) {
49498
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
49662
+ const clientRegion = await this.getClient().config.region();
49663
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
49499
49664
  this.logger.debug(`Glue Crawler ${physicalId} does not exist, skipping deletion`);
49500
49665
  return;
49501
49666
  }
@@ -49792,7 +49957,8 @@ var GlueConnectionProvider = class {
49792
49957
  }));
49793
49958
  } catch (error) {
49794
49959
  if (error instanceof EntityNotFoundException) {
49795
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
49960
+ const clientRegion = await this.getClient().config.region();
49961
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
49796
49962
  logCatalogScopedDeleteSkip(this.logger, target, "Connection", logicalId, physicalId);
49797
49963
  return;
49798
49964
  }
@@ -50022,7 +50188,8 @@ var GlueTriggerProvider = class {
50022
50188
  await this.getClient().send(new DeleteTriggerCommand({ Name: physicalId }));
50023
50189
  } catch (error) {
50024
50190
  if (error instanceof EntityNotFoundException) {
50025
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
50191
+ const clientRegion = await this.getClient().config.region();
50192
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
50026
50193
  this.logger.debug(`Glue Trigger ${physicalId} does not exist, skipping deletion`);
50027
50194
  return;
50028
50195
  }
@@ -50214,24 +50381,28 @@ var KMSProvider = class {
50214
50381
  }));
50215
50382
  }
50216
50383
  const newEnableKeyRotation = properties["EnableKeyRotation"];
50217
- if (newEnableKeyRotation !== previousProperties["EnableKeyRotation"]) if (newEnableKeyRotation) {
50218
- const rotationPeriodInDays = properties["RotationPeriodInDays"];
50219
- this.logger.debug(`Enabling key rotation for KMS Key ${logicalId}`);
50220
- await this.getClient().send(new EnableKeyRotationCommand({
50221
- KeyId: physicalId,
50222
- ...rotationPeriodInDays !== void 0 && { RotationPeriodInDays: rotationPeriodInDays }
50223
- }));
50224
- } else {
50225
- this.logger.debug(`Disabling key rotation for KMS Key ${logicalId}`);
50226
- await this.getClient().send(new DisableKeyRotationCommand({ KeyId: physicalId }));
50384
+ if (newEnableKeyRotation !== previousProperties["EnableKeyRotation"]) {
50385
+ if (newEnableKeyRotation) {
50386
+ const rotationPeriodInDays = properties["RotationPeriodInDays"];
50387
+ this.logger.debug(`Enabling key rotation for KMS Key ${logicalId}`);
50388
+ await this.getClient().send(new EnableKeyRotationCommand({
50389
+ KeyId: physicalId,
50390
+ ...rotationPeriodInDays !== void 0 && { RotationPeriodInDays: rotationPeriodInDays }
50391
+ }));
50392
+ } else {
50393
+ this.logger.debug(`Disabling key rotation for KMS Key ${logicalId}`);
50394
+ await this.getClient().send(new DisableKeyRotationCommand({ KeyId: physicalId }));
50395
+ }
50227
50396
  }
50228
50397
  const newEnabled = properties["Enabled"];
50229
- if (newEnabled !== previousProperties["Enabled"]) if (newEnabled === false) {
50230
- this.logger.debug(`Disabling KMS Key ${logicalId}`);
50231
- await this.getClient().send(new DisableKeyCommand({ KeyId: physicalId }));
50232
- } else {
50233
- this.logger.debug(`Enabling KMS Key ${logicalId}`);
50234
- await this.getClient().send(new EnableKeyCommand({ KeyId: physicalId }));
50398
+ if (newEnabled !== previousProperties["Enabled"]) {
50399
+ if (newEnabled === false) {
50400
+ this.logger.debug(`Disabling KMS Key ${logicalId}`);
50401
+ await this.getClient().send(new DisableKeyCommand({ KeyId: physicalId }));
50402
+ } else {
50403
+ this.logger.debug(`Enabling KMS Key ${logicalId}`);
50404
+ await this.getClient().send(new EnableKeyCommand({ KeyId: physicalId }));
50405
+ }
50235
50406
  }
50236
50407
  await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
50237
50408
  const newKeyPolicy = properties["KeyPolicy"];
@@ -50266,7 +50437,8 @@ var KMSProvider = class {
50266
50437
  this.logger.debug(`Successfully scheduled deletion for KMS Key ${logicalId}`);
50267
50438
  } catch (error) {
50268
50439
  if (error instanceof NotFoundException$2) {
50269
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
50440
+ const clientRegion = await this.getClient().config.region();
50441
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
50270
50442
  this.logger.debug(`KMS Key ${physicalId} does not exist, skipping deletion`);
50271
50443
  return;
50272
50444
  }
@@ -50356,7 +50528,8 @@ var KMSProvider = class {
50356
50528
  this.logger.debug(`Successfully deleted KMS Alias ${logicalId}`);
50357
50529
  } catch (error) {
50358
50530
  if (error instanceof NotFoundException$2) {
50359
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
50531
+ const clientRegion = await this.getClient().config.region();
50532
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
50360
50533
  this.logger.debug(`KMS Alias ${physicalId} does not exist, skipping deletion`);
50361
50534
  return;
50362
50535
  }
@@ -50433,7 +50606,8 @@ var KMSProvider = class {
50433
50606
  if (err instanceof NotFoundException$2) return void 0;
50434
50607
  }
50435
50608
  try {
50436
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListResourceTagsCommand({ KeyId: md.KeyId }))).Tags);
50609
+ const tagsResp = await this.getClient().send(new ListResourceTagsCommand({ KeyId: md.KeyId }));
50610
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
50437
50611
  } catch (err) {
50438
50612
  if (err instanceof NotFoundException$2) return void 0;
50439
50613
  }
@@ -50619,7 +50793,8 @@ var BudgetsBudgetProvider = class {
50619
50793
  * unchanged byte for byte.
50620
50794
  */
50621
50795
  async budgetArn(accountId, budgetName) {
50622
- const { partition } = derivePartitionAndUrlSuffix(await this.getClient().config.region() ?? "");
50796
+ const region = await this.getClient().config.region();
50797
+ const { partition } = derivePartitionAndUrlSuffix(region ?? "");
50623
50798
  return `arn:${partition}:budgets::${accountId}:budget/${budgetName}`;
50624
50799
  }
50625
50800
  /**
@@ -50953,7 +51128,8 @@ var BudgetsBudgetProvider = class {
50953
51128
  this.logger.debug(`Successfully deleted budget ${logicalId}`);
50954
51129
  } catch (error) {
50955
51130
  if (error instanceof NotFoundException$5) {
50956
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
51131
+ const clientRegion = await this.getClient().config.region();
51132
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
50957
51133
  this.logger.debug(`Budget ${physicalId} does not exist, skipping deletion`);
50958
51134
  return;
50959
51135
  }
@@ -51196,11 +51372,15 @@ var KinesisStreamProvider = class {
51196
51372
  this.logger.debug(`Creating Kinesis stream ${logicalId}`);
51197
51373
  const streamName = properties["Name"] || generateResourceName(logicalId, { maxLength: 128 });
51198
51374
  const desiredRead = readShardLevelMetrics(properties["DesiredShardLevelMetrics"], mask);
51199
- if (desiredRead.kind === "unusable") if (context?.replayingState === true) warn(`${desiredRead.reason}. Replaying a state record, so the shard-level metrics are left unset on ${streamName} rather than refusing the restore`);
51200
- else throw new ProvisioningError(desiredRead.reason, resourceType, logicalId, streamName);
51375
+ if (desiredRead.kind === "unusable") {
51376
+ if (context?.replayingState === true) warn(`${desiredRead.reason}. Replaying a state record, so the shard-level metrics are left unset on ${streamName} rather than refusing the restore`);
51377
+ else throw new ProvisioningError(desiredRead.reason, resourceType, logicalId, streamName);
51378
+ }
51201
51379
  const maxRecordRead = readMaxRecordSize(properties["MaxRecordSizeInKiB"], mask);
51202
- if (maxRecordRead.kind === "unusable") if (context?.replayingState === true) warn(`${maxRecordRead.reason}. Replaying a state record, so ${streamName} is created with AWS's default maximum record size rather than refusing the restore`);
51203
- else throw new ProvisioningError(maxRecordRead.reason, resourceType, logicalId, streamName);
51380
+ if (maxRecordRead.kind === "unusable") {
51381
+ if (context?.replayingState === true) warn(`${maxRecordRead.reason}. Replaying a state record, so ${streamName} is created with AWS's default maximum record size rather than refusing the restore`);
51382
+ else throw new ProvisioningError(maxRecordRead.reason, resourceType, logicalId, streamName);
51383
+ }
51204
51384
  try {
51205
51385
  const streamModeDetails = properties["StreamModeDetails"];
51206
51386
  const streamMode = readConfigString(streamModeDetails, "StreamMode", "PROVISIONED", "AWS::Kinesis::Stream StreamModeDetails");
@@ -51411,7 +51591,8 @@ var KinesisStreamProvider = class {
51411
51591
  this.logger.debug(`Successfully deleted Kinesis stream ${logicalId}`);
51412
51592
  } catch (error) {
51413
51593
  if (error instanceof ResourceNotFoundException$10) {
51414
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
51594
+ const clientRegion = await this.getClient().config.region();
51595
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
51415
51596
  this.logger.debug(`Kinesis stream ${physicalId} does not exist, skipping deletion`);
51416
51597
  return;
51417
51598
  }
@@ -51557,7 +51738,8 @@ var KinesisStreamProvider = class {
51557
51738
  throw err;
51558
51739
  }
51559
51740
  try {
51560
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForStreamCommand({ StreamName: physicalId }))).Tags);
51741
+ const tagsResp = await this.getClient().send(new ListTagsForStreamCommand({ StreamName: physicalId }));
51742
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
51561
51743
  } catch (err) {
51562
51744
  if (err instanceof ResourceNotFoundException$10) return void 0;
51563
51745
  this.logger.debug(`Kinesis ListTagsForStream(${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -51765,7 +51947,8 @@ var KinesisStreamConsumerProvider = class {
51765
51947
  this.logger.debug(`Successfully deregistered Kinesis stream consumer ${logicalId}`);
51766
51948
  } catch (error) {
51767
51949
  if (error instanceof ResourceNotFoundException$10) {
51768
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
51950
+ const clientRegion = await this.getClient().config.region();
51951
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
51769
51952
  this.logger.debug(`Kinesis stream consumer ${physicalId} not found, skipping`);
51770
51953
  return;
51771
51954
  }
@@ -51818,7 +52001,8 @@ var KinesisStreamConsumerProvider = class {
51818
52001
  if (desc.ConsumerName !== void 0) result["ConsumerName"] = desc.ConsumerName;
51819
52002
  if (desc.StreamARN !== void 0) result["StreamARN"] = desc.StreamARN;
51820
52003
  try {
51821
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$15({ ResourceARN: physicalId }))).Tags);
52004
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$15({ ResourceARN: physicalId }));
52005
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
51822
52006
  } catch (err) {
51823
52007
  if (err instanceof ResourceNotFoundException$10) return void 0;
51824
52008
  this.logger.debug(`ListTagsForResource(${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -52114,7 +52298,8 @@ var SchedulerScheduleProvider = class {
52114
52298
  this.logger.debug(`Deleted Schedule ${logicalId}`);
52115
52299
  } catch (error) {
52116
52300
  if (error instanceof ResourceNotFoundException$11) {
52117
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
52301
+ const clientRegion = await this.getClient().config.region();
52302
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
52118
52303
  this.logger.debug(`Schedule ${logicalId} already deleted (not found), treating as success`);
52119
52304
  return;
52120
52305
  }
@@ -52508,7 +52693,8 @@ var EFSProvider = class {
52508
52693
  this.logger.debug(`Successfully deleted EFS FileSystem ${logicalId}`);
52509
52694
  } catch (error) {
52510
52695
  if (error instanceof FileSystemNotFound) {
52511
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
52696
+ const clientRegion = await this.getClient().config.region();
52697
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
52512
52698
  this.logger.debug(`EFS FileSystem ${physicalId} does not exist, skipping deletion`);
52513
52699
  return;
52514
52700
  }
@@ -52574,7 +52760,8 @@ var EFSProvider = class {
52574
52760
  this.logger.debug(`Successfully deleted EFS MountTarget ${logicalId}`);
52575
52761
  } catch (error) {
52576
52762
  if (error instanceof MountTargetNotFound) {
52577
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
52763
+ const clientRegion = await this.getClient().config.region();
52764
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
52578
52765
  this.logger.debug(`EFS MountTarget ${physicalId} does not exist, skipping deletion`);
52579
52766
  return;
52580
52767
  }
@@ -52746,7 +52933,8 @@ var EFSProvider = class {
52746
52933
  this.logger.debug(`Successfully deleted EFS AccessPoint ${logicalId}`);
52747
52934
  } catch (error) {
52748
52935
  if (error instanceof AccessPointNotFound) {
52749
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
52936
+ const clientRegion = await this.getClient().config.region();
52937
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
52750
52938
  this.logger.debug(`EFS AccessPoint ${physicalId} does not exist, skipping deletion`);
52751
52939
  return;
52752
52940
  }
@@ -52948,7 +53136,7 @@ var EFSProvider = class {
52948
53136
  * storage-capacity growth and deletes can take substantially longer —
52949
53137
  * mirror the Custom Resource provider's 1-hour ceiling.
52950
53138
  */
52951
- const DEFAULT_MAX_WAIT_MS$3 = 3600 * 1e3;
53139
+ const DEFAULT_MAX_WAIT_MS$3 = 36e5;
52952
53140
  const DEFAULT_POLL_INTERVAL_MS$3 = 15e3;
52953
53141
  /**
52954
53142
  * Lustre sub-properties that `UpdateFileSystem` accepts (the mutable
@@ -53672,7 +53860,8 @@ var FSxFileSystemProvider = class {
53672
53860
  await this.getClient().send(new DeleteFileSystemCommand$1({ FileSystemId: physicalId }));
53673
53861
  } catch (error) {
53674
53862
  if (error instanceof FileSystemNotFound$1) {
53675
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
53863
+ const clientRegion = await this.getClient().config.region();
53864
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
53676
53865
  this.logger.debug(`FSx FileSystem ${physicalId} does not exist, skipping deletion`);
53677
53866
  return;
53678
53867
  }
@@ -53714,7 +53903,10 @@ var FSxFileSystemProvider = class {
53714
53903
  const fs = await this.describeForPoll(fileSystemId, transientState);
53715
53904
  const lifecycle = fs?.Lifecycle;
53716
53905
  if (fs && lifecycle === "AVAILABLE") return fs;
53717
- if (lifecycle === "FAILED" || lifecycle === "MISCONFIGURED") throw new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state ${lifecycle}: ${fs?.FailureDetails?.Message ?? "no failure details reported"}`, resourceType, logicalId, fileSystemId);
53906
+ if (lifecycle === "FAILED" || lifecycle === "MISCONFIGURED") {
53907
+ const detail = fs?.FailureDetails?.Message ?? "no failure details reported";
53908
+ throw new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state ${lifecycle}: ${detail}`, resourceType, logicalId, fileSystemId);
53909
+ }
53718
53910
  this.logger.debug(`FSx FileSystem ${fileSystemId} state: ${lifecycle ?? "unknown"}, waiting...`);
53719
53911
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
53720
53912
  }
@@ -53753,7 +53945,10 @@ var FSxFileSystemProvider = class {
53753
53945
  const updateActions = (fs.AdministrativeActions ?? []).filter((a) => a.AdministrativeActionType === "FILE_SYSTEM_UPDATE" && (a.RequestTime === void 0 || a.RequestTime.getTime() >= actionThresholdMs));
53754
53946
  if (updateActions.length > 0) seenTrackedAction = true;
53755
53947
  const failed = updateActions.find((a) => a.Status === "FAILED");
53756
- if (failed) throw new ProvisioningError(`FSx FileSystem ${fileSystemId} update failed (FILE_SYSTEM_UPDATE administrative action): ${failed.FailureDetails?.Message ?? "no failure details reported"}`, resourceType, logicalId, fileSystemId);
53948
+ if (failed) {
53949
+ const detail = failed.FailureDetails?.Message ?? "no failure details reported";
53950
+ throw new ProvisioningError(`FSx FileSystem ${fileSystemId} update failed (FILE_SYSTEM_UPDATE administrative action): ${detail}`, resourceType, logicalId, fileSystemId);
53951
+ }
53757
53952
  if (!updateActions.some((a) => a.Status === "PENDING" || a.Status === "IN_PROGRESS") && (!requireActionObservation || seenTrackedAction) && fs.Lifecycle === "AVAILABLE") return fs;
53758
53953
  this.logger.debug(`FSx FileSystem ${fileSystemId} update in progress (lifecycle: ${fs.Lifecycle ?? "unknown"}), waiting...`);
53759
53954
  }
@@ -53780,7 +53975,10 @@ var FSxFileSystemProvider = class {
53780
53975
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
53781
53976
  continue;
53782
53977
  }
53783
- if (fs.Lifecycle === "FAILED") throw new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state FAILED during deletion: ${fs.FailureDetails?.Message ?? "no failure details reported"}`, resourceType, logicalId, fileSystemId);
53978
+ if (fs.Lifecycle === "FAILED") {
53979
+ const detail = fs.FailureDetails?.Message ?? "no failure details reported";
53980
+ throw new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state FAILED during deletion: ${detail}`, resourceType, logicalId, fileSystemId);
53981
+ }
53784
53982
  this.logger.debug(`FSx FileSystem ${fileSystemId} state: ${fs.Lifecycle ?? "unknown"}, waiting for deletion...`);
53785
53983
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
53786
53984
  }
@@ -54041,9 +54239,7 @@ var FSxFileSystemProvider = class {
54041
54239
  case "OpenZFSConfiguration":
54042
54240
  result[variantKey] = this.readOpenZFSConfiguration(fs.OpenZFSConfiguration ?? {});
54043
54241
  break;
54044
- default:
54045
- this.logger.warn(`FSx FileSystem ${physicalId} has FileSystemType '${fs.FileSystemType ?? "(unset)"}', which cdkd does not recognize (expected one of ${Object.keys(VARIANT_CONFIG_KEY).join(" / ")}). Its variant configuration is NOT included in the drift snapshot, so drift in that block cannot be detected. Please report this at https://github.com/go-to-k/cdkd/issues`);
54046
- break;
54242
+ default: this.logger.warn(`FSx FileSystem ${physicalId} has FileSystemType '${fs.FileSystemType ?? "(unset)"}', which cdkd does not recognize (expected one of ${Object.keys(VARIANT_CONFIG_KEY).join(" / ")}). Its variant configuration is NOT included in the drift snapshot, so drift in that block cannot be detected. Please report this at https://github.com/go-to-k/cdkd/issues`);
54047
54243
  }
54048
54244
  return result;
54049
54245
  }
@@ -54159,7 +54355,7 @@ function toSdkInstanceTypeConfigs(value) {
54159
54355
  * FSx providers' 1-hour ceiling so the slowest realistic create/terminate
54160
54356
  * still fits inside the per-resource deadline.
54161
54357
  */
54162
- const DEFAULT_MAX_WAIT_MS$2 = 3600 * 1e3;
54358
+ const DEFAULT_MAX_WAIT_MS$2 = 36e5;
54163
54359
  const DEFAULT_POLL_INTERVAL_MS$2 = 15e3;
54164
54360
  /** Cluster states that mean "create succeeded, the cluster is up". */
54165
54361
  const CREATE_READY_STATES = /* @__PURE__ */ new Set(["WAITING", "RUNNING"]);
@@ -54577,7 +54773,8 @@ var EMRClusterProvider = class {
54577
54773
  current = (await this.getClient().send(new DescribeClusterCommand({ ClusterId: physicalId }))).Cluster;
54578
54774
  } catch (error) {
54579
54775
  if (error instanceof InvalidRequestException) {
54580
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
54776
+ const clientRegion = await this.getClient().config.region();
54777
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
54581
54778
  this.logger.debug(`EMR Cluster ${physicalId} does not exist, skipping deletion`);
54582
54779
  return;
54583
54780
  }
@@ -54636,7 +54833,10 @@ var EMRClusterProvider = class {
54636
54833
  const cluster = await this.describeForPoll(clusterId, transientState);
54637
54834
  const state = cluster?.Status?.State;
54638
54835
  if (cluster && state && CREATE_READY_STATES.has(state)) return cluster;
54639
- if (state && TERMINAL_STATES.has(state)) throw new ProvisioningError(`EMR Cluster ${clusterId} entered terminal state ${state} during creation: ${cluster?.Status?.StateChangeReason?.Message ?? "no state-change reason reported"}`, resourceType, logicalId, clusterId);
54836
+ if (state && TERMINAL_STATES.has(state)) {
54837
+ const reason = cluster?.Status?.StateChangeReason?.Message ?? "no state-change reason reported";
54838
+ throw new ProvisioningError(`EMR Cluster ${clusterId} entered terminal state ${state} during creation: ${reason}`, resourceType, logicalId, clusterId);
54839
+ }
54640
54840
  this.logger.debug(`EMR Cluster ${clusterId} state: ${state ?? "unknown"}, waiting...`);
54641
54841
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
54642
54842
  }
@@ -54888,9 +55088,7 @@ var EMRClusterProvider = class {
54888
55088
  case "CORE":
54889
55089
  instances["CoreInstanceGroup"] = cfn;
54890
55090
  break;
54891
- case "TASK":
54892
- taskGroups.push(cfn);
54893
- break;
55091
+ case "TASK": taskGroups.push(cfn);
54894
55092
  }
54895
55093
  }
54896
55094
  if (taskGroups.length > 0) instances["TaskInstanceGroups"] = taskGroups;
@@ -54904,9 +55102,7 @@ var EMRClusterProvider = class {
54904
55102
  case "CORE":
54905
55103
  instances["CoreInstanceFleet"] = cfn;
54906
55104
  break;
54907
- case "TASK":
54908
- taskFleets.push(cfn);
54909
- break;
55105
+ case "TASK": taskFleets.push(cfn);
54910
55106
  }
54911
55107
  }
54912
55108
  if (taskFleets.length > 0) instances["TaskInstanceFleets"] = taskFleets;
@@ -54951,7 +55147,7 @@ var EMRClusterProvider = class {
54951
55147
  * EMR Cluster provider's 1-hour ceiling so the slowest realistic add still
54952
55148
  * fits inside the per-resource deadline.
54953
55149
  */
54954
- const DEFAULT_MAX_WAIT_MS$1 = 3600 * 1e3;
55150
+ const DEFAULT_MAX_WAIT_MS$1 = 36e5;
54955
55151
  const DEFAULT_POLL_INTERVAL_MS$1 = 15e3;
54956
55152
  /** Instance-group state that means "the group is up and idle/serving". */
54957
55153
  const READY_STATES$1 = /* @__PURE__ */ new Set(["RUNNING"]);
@@ -55165,7 +55361,8 @@ var EMRInstanceGroupConfigProvider = class {
55165
55361
  this.logger.debug(`Scaled EMR TASK instance group ${physicalId} to 0 to release its instances (no standalone delete API exists)`);
55166
55362
  } catch (error) {
55167
55363
  if (error instanceof InvalidRequestException) {
55168
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
55364
+ const clientRegion = await this.getClient().config.region();
55365
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
55169
55366
  this.logger.debug(`EMR instance group ${physicalId} scale-to-0 skipped (cluster/group gone): ${error.message}`);
55170
55367
  } else this.logger.warn(`Best-effort scale-to-0 of EMR instance group ${physicalId} failed: ${error instanceof Error ? error.message : String(error)} — its instances are released when the parent cluster terminates`);
55171
55368
  }
@@ -55219,7 +55416,10 @@ var EMRInstanceGroupConfigProvider = class {
55219
55416
  }
55220
55417
  if (state && READY_STATES$1.has(state) && group?.RunningInstanceCount === expectedCount) return;
55221
55418
  const enforceFailedStates = !toleratesStaleFailedState || hasLeftInitialState;
55222
- if (state && enforceFailedStates && FAILED_STATES$1.has(state)) throw new ProvisioningError(`EMR instance group ${groupId} entered failed state ${state}: ${group?.Status?.StateChangeReason?.Message ?? "no state-change reason reported"}`, resourceType, logicalId, groupId);
55419
+ if (state && enforceFailedStates && FAILED_STATES$1.has(state)) {
55420
+ const reason = group?.Status?.StateChangeReason?.Message ?? "no state-change reason reported";
55421
+ throw new ProvisioningError(`EMR instance group ${groupId} entered failed state ${state}: ${reason}`, resourceType, logicalId, groupId);
55422
+ }
55223
55423
  if (state && !enforceFailedStates && FAILED_STATES$1.has(state)) this.logger.debug(`EMR instance group ${groupId} still reads ${state} from before the resize; waiting for it to leave that state before treating it as failed`);
55224
55424
  this.logger.debug(`EMR instance group ${groupId} state: ${state ?? "unknown"}, running ${group?.RunningInstanceCount ?? "?"}/${expectedCount}, waiting...`);
55225
55425
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
@@ -55271,7 +55471,7 @@ var EMRInstanceGroupConfigProvider = class {
55271
55471
  * EMR Cluster provider's 1-hour ceiling so the slowest realistic add still
55272
55472
  * fits inside the per-resource deadline.
55273
55473
  */
55274
- const DEFAULT_MAX_WAIT_MS = 3600 * 1e3;
55474
+ const DEFAULT_MAX_WAIT_MS = 36e5;
55275
55475
  const DEFAULT_POLL_INTERVAL_MS = 15e3;
55276
55476
  /** Instance-fleet state that means "the fleet is up and idle/serving". */
55277
55477
  const READY_STATES = /* @__PURE__ */ new Set(["RUNNING"]);
@@ -55475,7 +55675,8 @@ var EMRInstanceFleetConfigProvider = class {
55475
55675
  this.logger.debug(`Scaled EMR TASK instance fleet ${physicalId} to 0 to release its instances (no standalone delete API exists)`);
55476
55676
  } catch (error) {
55477
55677
  if (error instanceof InvalidRequestException) {
55478
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
55678
+ const clientRegion = await this.getClient().config.region();
55679
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
55479
55680
  this.logger.debug(`EMR instance fleet ${physicalId} scale-to-0 skipped (cluster/fleet gone): ${error.message}`);
55480
55681
  } else this.logger.warn(`Best-effort scale-to-0 of EMR instance fleet ${physicalId} failed: ${error instanceof Error ? error.message : String(error)} — its instances are released when the parent cluster terminates`);
55481
55682
  }
@@ -55569,7 +55770,10 @@ var EMRInstanceFleetConfigProvider = class {
55569
55770
  }
55570
55771
  if (state && READY_STATES.has(state) && capacityReady) return;
55571
55772
  const enforceFailedStates = !toleratesStaleFailedState || hasLeftInitialState;
55572
- if (state && enforceFailedStates && FAILED_STATES.has(state)) throw new ProvisioningError(`EMR instance fleet ${fleetId} entered failed state ${state}: ${fleet?.Status?.StateChangeReason?.Message ?? "no state-change reason reported"}`, resourceType, logicalId, fleetId);
55773
+ if (state && enforceFailedStates && FAILED_STATES.has(state)) {
55774
+ const reason = fleet?.Status?.StateChangeReason?.Message ?? "no state-change reason reported";
55775
+ throw new ProvisioningError(`EMR instance fleet ${fleetId} entered failed state ${state}: ${reason}`, resourceType, logicalId, fleetId);
55776
+ }
55573
55777
  if (state && !enforceFailedStates && FAILED_STATES.has(state)) this.logger.debug(`EMR instance fleet ${fleetId} still reads ${state} from before the resize; waiting for it to leave that state before treating it as failed`);
55574
55778
  this.logger.debug(`EMR instance fleet ${fleetId} state: ${state ?? "unknown"}, provisioned ${onDemand}/${target.onDemand} on-demand + ${spot}/${target.spot} spot (${provisioned} total), waiting...`);
55575
55779
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
@@ -56085,7 +56289,8 @@ var FirehoseProvider = class {
56085
56289
  this.logger.debug(`Successfully deleted Firehose delivery stream ${logicalId}`);
56086
56290
  } catch (error) {
56087
56291
  if (error instanceof ResourceNotFoundException$12) {
56088
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
56292
+ const clientRegion = await this.getClient().config.region();
56293
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
56089
56294
  this.logger.debug(`Firehose delivery stream ${physicalId} does not exist, skipping deletion`);
56090
56295
  return;
56091
56296
  }
@@ -56650,7 +56855,8 @@ var FirehoseProvider = class {
56650
56855
  if (enc?.KeyType !== void 0) encOut["KeyType"] = enc.KeyType;
56651
56856
  result["DeliveryStreamEncryptionConfigurationInput"] = encOut;
56652
56857
  try {
56653
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForDeliveryStreamCommand({ DeliveryStreamName: physicalId }))).Tags);
56858
+ const tagsResp = await this.getClient().send(new ListTagsForDeliveryStreamCommand({ DeliveryStreamName: physicalId }));
56859
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
56654
56860
  } catch (err) {
56655
56861
  if (err instanceof ResourceNotFoundException$12) return void 0;
56656
56862
  this.logger.debug(`Firehose ListTagsForDeliveryStream(${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -57145,12 +57351,14 @@ var CloudTrailProvider = class {
57145
57351
  }));
57146
57352
  }
57147
57353
  const oldIsLogging = previousProperties["IsLogging"];
57148
- if (isLogging !== void 0 && isLogging !== oldIsLogging) if (isLogging === false) {
57149
- this.logger.debug(`Stopping logging for CloudTrail Trail ${logicalId}`);
57150
- await this.getClient().send(new StopLoggingCommand({ Name: physicalId }));
57151
- } else {
57152
- this.logger.debug(`Starting logging for CloudTrail Trail ${logicalId}`);
57153
- await this.getClient().send(new StartLoggingCommand({ Name: physicalId }));
57354
+ if (isLogging !== void 0 && isLogging !== oldIsLogging) {
57355
+ if (isLogging === false) {
57356
+ this.logger.debug(`Stopping logging for CloudTrail Trail ${logicalId}`);
57357
+ await this.getClient().send(new StopLoggingCommand({ Name: physicalId }));
57358
+ } else {
57359
+ this.logger.debug(`Starting logging for CloudTrail Trail ${logicalId}`);
57360
+ await this.getClient().send(new StartLoggingCommand({ Name: physicalId }));
57361
+ }
57154
57362
  }
57155
57363
  await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
57156
57364
  this.logger.debug(`Successfully updated CloudTrail Trail ${logicalId}`);
@@ -57173,7 +57381,8 @@ var CloudTrailProvider = class {
57173
57381
  this.logger.debug(`Successfully deleted CloudTrail Trail ${logicalId}`);
57174
57382
  } catch (error) {
57175
57383
  if (error instanceof TrailNotFoundException) {
57176
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
57384
+ const clientRegion = await this.getClient().config.region();
57385
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
57177
57386
  this.logger.debug(`CloudTrail Trail ${physicalId} does not exist, skipping deletion`);
57178
57387
  return;
57179
57388
  }
@@ -57293,7 +57502,8 @@ var CloudTrailProvider = class {
57293
57502
  result["InsightSelectors"] = insightSelectors;
57294
57503
  let tags = [];
57295
57504
  if (trail.TrailARN) try {
57296
- tags = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsCommand$2({ ResourceIdList: [trail.TrailARN] }))).ResourceTagList?.[0]?.TagsList);
57505
+ const tagsResp = await this.getClient().send(new ListTagsCommand$2({ ResourceIdList: [trail.TrailARN] }));
57506
+ tags = normalizeAwsTagsToCfn(tagsResp.ResourceTagList?.[0]?.TagsList);
57297
57507
  } catch (err) {
57298
57508
  this.logger.debug(`CloudTrail ListTags(${trail.TrailARN}) failed: ${err instanceof Error ? err.message : String(err)}`);
57299
57509
  }
@@ -57583,7 +57793,8 @@ var CodeBuildProvider = class {
57583
57793
  this.logger.debug(`Successfully deleted CodeBuild Project ${logicalId}`);
57584
57794
  } catch (error) {
57585
57795
  if (error instanceof ResourceNotFoundException$13) {
57586
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
57796
+ const clientRegion = await this.getClient().config.region();
57797
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
57587
57798
  this.logger.debug(`CodeBuild Project ${physicalId} does not exist, skipping deletion`);
57588
57799
  return;
57589
57800
  }
@@ -58109,7 +58320,8 @@ var CodeCommitRepositoryProvider = class {
58109
58320
  deletedRepositoryId = (await this.getClient().send(new DeleteRepositoryCommand$1({ repositoryName: physicalId }))).repositoryId;
58110
58321
  } catch (error) {
58111
58322
  if (error instanceof RepositoryDoesNotExistException) {
58112
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
58323
+ const clientRegion = await this.getClient().config.region();
58324
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
58113
58325
  this.logger.debug(`CodeCommit Repository ${physicalId} does not exist, skipping deletion`);
58114
58326
  return;
58115
58327
  }
@@ -58117,7 +58329,8 @@ var CodeCommitRepositoryProvider = class {
58117
58329
  throw new ProvisioningError(`Failed to delete CodeCommit Repository ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
58118
58330
  }
58119
58331
  if (!deletedRepositoryId) {
58120
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
58332
+ const clientRegion = await this.getClient().config.region();
58333
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
58121
58334
  this.logger.debug(`CodeCommit Repository ${physicalId} does not exist, skipping deletion`);
58122
58335
  return;
58123
58336
  }
@@ -58191,7 +58404,8 @@ var CodeCommitRepositoryProvider = class {
58191
58404
  if (!metadata) return void 0;
58192
58405
  let tags = [];
58193
58406
  if (metadata.Arn) try {
58194
- tags = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$16({ resourceArn: metadata.Arn }))).tags);
58407
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$16({ resourceArn: metadata.Arn }));
58408
+ tags = normalizeAwsTagsToCfn(tagsResp.tags);
58195
58409
  } catch (err) {
58196
58410
  if (err instanceof RepositoryDoesNotExistException) return void 0;
58197
58411
  throw err;
@@ -58543,7 +58757,8 @@ var DLMLifecyclePolicyProvider = class {
58543
58757
  this.logger.debug(`Successfully deleted DLM Lifecycle Policy ${logicalId}`);
58544
58758
  } catch (error) {
58545
58759
  if (error instanceof ResourceNotFoundException$14) {
58546
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
58760
+ const clientRegion = await this.getClient().config.region();
58761
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
58547
58762
  this.logger.debug(`DLM Lifecycle Policy ${physicalId} does not exist, skipping deletion`);
58548
58763
  return;
58549
58764
  }
@@ -58782,7 +58997,8 @@ var S3VectorsProvider = class {
58782
58997
  this.logger.debug(`Successfully deleted S3 VectorBucket ${logicalId}`);
58783
58998
  } catch (error) {
58784
58999
  if (this.isNotFoundError(error)) {
58785
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
59000
+ const clientRegion = await this.getClient().config.region();
59001
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
58786
59002
  this.logger.debug(`S3 VectorBucket ${physicalId} does not exist, skipping deletion`);
58787
59003
  return;
58788
59004
  }
@@ -58844,7 +59060,8 @@ var S3VectorsProvider = class {
58844
59060
  if (Object.keys(enc).length > 0) result["EncryptionConfiguration"] = enc;
58845
59061
  }
58846
59062
  if (bucket?.vectorBucketArn) try {
58847
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$17({ resourceArn: bucket.vectorBucketArn }))).tags);
59063
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$17({ resourceArn: bucket.vectorBucketArn }));
59064
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.tags);
58848
59065
  } catch (err) {
58849
59066
  this.logger.debug(`S3Vectors ListTagsForResource(${bucket.vectorBucketArn}) failed: ${err instanceof Error ? err.message : String(err)}`);
58850
59067
  result["Tags"] = [];
@@ -59101,7 +59318,8 @@ var S3DirectoryBucketProvider = class {
59101
59318
  await this.deleteBucketWithEmptyRetry(logicalId, physicalId, allowAutoEmpty);
59102
59319
  } catch (error) {
59103
59320
  if (error instanceof Error && (error.name === "NoSuchBucket" || error.name === "BucketNotFound")) {
59104
- assertRegionMatch(await this.s3Client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
59321
+ const clientRegion = await this.s3Client.config.region();
59322
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
59105
59323
  this.logger.debug(`Bucket ${physicalId} does not exist, skipping deletion`);
59106
59324
  return;
59107
59325
  }
@@ -59205,10 +59423,11 @@ var S3DirectoryBucketProvider = class {
59205
59423
  async readTags(bucketName) {
59206
59424
  const accountId = await this.getAccountId();
59207
59425
  const resourceArn = await this.buildBucketArn(bucketName, accountId);
59208
- return normalizeAwsTagsToCfn((await this.getS3ControlClient().send(new ListTagsForResourceCommand$18({
59426
+ const resp = await this.getS3ControlClient().send(new ListTagsForResourceCommand$18({
59209
59427
  AccountId: accountId,
59210
59428
  ResourceArn: resourceArn
59211
- }))).Tags);
59429
+ }));
59430
+ return normalizeAwsTagsToCfn(resp.Tags);
59212
59431
  }
59213
59432
  /**
59214
59433
  * Adopt an existing S3 Express Directory Bucket into cdkd state.
@@ -59407,7 +59626,8 @@ var S3TablesProvider = class {
59407
59626
  this.logger.debug(`Successfully deleted S3 Table Bucket ${logicalId}`);
59408
59627
  } catch (error) {
59409
59628
  if (error instanceof NotFoundException$6) {
59410
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
59629
+ const clientRegion = await this.getClient().config.region();
59630
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
59411
59631
  this.logger.debug(`S3 Table Bucket ${physicalId} does not exist, skipping deletion`);
59412
59632
  return;
59413
59633
  }
@@ -59511,7 +59731,8 @@ var S3TablesProvider = class {
59511
59731
  this.logger.debug(`Successfully deleted S3 Tables Namespace ${logicalId}`);
59512
59732
  } catch (error) {
59513
59733
  if (error instanceof NotFoundException$6) {
59514
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
59734
+ const clientRegion = await this.getClient().config.region();
59735
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
59515
59736
  this.logger.debug(`S3 Tables Namespace ${physicalId} does not exist, skipping deletion`);
59516
59737
  return;
59517
59738
  }
@@ -59915,7 +60136,8 @@ var S3TablesProvider = class {
59915
60136
  throw new ProvisioningError(`Failed to resolve S3 Tables Table ${logicalId} (${physicalId}): ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
59916
60137
  }
59917
60138
  if (resolved === "not-found") {
59918
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
60139
+ const clientRegion = await this.getClient().config.region();
60140
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
59919
60141
  this.logger.debug(`S3 Tables Table ${physicalId} does not exist, skipping deletion`);
59920
60142
  return;
59921
60143
  }
@@ -59930,7 +60152,8 @@ var S3TablesProvider = class {
59930
60152
  this.logger.debug(`Successfully deleted S3 Tables Table ${logicalId}`);
59931
60153
  } catch (error) {
59932
60154
  if (error instanceof NotFoundException$6) {
59933
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
60155
+ const clientRegion = await this.getClient().config.region();
60156
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
59934
60157
  this.logger.debug(`S3 Tables Table ${physicalId} does not exist, skipping deletion`);
59935
60158
  return;
59936
60159
  }
@@ -60375,7 +60598,8 @@ var ECRProvider = class {
60375
60598
  } catch (error) {
60376
60599
  if (error instanceof RepositoryNotEmptyException) throw new ProvisioningError(`Failed to delete ECR Repository ${logicalId}: repository ${physicalId} still contains images. Matching CloudFormation, cdkd does not force-delete an image-carrying repository unless it opted in via EmptyOnDelete: true (CDK's emptyOnDelete) or the '${ECR_AUTO_DELETE_IMAGES_TAG}' tag (CDK's autoDeleteImages). Either delete the images first (aws ecr batch-delete-image), or redeploy with emptyOnDelete: true and destroy again.`, resourceType, logicalId, physicalId, error);
60377
60600
  if (error instanceof RepositoryNotFoundException) {
60378
- assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
60601
+ const clientRegion = await this.getClient().config.region();
60602
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
60379
60603
  this.logger.debug(`ECR Repository ${physicalId} does not exist, skipping deletion`);
60380
60604
  return;
60381
60605
  }
@@ -60442,7 +60666,8 @@ var ECRProvider = class {
60442
60666
  if (!(err instanceof LifecyclePolicyNotFoundException)) throw err;
60443
60667
  }
60444
60668
  if (r.repositoryArn) try {
60445
- result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$9({ resourceArn: r.repositoryArn }))).tags);
60669
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$9({ resourceArn: r.repositoryArn }));
60670
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.tags);
60446
60671
  } catch (err) {
60447
60672
  if (!(err instanceof RepositoryNotFoundException)) throw err;
60448
60673
  }
@@ -60919,10 +61144,12 @@ async function runDestroyForStack(stackName, state, ctx) {
60919
61144
  });
60920
61145
  try {
60921
61146
  let finalSnapshotIdentifier;
60922
- 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);
60923
- else if (ATOMIC_FINAL_SNAPSHOT_TYPES.has(resource.resourceType)) throw ccRoutedFinalSnapshotError(logicalId, resource.resourceType, "--skip-final-snapshot");
60924
- else if (PRE_DELETE_SNAPSHOT_TYPES.has(resource.resourceType)) await createPreDeleteFinalSnapshot(resource.resourceType, resource.physicalId, logicalId, destroyAwsClients ?? ctx.baseAwsClients, logger);
60925
- else throw unsupportedFinalSnapshotError(logicalId, resource.resourceType, "--skip-final-snapshot");
61147
+ if (resource.deletionPolicy === "Snapshot" && ctx.skipFinalSnapshot !== true) {
61148
+ if (ATOMIC_FINAL_SNAPSHOT_TYPES.has(resource.resourceType) && resource.provisionedBy !== "cc-api") finalSnapshotIdentifier = buildFinalSnapshotIdentifier(resource.physicalId, resource.resourceType);
61149
+ else if (ATOMIC_FINAL_SNAPSHOT_TYPES.has(resource.resourceType)) throw ccRoutedFinalSnapshotError(logicalId, resource.resourceType, "--skip-final-snapshot");
61150
+ else if (PRE_DELETE_SNAPSHOT_TYPES.has(resource.resourceType)) await createPreDeleteFinalSnapshot(resource.resourceType, resource.physicalId, logicalId, destroyAwsClients ?? ctx.baseAwsClients, logger);
61151
+ else throw unsupportedFinalSnapshotError(logicalId, resource.resourceType, "--skip-final-snapshot");
61152
+ }
60926
61153
  const provider = destroyProviderRegistry.getProviderFor({
60927
61154
  resourceType: resource.resourceType,
60928
61155
  provisionedBy: resource.provisionedBy
@@ -61377,12 +61604,13 @@ var NestedStackProvider = class {
61377
61604
  }
61378
61605
  const resourceCount = Object.keys(childStateData.state.resources).length;
61379
61606
  this.logger.info(`Destroying nested stack ${childStackName} (logicalId=${logicalId}, ${resourceCount} resource(s))`);
61380
- const childResult = await withNestedStackContext({
61607
+ const childCtx = {
61381
61608
  ...ctx,
61382
61609
  parentStackName: childStackName,
61383
61610
  parentRegion: childRegion,
61384
61611
  nestedTemplates: void 0
61385
- }, () => runDestroyForStack(childStackName, childStateData.state, {
61612
+ };
61613
+ const childResult = await withNestedStackContext(childCtx, () => runDestroyForStack(childStackName, childStateData.state, {
61386
61614
  stateBackend: ctx.stateBackend,
61387
61615
  lockManager: ctx.lockManager,
61388
61616
  providerRegistry: ctx.providerRegistry,
@@ -61429,12 +61657,13 @@ var NestedStackProvider = class {
61429
61657
  parentRegion: parentCtx.parentRegion
61430
61658
  }
61431
61659
  }, childRegion, parentCtx.exportIndexStore);
61432
- await withNestedStackContext({
61660
+ const childCtx = {
61433
61661
  ...parentCtx,
61434
61662
  parentStackName: childStackName,
61435
61663
  parentRegion: childRegion,
61436
61664
  nestedTemplates: grandchildTemplates
61437
- }, () => childEngine.deploy(childStackName, childTemplate));
61665
+ };
61666
+ await withNestedStackContext(childCtx, () => childEngine.deploy(childStackName, childTemplate));
61438
61667
  }
61439
61668
  /**
61440
61669
  * The child's outputs, as `Outputs.<Key>` attributes for the parent's
@@ -61828,7 +62057,8 @@ var ACMCertificateProvider = class {
61828
62057
  throw new ProvisioningError(`${error.message} ${survivorNote}`, resourceType, logicalId, requestedArn, error);
61829
62058
  }
61830
62059
  const cause = error instanceof Error ? error : void 0;
61831
- throw new ProvisioningError(`Failed to create ACM certificate ${logicalId}: ${error instanceof Error ? error.message : String(error)}` + (survivorNote === void 0 ? "" : ` ${survivorNote}`), resourceType, logicalId, requestedArn, cause);
62060
+ const detail = error instanceof Error ? error.message : String(error);
62061
+ throw new ProvisioningError(`Failed to create ACM certificate ${logicalId}: ${detail}` + (survivorNote === void 0 ? "" : ` ${survivorNote}`), resourceType, logicalId, requestedArn, cause);
61832
62062
  }
61833
62063
  }
61834
62064
  /**
@@ -61976,7 +62206,8 @@ var ACMCertificateProvider = class {
61976
62206
  await this.acmClient.send(new DeleteCertificateCommand({ CertificateArn: physicalId }));
61977
62207
  } catch (error) {
61978
62208
  if (error instanceof ResourceNotFoundException$7) {
61979
- assertRegionMatch(await this.acmClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
62209
+ const clientRegion = await this.acmClient.config.region();
62210
+ assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
61980
62211
  this.logger.debug(`Certificate ${physicalId} does not exist, skipping deletion`);
61981
62212
  return;
61982
62213
  }
@@ -62025,7 +62256,8 @@ var ACMCertificateProvider = class {
62025
62256
  if (cert.Options?.CertificateTransparencyLoggingPreference !== void 0) result["CertificateTransparencyLoggingPreference"] = cert.Options.CertificateTransparencyLoggingPreference;
62026
62257
  if (cert.Options?.Export !== void 0) result["CertificateExport"] = cert.Options.Export;
62027
62258
  try {
62028
- result["Tags"] = normalizeAwsTagsToCfn((await this.acmClient.send(new ListTagsForCertificateCommand({ CertificateArn: physicalId }))).Tags);
62259
+ const tagsResp = await this.acmClient.send(new ListTagsForCertificateCommand({ CertificateArn: physicalId }));
62260
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
62029
62261
  } catch (err) {
62030
62262
  if (!(err instanceof ResourceNotFoundException$7)) throw err;
62031
62263
  }
@@ -62735,23 +62967,24 @@ async function deployCommand(stacks, options) {
62735
62967
  let recreateTargets;
62736
62968
  if (options.recreateViaCcApi?.length || options.recreateViaSdkProvider?.length) {
62737
62969
  const stateForRecreateCheck = await stackStateBackend.getState(stackInfo.stackName, stackRegion);
62970
+ const syncValidation = validateRecreateTargets({
62971
+ template: stackInfo.template,
62972
+ state: stateForRecreateCheck?.state ?? {
62973
+ version: 9,
62974
+ stackName: stackInfo.stackName,
62975
+ region: stackRegion,
62976
+ resources: {},
62977
+ outputs: {},
62978
+ lastModified: Date.now()
62979
+ },
62980
+ recreateViaCcApi: options.recreateViaCcApi ?? [],
62981
+ recreateViaSdkProvider: options.recreateViaSdkProvider ?? [],
62982
+ allowUnsupportedProperties: new Set(options.allowUnsupportedProperties ?? []),
62983
+ forceStatefulRecreation: options.forceStatefulRecreation ?? false,
62984
+ hasSdkProvider: (rt) => stackProviderRegistry.getProviderType(rt) === "sdk"
62985
+ });
62738
62986
  const validation = await probeAndRevalidateStateful({
62739
- validation: validateRecreateTargets({
62740
- template: stackInfo.template,
62741
- state: stateForRecreateCheck?.state ?? {
62742
- version: 9,
62743
- stackName: stackInfo.stackName,
62744
- region: stackRegion,
62745
- resources: {},
62746
- outputs: {},
62747
- lastModified: Date.now()
62748
- },
62749
- recreateViaCcApi: options.recreateViaCcApi ?? [],
62750
- recreateViaSdkProvider: options.recreateViaSdkProvider ?? [],
62751
- allowUnsupportedProperties: new Set(options.allowUnsupportedProperties ?? []),
62752
- forceStatefulRecreation: options.forceStatefulRecreation ?? false,
62753
- hasSdkProvider: (rt) => stackProviderRegistry.getProviderType(rt) === "sdk"
62754
- }),
62987
+ validation: syncValidation,
62755
62988
  clients: {
62756
62989
  s3: stackAwsClients.s3,
62757
62990
  cloudWatchLogs: stackAwsClients.cloudWatchLogs,
@@ -63174,21 +63407,23 @@ async function resolveTemplateOutputs(template, resolveFn, conditions, storedOut
63174
63407
  resolutionFailed = true;
63175
63408
  continue;
63176
63409
  }
63177
- if (typeof exportName === "string" && !isUnresolvedValue(exportName, exportSourceUsedSub)) if (declaredExportIsIntrinsic && isSecretDynamicReference(exportName)) logger.debug(`Diff skipping export alias of ${stripControlChars(outputKey)} — the name carries a secret reference`);
63178
- else if (isExportAliasCollision(exportName, outputKey, publishedOutputNames)) logger.debug(`Diff skipping export alias ${stripControlChars(exportName)} of ${stripControlChars(outputKey)} — collides with an output name`);
63179
- else if (!declaredExportIsIntrinsic && secretSourceKeys.size > 0) if (storedOutputs !== void 0 && Object.prototype.hasOwnProperty.call(storedOutputs, exportName)) {
63180
- outputs[exportName] = value;
63181
- exportNames.add(exportName);
63182
- } else {
63183
- logger.debug(`Diff cannot decide the export alias of ${stripControlChars(outputKey)} — a literal name may contain a resolved secret and state does not hold that key`);
63184
- failedKeys.add(exportName);
63185
- resolutionFailed = true;
63186
- }
63187
- else {
63188
- outputs[exportName] = value;
63189
- exportNames.add(exportName);
63190
- }
63191
- else resolutionFailed = true;
63410
+ if (typeof exportName === "string" && !isUnresolvedValue(exportName, exportSourceUsedSub)) {
63411
+ if (declaredExportIsIntrinsic && isSecretDynamicReference(exportName)) logger.debug(`Diff skipping export alias of ${stripControlChars(outputKey)} — the name carries a secret reference`);
63412
+ else if (isExportAliasCollision(exportName, outputKey, publishedOutputNames)) logger.debug(`Diff skipping export alias ${stripControlChars(exportName)} of ${stripControlChars(outputKey)} collides with an output name`);
63413
+ else if (!declaredExportIsIntrinsic && secretSourceKeys.size > 0) {
63414
+ if (storedOutputs !== void 0 && Object.prototype.hasOwnProperty.call(storedOutputs, exportName)) {
63415
+ outputs[exportName] = value;
63416
+ exportNames.add(exportName);
63417
+ } else {
63418
+ logger.debug(`Diff cannot decide the export alias of ${stripControlChars(outputKey)} — a literal name may contain a resolved secret and state does not hold that key`);
63419
+ failedKeys.add(exportName);
63420
+ resolutionFailed = true;
63421
+ }
63422
+ } else {
63423
+ outputs[exportName] = value;
63424
+ exportNames.add(exportName);
63425
+ }
63426
+ } else resolutionFailed = true;
63192
63427
  }
63193
63428
  }
63194
63429
  return {
@@ -64900,7 +65135,6 @@ function renderChangeLines(changes, logFn, ccApiRoutes) {
64900
65135
  case "DELETE":
64901
65136
  deleteCount++;
64902
65137
  logFn(` [-] ${logicalId} (${change.resourceType})`);
64903
- break;
64904
65138
  }
64905
65139
  return {
64906
65140
  create: createCount,
@@ -64975,7 +65209,6 @@ function renderOutputChangeLines(outputChanges, logFn) {
64975
65209
  counts.remove++;
64976
65210
  logFn(` [-] ${name}${exported}`);
64977
65211
  logFn(` old: ${renderOld(change)}`);
64978
- break;
64979
65212
  }
64980
65213
  }
64981
65214
  return counts;
@@ -65290,10 +65523,11 @@ async function scrubCommand(stacks, options) {
65290
65523
  if (!app) throw new Error("CDK app is required (scrub needs the template to identify secret references). Pass --app, set CDKD_APP, or add \"app\" to cdk.json.");
65291
65524
  const region = namedCliRegion(options.region) ?? "us-east-1";
65292
65525
  const stateBucket = await resolveStateBucketWithDefault(options.stateBucket, region);
65293
- setAwsClients(new AwsClients({
65526
+ const awsClients = new AwsClients({
65294
65527
  ...options.region && { region: options.region },
65295
65528
  ...options.profile && { profile: options.profile }
65296
- }));
65529
+ });
65530
+ setAwsClients(awsClients);
65297
65531
  logger.info(synthesisStatusMessage(app, "Synthesizing CDK app..."));
65298
65532
  const synthesizer = new Synthesizer();
65299
65533
  const context = parseContextOptions(options.context);
@@ -67020,7 +67254,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
67020
67254
  try {
67021
67255
  parameters = await resolver.resolveParameters(stack.template);
67022
67256
  } catch (err) {
67023
- logger.debug(`Parameter resolution skipped for ${stack.stackName}: ${err instanceof Error ? err.message : String(err)}`);
67257
+ logger.debug(`Parameter resolution skipped for ${stack.stackName}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), outputSecrets)}`);
67024
67258
  }
67025
67259
  const resolverStateBackend = memoizeCrossStackStateReads(stateBackend);
67026
67260
  const resolverContext = (recordedSecretValues) => ({
@@ -67044,7 +67278,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
67044
67278
  try {
67045
67279
  conditions = await resolver.evaluateConditions(resolverContext(outputSecrets));
67046
67280
  } catch (err) {
67047
- logger.debug(`Condition evaluation skipped for ${stack.stackName}: ${err instanceof Error ? err.message : String(err)}`);
67281
+ logger.debug(`Condition evaluation skipped for ${stack.stackName}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), outputSecrets)}`);
67048
67282
  }
67049
67283
  const templateResources = stack.template.Resources ?? {};
67050
67284
  for (const logicalId of Object.keys(state.resources)) {
@@ -69332,18 +69566,19 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
69332
69566
  unorderedPaths
69333
69567
  }), secrets, secretResolutionFailed ? seededSecretPaths : secretPaths, maskSecretPaths);
69334
69568
  const notComparedCause = secretResolutionFailed ? "refused" : unresolvedTokens.size > 0 ? "unresolvedToken" : void 0;
69335
- if (reported.changes.length === 0) if (notComparedCause !== void 0) outcomes.push({
69336
- kind: "notCompared",
69337
- logicalId,
69338
- resourceType: resource.resourceType,
69339
- notComparedCause
69340
- });
69341
- else outcomes.push({
69342
- kind: "clean",
69343
- logicalId,
69344
- resourceType: resource.resourceType
69345
- });
69346
- else outcomes.push({
69569
+ if (reported.changes.length === 0) {
69570
+ if (notComparedCause !== void 0) outcomes.push({
69571
+ kind: "notCompared",
69572
+ logicalId,
69573
+ resourceType: resource.resourceType,
69574
+ notComparedCause
69575
+ });
69576
+ else outcomes.push({
69577
+ kind: "clean",
69578
+ logicalId,
69579
+ resourceType: resource.resourceType
69580
+ });
69581
+ } else outcomes.push({
69347
69582
  kind: "drifted",
69348
69583
  logicalId,
69349
69584
  resourceType: resource.resourceType,
@@ -70585,10 +70820,11 @@ function writeHumanReport(reports) {
70585
70820
  const inspected = inspectedCount;
70586
70821
  const notCompared = notComparedOutcomes(report);
70587
70822
  const checked = inspected - notCompared.length;
70588
- if (drifted.length === 0) if (notCompared.length === 0 && checked === 0 && report.outcomes.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but NOTHING was compared — 0 of ${report.outcomes.length} resource${report.outcomes.length === 1 ? "" : "s"} checked (${unsupported.length} unsupported, ${skippedCount} skipped)\n`);
70589
- else if (notCompared.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but ${checked} of ${inspected} resource${inspected === 1 ? "" : "s"} fully checked ` + (notCompared.some((n) => n.cause === "readFailed") ? `(${notCompared.length} not fully compared), ` : `(${notCompared.length} only partially compared), `) + `${unsupported.length} unsupported\n`);
70590
- else process.stdout.write(`✓ ${report.stackName} (${report.region}): no drift detected (${checked} resource${checked === 1 ? "" : "s"} checked, ${unsupported.length} unsupported)\n`);
70591
- else {
70823
+ if (drifted.length === 0) {
70824
+ if (notCompared.length === 0 && checked === 0 && report.outcomes.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but NOTHING was compared — 0 of ${report.outcomes.length} resource${report.outcomes.length === 1 ? "" : "s"} checked (${unsupported.length} unsupported, ${skippedCount} skipped)\n`);
70825
+ else if (notCompared.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but ${checked} of ${inspected} resource${inspected === 1 ? "" : "s"} fully checked ` + (notCompared.some((n) => n.cause === "readFailed") ? `(${notCompared.length} not fully compared), ` : `(${notCompared.length} only partially compared), `) + `${unsupported.length} unsupported\n`);
70826
+ else process.stdout.write(`✓ ${report.stackName} (${report.region}): no drift detected (${checked} resource${checked === 1 ? "" : "s"} checked, ${unsupported.length} unsupported)\n`);
70827
+ } else {
70592
70828
  const word = drifted.length === 1 ? "resource" : "resources";
70593
70829
  process.stdout.write(`\n⚠ ${report.stackName} (${report.region}): drift detected on ${drifted.length} ${word}\n\n`);
70594
70830
  for (const o of drifted) {
@@ -70860,12 +71096,14 @@ async function destroyCommand(stackArgs, options) {
70860
71096
  const refs = stateRefsByName.get(stackName) ?? [];
70861
71097
  const synthStack = appStacks.find((s) => s.stackName === stackName);
70862
71098
  const synthRegion = synthStack?.region;
70863
- if (synthStack?.terminationProtection === true) if (options.removeProtection) logger.warn(`Stack ${stackName} has terminationProtection: true — bypassing because --remove-protection set`);
70864
- else {
70865
- const err = new StackTerminationProtectionError(stackName);
70866
- logger.error(` ✗ ${err.message}`);
70867
- totalErrors++;
70868
- continue;
71099
+ if (synthStack?.terminationProtection === true) {
71100
+ if (options.removeProtection) logger.warn(`Stack ${stackName} has terminationProtection: true — bypassing because --remove-protection set`);
71101
+ else {
71102
+ const err = new StackTerminationProtectionError(stackName);
71103
+ logger.error(` ✗ ${err.message}`);
71104
+ totalErrors++;
71105
+ continue;
71106
+ }
70869
71107
  }
70870
71108
  let stackTargetRegion;
70871
71109
  if (refs.length === 0) {
@@ -75121,7 +75359,7 @@ async function stateListCommand(options) {
75121
75359
  * shape; plain `tree` renders `tree(1)`-style box-drawing.
75122
75360
  */
75123
75361
  async function renderTreeMode(refs, stateBackend, asJson) {
75124
- const roots = buildStackTree(await Promise.all(refs.map(async (ref) => {
75362
+ const entries = await Promise.all(refs.map(async (ref) => {
75125
75363
  if (!ref.region) return { stackName: ref.stackName };
75126
75364
  let state;
75127
75365
  try {
@@ -75139,7 +75377,8 @@ async function renderTreeMode(refs, stateBackend, asJson) {
75139
75377
  ...state?.parentLogicalId !== void 0 && { parentLogicalId: state.parentLogicalId },
75140
75378
  ...state?.parentRegion !== void 0 && { parentRegion: state.parentRegion }
75141
75379
  };
75142
- })));
75380
+ }));
75381
+ const roots = buildStackTree(entries);
75143
75382
  if (asJson) {
75144
75383
  process.stdout.write(`${JSON.stringify(stackTreeToJson(roots), null, 2)}\n`);
75145
75384
  return;
@@ -75905,11 +76144,12 @@ async function listAssetStorageMarkers(s3, bucket) {
75905
76144
  for (const key of keys) {
75906
76145
  const region = key.slice(BOOTSTRAP_MARKER_PREFIX.length, -5);
75907
76146
  try {
75908
- const marker = parseBootstrapMarker(await (await s3.send(new GetObjectCommand({
76147
+ const body = await (await s3.send(new GetObjectCommand({
75909
76148
  Bucket: bucket,
75910
76149
  Key: key,
75911
76150
  ...await expectedOwnerParam(s3)
75912
- }))).Body?.transformToString() ?? "", key);
76151
+ }))).Body?.transformToString() ?? "";
76152
+ const marker = parseBootstrapMarker(body, key);
75913
76153
  entries.push({
75914
76154
  region,
75915
76155
  assetBucket: marker.assetBucket,
@@ -76454,8 +76694,10 @@ async function rollbackCommand(stackArg, options) {
76454
76694
  let stackAwsClients;
76455
76695
  try {
76456
76696
  let ref;
76457
- if (stackArg) ref = resolveSingleRegion(stackArg, await setup.stateBackend.listStacks(), options.stackRegion);
76458
- else {
76697
+ if (stackArg) {
76698
+ const refs = await setup.stateBackend.listStacks();
76699
+ ref = resolveSingleRegion(stackArg, refs, options.stackRegion);
76700
+ } else {
76459
76701
  const candidates = await findJournalCandidates(setup.stateBackend, setup.prefix);
76460
76702
  const scoped = options.stackRegion ? candidates.filter((c) => c.region === options.stackRegion) : candidates;
76461
76703
  if (scoped.length === 0) {
@@ -76508,11 +76750,13 @@ async function rollbackCommand(stackArg, options) {
76508
76750
  for (let s = journal.segments.length - 1; s >= 0; s--) {
76509
76751
  const segment = journal.segments[s];
76510
76752
  logger.info(`\n Segment ${s + 1}/${journal.segments.length} (${segment.reason}${segment.runId ? `, run ${segment.runId}` : ""}):`);
76511
- if (segment.failedOperations && segment.failedOperations.length > 0) if (options.revertFailed) {
76512
- const failedPlan = planFailedOps(segment.failedOperations, planStateView);
76513
- for (const item of failedPlan) logger.info(failedActionLabel(item, options.skipFinalSnapshot === true));
76514
- applyFailedPlanToPreview(failedPlan, planStateView, options.skipFinalSnapshot === true);
76515
- } else for (const fop of segment.failedOperations) logger.info(` - (left as-is) ${fop.logicalId} (${fop.resourceType}) — its ${fop.changeType} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
76753
+ if (segment.failedOperations && segment.failedOperations.length > 0) {
76754
+ if (options.revertFailed) {
76755
+ const failedPlan = planFailedOps(segment.failedOperations, planStateView);
76756
+ for (const item of failedPlan) logger.info(failedActionLabel(item, options.skipFinalSnapshot === true));
76757
+ applyFailedPlanToPreview(failedPlan, planStateView, options.skipFinalSnapshot === true);
76758
+ } else for (const fop of segment.failedOperations) logger.info(` - (left as-is) ${fop.logicalId} (${fop.resourceType}) — its ${fop.changeType} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
76759
+ }
76516
76760
  const plan = planRollback(segment.operations, planStateView, orphanLogicalIds);
76517
76761
  for (const item of plan) logger.info(actionLabel(item, options.skipFinalSnapshot === true));
76518
76762
  applyPlanToPreview(plan, planStateView, options.skipFinalSnapshot === true);
@@ -76686,10 +76930,7 @@ function applyPlanToPreview(plan, previewState, skipFinalSnapshot) {
76686
76930
  break;
76687
76931
  case "revert":
76688
76932
  case "reverse-replacement":
76689
- case "reverse-replacement-readopt":
76690
- if (op.previousState) previewState[op.logicalId] = op.previousState;
76691
- break;
76692
- default: break;
76933
+ case "reverse-replacement-readopt": if (op.previousState) previewState[op.logicalId] = op.previousState;
76693
76934
  }
76694
76935
  }
76695
76936
  }
@@ -76709,10 +76950,7 @@ function applyFailedPlanToPreview(plan, previewState, skipFinalSnapshot) {
76709
76950
  case "orphan-failed-create-retain":
76710
76951
  delete previewState[op.logicalId];
76711
76952
  break;
76712
- case "revert-failed-update":
76713
- if (op.previousState) previewState[op.logicalId] = op.previousState;
76714
- break;
76715
- default: break;
76953
+ case "revert-failed-update": if (op.previousState) previewState[op.logicalId] = op.previousState;
76716
76954
  }
76717
76955
  }
76718
76956
  }
@@ -77491,7 +77729,7 @@ function looksLikeEcrHostWithForeignSuffix(imageUri) {
77491
77729
  * a foreign-bucket refusal like the create / teardown sides.
77492
77730
  */
77493
77731
  /** Default `--older-than` when the flag is not passed. */
77494
- const DEFAULT_OLDER_THAN_MS = 720 * 60 * 60 * 1e3;
77732
+ const DEFAULT_OLDER_THAN_MS = 2592e6;
77495
77733
  /** S3 `DeleteObjects` accepts at most 1,000 keys per call. */
77496
77734
  const S3_DELETE_BATCH_SIZE = 1e3;
77497
77735
  /** ECR `BatchDeleteImage` accepts at most 100 image ids per call. */
@@ -77512,7 +77750,7 @@ function parseOlderThan(value) {
77512
77750
  if (!match) throw new Error(`Invalid --older-than "${value}": expected <number>d or <number>h (e.g. 30d, 12h)`);
77513
77751
  const num = Number(match[1]);
77514
77752
  if (!Number.isFinite(num) || num <= 0) throw new Error(`Invalid --older-than "${value}": must be greater than zero`);
77515
- const multiplier = match[2] === "d" ? 1440 * 60 * 1e3 : 3600 * 1e3;
77753
+ const multiplier = match[2] === "d" ? 864e5 : 36e5;
77516
77754
  return Math.round(num * multiplier);
77517
77755
  }
77518
77756
  /**
@@ -77879,7 +78117,8 @@ async function scanReferencedAssets(stateBackend, marker, logger) {
77879
78117
  } catch (error) {
77880
78118
  const described = describeStateKey(key, STATE_FILE_SUFFIX, DEFAULT_STATE_PREFIX);
77881
78119
  const regionMatch = /^(\S+) \((\S+)\)$/.exec(described);
77882
- throw new CdkdError(`State file '${key}' is not valid JSON — aborting: gc must know every referenced asset before deleting anything, and this file's references are unreadable. Repair or remove the corrupt state file ('${regionMatch ? `cdkd state show ${regionMatch[1]} --stack-region ${regionMatch[2]}` : `cdkd state show ${described}`}' to inspect), then re-run.`, "GC_STATE_UNREADABLE", error);
78120
+ const inspectHint = regionMatch ? `cdkd state show ${regionMatch[1]} --stack-region ${regionMatch[2]}` : `cdkd state show ${described}`;
78121
+ throw new CdkdError(`State file '${key}' is not valid JSON — aborting: gc must know every referenced asset before deleting anything, and this file's references are unreadable. Repair or remove the corrupt state file ('${inspectHint}' to inspect), then re-run.`, "GC_STATE_UNREADABLE", error);
77883
78122
  }
77884
78123
  collectAssetReferences(parsed, marker, refs);
77885
78124
  }
@@ -78094,9 +78333,9 @@ function formatBytes(bytes) {
78094
78333
  /** Age of a timestamp relative to now, in whole days (or hours under 1d). */
78095
78334
  function formatAge(date) {
78096
78335
  const ageMs = Date.now() - date.getTime();
78097
- const days = Math.floor(ageMs / (1440 * 60 * 1e3));
78336
+ const days = Math.floor(ageMs / 864e5);
78098
78337
  if (days >= 1) return `${days}d old`;
78099
- return `${Math.max(0, Math.floor(ageMs / (3600 * 1e3)))}h old`;
78338
+ return `${Math.max(0, Math.floor(ageMs / 36e5))}h old`;
78100
78339
  }
78101
78340
  /**
78102
78341
  * Interactive confirmation for the deletion. Follows the repo's
@@ -78717,20 +78956,21 @@ async function rewriteSubTemplate(template, ownerLogicalId, pathPrefix, orphanSe
78717
78956
  continue;
78718
78957
  }
78719
78958
  const dot = inner.indexOf(".");
78720
- if (dot < 0) if (orphanSet.has(inner)) {
78721
- const replaced = fetcher.ref(inner);
78722
- rewrites.push({
78723
- logicalId: ownerLogicalId,
78724
- path: pathPrefix,
78725
- kind: "sub",
78726
- before: m[0],
78727
- after: replaced,
78728
- orphanLogicalId: inner
78729
- });
78730
- out += replaced;
78731
- didChange = true;
78732
- } else out += m[0];
78733
- else {
78959
+ if (dot < 0) {
78960
+ if (orphanSet.has(inner)) {
78961
+ const replaced = fetcher.ref(inner);
78962
+ rewrites.push({
78963
+ logicalId: ownerLogicalId,
78964
+ path: pathPrefix,
78965
+ kind: "sub",
78966
+ before: m[0],
78967
+ after: replaced,
78968
+ orphanLogicalId: inner
78969
+ });
78970
+ out += replaced;
78971
+ didChange = true;
78972
+ } else out += m[0];
78973
+ } else {
78734
78974
  const target = inner.slice(0, dot);
78735
78975
  const attribute = inner.slice(dot + 1);
78736
78976
  if (orphanSet.has(target)) {
@@ -79118,13 +79358,14 @@ async function publishAssetsCommand(stacks, options) {
79118
79358
  region: baseRegion,
79119
79359
  ...options.profile && { profile: options.profile }
79120
79360
  });
79121
- const resolver = new AssetModeResolver(new S3StateBackend(markerClients.s3, {
79361
+ const backend = new S3StateBackend(markerClients.s3, {
79122
79362
  bucket,
79123
79363
  prefix: options.statePrefix
79124
79364
  }, {
79125
79365
  region: baseRegion,
79126
79366
  ...options.profile && { profile: options.profile }
79127
- }), accountId, { ...options.profile && { profile: options.profile } });
79367
+ });
79368
+ const resolver = new AssetModeResolver(backend, accountId, { ...options.profile && { profile: options.profile } });
79128
79369
  markerAccess = {
79129
79370
  resolver,
79130
79371
  dispose: () => markerClients.destroy()
@@ -79454,13 +79695,15 @@ async function importCommand(stackArg, options) {
79454
79695
  const existingState = existingResult?.state ?? null;
79455
79696
  const existingEtag = existingResult?.etag;
79456
79697
  const migrationPending = existingResult?.migrationPending ?? false;
79457
- if (existingState) if (!selectiveMode) {
79458
- if (!options.force) throw new Error(`State already exists for stack '${stackInfo.stackName}' (${targetRegion}). Auto / whole-stack import rebuilds the entire resource map from the template, which would drop any state entry not re-imported. Pass --force to confirm. To add specific resources without affecting unlisted ones, use --resource <id>=<physicalId> (selective merge — no --force needed).`);
79459
- } else {
79460
- const conflicts = [...overrides.keys()].filter((id) => Object.prototype.hasOwnProperty.call(existingState.resources, id));
79461
- if (conflicts.length > 0 && !options.force) throw new Error(`Selective import would overwrite resource(s) already in state: ${conflicts.join(", ")}. Pass --force to confirm the overwrite, or remove these IDs from --resource / --resource-mapping.`);
79462
- const preservedCount = Object.keys(existingState.resources).filter((id) => !overrides.has(id)).length;
79463
- logger.info(`Merging into existing state for ${stackInfo.stackName} (${targetRegion}): preserving ${preservedCount} unlisted resource(s)` + (conflicts.length > 0 ? `, overwriting ${conflicts.length} listed entry(ies)` : ""));
79698
+ if (existingState) {
79699
+ if (!selectiveMode) {
79700
+ if (!options.force) throw new Error(`State already exists for stack '${stackInfo.stackName}' (${targetRegion}). Auto / whole-stack import rebuilds the entire resource map from the template, which would drop any state entry not re-imported. Pass --force to confirm. To add specific resources without affecting unlisted ones, use --resource <id>=<physicalId> (selective merge — no --force needed).`);
79701
+ } else {
79702
+ const conflicts = [...overrides.keys()].filter((id) => Object.prototype.hasOwnProperty.call(existingState.resources, id));
79703
+ if (conflicts.length > 0 && !options.force) throw new Error(`Selective import would overwrite resource(s) already in state: ${conflicts.join(", ")}. Pass --force to confirm the overwrite, or remove these IDs from --resource / --resource-mapping.`);
79704
+ const preservedCount = Object.keys(existingState.resources).filter((id) => !overrides.has(id)).length;
79705
+ logger.info(`Merging into existing state for ${stackInfo.stackName} (${targetRegion}): preserving ${preservedCount} unlisted resource(s)` + (conflicts.length > 0 ? `, overwriting ${conflicts.length} listed entry(ies)` : ""));
79706
+ }
79464
79707
  }
79465
79708
  for (const overrideId of overrides.keys()) if (!templateLogicalIds.has(overrideId)) throw new Error(`--resource / --resource-mapping references logical ID '${overrideId}' which is not in the synthesized template for stack '${stackInfo.stackName}'. Available IDs: ${[...templateLogicalIds].join(", ")}`);
79466
79709
  const owner = `${process.env["USER"] || "unknown"}@${process.env["HOSTNAME"] || "host"}:${process.pid}`;
@@ -79961,6 +80204,11 @@ function defaultOnlyParameterTemplate(template) {
79961
80204
  * weren't re-imported in this run — selective merge preserves them as
79962
80205
  * already-stored, which on the v3 baseline is already resolved-shape
79963
80206
  * from a prior import / deploy, so re-resolving is a no-op.
80207
+ *
80208
+ * Exported for unit testing — internal to the command flow otherwise. The
80209
+ * masking this walk applies (issue #2803) is only provable against the REAL
80210
+ * resolver, since the plaintext reaches the message through the resolver's
80211
+ * own throw rather than through anything this function writes.
79964
80212
  */
79965
80213
  async function resolveImportedProperties(stackState, template, region, stateBackend, logger) {
79966
80214
  const entries = Object.entries(stackState.resources);
@@ -79997,16 +80245,18 @@ async function resolveImportedProperties(stackState, template, region, stateBack
79997
80245
  stateBackend,
79998
80246
  stackName: stackState.stackName
79999
80247
  };
80000
- for (const [logicalId, resource] of entries) try {
80248
+ for (const [logicalId, resource] of entries) {
80001
80249
  const recordedSecretValues = /* @__PURE__ */ new Map();
80002
- const unresolvedProperties = resource.properties ?? {};
80003
- const resolved = await resolver.resolve(unresolvedProperties, {
80004
- ...baseContext,
80005
- recordedSecretValues
80006
- });
80007
- resource.properties = recordedSecretValues.size > 0 ? redactSecretsForState(resolved, recordedSecretValues, unresolvedProperties) : resolved;
80008
- } catch (err) {
80009
- logger.warn(`Failed to resolve intrinsics in Properties for imported resource '${logicalId}' (${resource.resourceType}): ${err instanceof Error ? err.message : String(err)}. State will be written with the raw intrinsic shape, which may cause 'cdkd destroy' to fail on this resource — re-import once every referenced sibling is in state, or remove this resource via 'cdkd state orphan'.` + (unboundParameterNames.length > 0 ? ` This template also declares parameter(s) with no 'Default' that an import cannot bind (${unboundParameterNames.join(", ")}), and 'cdkd import' accepts no parameter values — if this property was built from one of those, re-importing a sibling will not change it: give the parameter a 'Default' in the template and re-import, or correct the recorded properties before the next 'cdkd deploy'.` : ""));
80250
+ try {
80251
+ const unresolvedProperties = resource.properties ?? {};
80252
+ const resolved = await resolver.resolve(unresolvedProperties, {
80253
+ ...baseContext,
80254
+ recordedSecretValues
80255
+ });
80256
+ resource.properties = recordedSecretValues.size > 0 ? redactSecretsForState(resolved, recordedSecretValues, unresolvedProperties) : resolved;
80257
+ } catch (err) {
80258
+ logger.warn(`Failed to resolve intrinsics in Properties for imported resource '${logicalId}' (${resource.resourceType}): ${maskSecretsInText(err instanceof Error ? err.message : String(err), recordedSecretValues)}. State will be written with the raw intrinsic shape, which may cause 'cdkd destroy' to fail on this resource — re-import once every referenced sibling is in state, or remove this resource via 'cdkd state orphan'.` + (unboundParameterNames.length > 0 ? ` This template also declares parameter(s) with no 'Default' that an import cannot bind (${unboundParameterNames.join(", ")}), and 'cdkd import' accepts no parameter values — if this property was built from one of those, re-importing a sibling will not change it: give the parameter a 'Default' in the template and re-import, or correct the recorded properties before the next 'cdkd deploy'.` : ""));
80259
+ }
80010
80260
  }
80011
80261
  }
80012
80262
  function printSummary(rows) {
@@ -80544,10 +80794,11 @@ async function loadBootstrapContainerRepo(synthRegion, opts) {
80544
80794
  bucket: stateBucket,
80545
80795
  prefix: opts.statePrefix
80546
80796
  };
80547
- const { body, resolvedKey } = await readBootstrapMarkerBody(new S3StateBackend(awsClients.s3, stateConfig, {
80797
+ const stateBackend = new S3StateBackend(awsClients.s3, stateConfig, {
80548
80798
  ...clientRegion !== void 0 && { region: clientRegion },
80549
80799
  ...opts.profile !== void 0 && { profile: opts.profile }
80550
- }), rawRegion, { logPrefix: prefix });
80800
+ });
80801
+ const { body, resolvedKey } = await readBootstrapMarkerBody(stateBackend, rawRegion, { logPrefix: prefix });
80551
80802
  if (body === null) {
80552
80803
  const rawKey = getBootstrapMarkerKey(rawRegion);
80553
80804
  logger.debug(`${prefix}: no bootstrap marker at '${resolvedKey}'${rawKey !== resolvedKey ? ` (nor '${rawKey}')` : ""} in bucket '${stateBucket}' — assuming conventional asset-repo names.`);
@@ -80720,14 +80971,15 @@ var S3LocalStateProvider = class {
80720
80971
  this.opts = opts;
80721
80972
  }
80722
80973
  async load(stackName, synthRegion) {
80723
- const loaded = await loadStateForStack(stackName, synthRegion, {
80974
+ const loadOpts = {
80724
80975
  statePrefix: this.opts.statePrefix,
80725
80976
  ...this.opts.stackRegion !== void 0 && { stackRegion: this.opts.stackRegion },
80726
80977
  ...this.opts.rawStackRegion !== void 0 && { rawStackRegion: this.opts.rawStackRegion },
80727
80978
  ...this.opts.stateBucket !== void 0 && { stateBucket: this.opts.stateBucket },
80728
80979
  ...this.opts.region !== void 0 && { region: this.opts.region },
80729
80980
  ...this.opts.profile !== void 0 && { profile: this.opts.profile }
80730
- });
80981
+ };
80982
+ const loaded = await loadStateForStack(stackName, synthRegion, loadOpts);
80731
80983
  if (!loaded) return void 0;
80732
80984
  const outputs = {};
80733
80985
  for (const [k, v] of Object.entries(loaded.state.outputs ?? {})) if (typeof v === "string") outputs[k] = v;
@@ -80740,12 +80992,13 @@ var S3LocalStateProvider = class {
80740
80992
  };
80741
80993
  }
80742
80994
  async buildCrossStackResolver(consumerRegion) {
80743
- const built = await buildCrossStackResolver(consumerRegion, {
80995
+ const buildOpts = {
80744
80996
  statePrefix: this.opts.statePrefix,
80745
80997
  ...this.opts.stateBucket !== void 0 && { stateBucket: this.opts.stateBucket },
80746
80998
  ...this.opts.region !== void 0 && { region: this.opts.region },
80747
80999
  ...this.opts.profile !== void 0 && { profile: this.opts.profile }
80748
- });
81000
+ };
81001
+ const built = await buildCrossStackResolver(consumerRegion, buildOpts);
80749
81002
  if (!built) return void 0;
80750
81003
  this.disposers.push(built.dispose);
80751
81004
  return built.resolver;
@@ -82544,7 +82797,7 @@ async function runDetached(opts) {
82544
82797
  if (collisions.length > 0) logger.warn(`Env var(s) ${collisions.map((k) => JSON.stringify(k)).join(", ")} share a name with a docker-client environment variable or have a malformed name (empty, or containing '=' / NUL), and were NOT passed to the container at all (a colliding name would hijack the docker client; a malformed name cannot form a valid environment variable). Rename the env var if the container needs it.`);
82545
82798
  try {
82546
82799
  const { stdout } = await execFileAsync$3(getDockerCmd(), args, {
82547
- maxBuffer: 10 * 1024 * 1024,
82800
+ maxBuffer: 10485760,
82548
82801
  env: dockerSpawnEnvWithSensitive(passthroughEnv)
82549
82802
  });
82550
82803
  return stdout.trim();
@@ -82778,7 +83031,7 @@ const ASSUMED_ROLE_CACHE = /* @__PURE__ */ new Map();
82778
83031
  */
82779
83032
  const CALLER_IDENTITY_CACHE = /* @__PURE__ */ new Map();
82780
83033
  /** 5-minute safety margin against the recorded STS expiration timestamp. */
82781
- const STS_CREDENTIAL_SAFETY_MARGIN_MS = 300 * 1e3;
83034
+ const STS_CREDENTIAL_SAFETY_MARGIN_MS = 3e5;
82782
83035
  function isCredentialFresh(creds) {
82783
83036
  if (!creds.expiration) return false;
82784
83037
  return creds.expiration.getTime() - Date.now() > STS_CREDENTIAL_SAFETY_MARGIN_MS;
@@ -82886,7 +83139,8 @@ async function assumeRoleForEcr(roleArn, callerRegion, logger) {
82886
83139
  };
82887
83140
  } catch (err) {
82888
83141
  if (err instanceof LocalInvokeBuildError$1) throw err;
82889
- throw new LocalInvokeBuildError$1(`Failed to assume role ${roleArn} for ECR pull: ${err instanceof Error ? err.message : String(err)}. Verify the role exists and its trust policy permits the caller's identity to assume it.`);
83142
+ const reason = err instanceof Error ? err.message : String(err);
83143
+ throw new LocalInvokeBuildError$1(`Failed to assume role ${roleArn} for ECR pull: ${reason}. Verify the role exists and its trust policy permits the caller's identity to assume it.`);
82890
83144
  } finally {
82891
83145
  sts.destroy();
82892
83146
  }
@@ -83506,7 +83760,8 @@ function attachWebSocketServer(opts) {
83506
83760
  * route table.
83507
83761
  */
83508
83762
  async function handleManagementRequest(req, res, registry) {
83509
- if (parseConnectionsPath(req.url ?? "") === null) return false;
83763
+ const url = req.url ?? "";
83764
+ if (parseConnectionsPath(url) === null) return false;
83510
83765
  await handleConnectionsRequest({
83511
83766
  req,
83512
83767
  res,
@@ -83774,8 +84029,9 @@ function createContainerPool(specs, options) {
83774
84029
  readOnly: true
83775
84030
  }] : optMount;
83776
84031
  const containerCodePath = resolveRuntimeCodeMountPath(spec.lambda.runtime);
84032
+ const image = resolveRuntimeImage(spec.lambda.runtime);
83777
84033
  containerId = await runDetached({
83778
- image: resolveRuntimeImage(spec.lambda.runtime),
84034
+ image,
83779
84035
  mounts: [{
83780
84036
  hostPath: spec.codeDir,
83781
84037
  containerPath: containerCodePath,
@@ -85675,7 +85931,7 @@ async function createNetworkAndSidecar(args) {
85675
85931
  logger.info(`Starting ECS local-container-endpoints sidecar at ${sidecarIp}...`);
85676
85932
  try {
85677
85933
  const { stdout } = await execFileAsync$2(getDockerCmd(), sidecarArgs, {
85678
- maxBuffer: 10 * 1024 * 1024,
85934
+ maxBuffer: 10485760,
85679
85935
  env: dockerSpawnEnvWithSensitive(sidecarSensitiveEnv)
85680
85936
  });
85681
85937
  return stdout.trim();
@@ -86048,7 +86304,7 @@ async function runEcsTask(task, options, state) {
86048
86304
  try {
86049
86305
  const sensitiveEnv = dockerEnvs.get(container.name);
86050
86306
  const { stdout } = await execFileAsync$1(getDockerCmd(), args, {
86051
- maxBuffer: 10 * 1024 * 1024,
86307
+ maxBuffer: 10485760,
86052
86308
  env: dockerSpawnEnvWithSensitive(sensitiveEnv)
86053
86309
  });
86054
86310
  id = stdout.trim();
@@ -86139,9 +86395,7 @@ async function awaitDependencies(container, started) {
86139
86395
  if (code !== 0) throw new EcsTaskRunnerError(`Container '${container.name}' requires dependency '${dep.containerName}' to exit 0, but it exited ${code}.`);
86140
86396
  break;
86141
86397
  }
86142
- case "HEALTHY":
86143
- await waitForContainerHealthy(entry.id, dep.containerName);
86144
- break;
86398
+ case "HEALTHY": await waitForContainerHealthy(entry.id, dep.containerName);
86145
86399
  }
86146
86400
  }
86147
86401
  }
@@ -86154,7 +86408,7 @@ async function awaitDependencies(container, started) {
86154
86408
  */
86155
86409
  async function waitForContainerHealthy(containerId, displayName) {
86156
86410
  const logger = getLogger().child("ecs-runner");
86157
- const deadline = Date.now() + 300 * 1e3;
86411
+ const deadline = Date.now() + 3e5;
86158
86412
  let lastStatus = "";
86159
86413
  const inspectArgs = [
86160
86414
  "inspect",
@@ -86183,7 +86437,7 @@ async function waitForContainerHealthy(containerId, displayName) {
86183
86437
  async function waitForContainerExit(containerId) {
86184
86438
  const waitArgs = ["wait", containerId];
86185
86439
  try {
86186
- const { stdout } = await execFileAsync$1(getDockerCmd(), waitArgs, { maxBuffer: 1024 * 1024 });
86440
+ const { stdout } = await execFileAsync$1(getDockerCmd(), waitArgs, { maxBuffer: 1048576 });
86187
86441
  const code = Number.parseInt(stdout.trim(), 10);
86188
86442
  return Number.isFinite(code) ? code : 1;
86189
86443
  } catch (err) {
@@ -86382,11 +86636,12 @@ function buildDockerRunArgs(opts) {
86382
86636
  for (const mp of container.mountPoints) {
86383
86637
  const v = volumeByName.get(mp.sourceVolume);
86384
86638
  if (!v) continue;
86385
- if (v.kind === "host") if (v.hostPath) {
86386
- const ro = mp.readOnly ? ":ro" : "";
86387
- args.push("-v", `${v.hostPath}:${mp.containerPath}${ro}`);
86388
- } else args.push("-v", mp.containerPath);
86389
- else {
86639
+ if (v.kind === "host") {
86640
+ if (v.hostPath) {
86641
+ const ro = mp.readOnly ? ":ro" : "";
86642
+ args.push("-v", `${v.hostPath}:${mp.containerPath}${ro}`);
86643
+ } else args.push("-v", mp.containerPath);
86644
+ } else {
86390
86645
  const name = v.dockerVolumeName ?? v.name;
86391
86646
  const ro = mp.readOnly ? ":ro" : "";
86392
86647
  args.push("-v", `${name}:${mp.containerPath}${ro}`);
@@ -86411,7 +86666,8 @@ function buildDockerRunArgs(opts) {
86411
86666
  applyOverrideMap(finalEnv, overrides["Parameters"]);
86412
86667
  applyOverrideMap(finalEnv, overrides[container.name]);
86413
86668
  }
86414
- const { flags, sensitiveEnv, collisions } = partitionSensitiveEnv(finalEnv, /* @__PURE__ */ new Set([...SENSITIVE_ENV_KEYS, ...secrets.map((s) => s.name)]));
86669
+ const sensitiveKeys = /* @__PURE__ */ new Set([...SENSITIVE_ENV_KEYS, ...secrets.map((s) => s.name)]);
86670
+ const { flags, sensitiveEnv, collisions } = partitionSensitiveEnv(finalEnv, sensitiveKeys);
86415
86671
  args.push(...flags);
86416
86672
  if (container.user) args.push("--user", container.user);
86417
86673
  if (container.privileged) args.push("--privileged");
@@ -86526,16 +86782,20 @@ async function localRunTaskCommand(target, options) {
86526
86782
  const { context: imageContext, stateRecordRegion } = await buildEcsImageResolutionContext$1(candidate, stateProvider, options);
86527
86783
  const task = resolveEcsTaskTarget(target, stacks, imageContext);
86528
86784
  logger.info(`Target: ${task.stack.stackName}/${task.taskDefinitionLogicalId} (family=${task.family}, containers=${task.containers.length})`);
86529
- const taskNeeds = detectEcsImageResolutionNeeds(stacks.find((s) => s.stackName === task.stack.stackName) ?? task.stack);
86785
+ const taskStack = stacks.find((s) => s.stackName === task.stack.stackName) ?? task.stack;
86786
+ const taskNeeds = detectEcsImageResolutionNeeds(taskStack);
86530
86787
  if (stateProvider && taskNeeds.needsCrossStackResolver) {
86531
86788
  const consumerRegion = resolveEcsConsumerRegion(stateRecordRegion, options, task.stack.region);
86532
86789
  const resolver = await stateProvider.buildCrossStackResolver(consumerRegion);
86533
- if (resolver) await applyCrossStackResolverToTask(task, {
86534
- resources: imageContext?.stateResources ?? {},
86535
- ...imageContext?.pseudoParameters && { pseudoParameters: imageContext.pseudoParameters },
86536
- consumerRegion,
86537
- crossStackResolver: resolver
86538
- });
86790
+ if (resolver) {
86791
+ const subContext = {
86792
+ resources: imageContext?.stateResources ?? {},
86793
+ ...imageContext?.pseudoParameters && { pseudoParameters: imageContext.pseudoParameters },
86794
+ consumerRegion,
86795
+ crossStackResolver: resolver
86796
+ };
86797
+ await applyCrossStackResolverToTask(task, subContext);
86798
+ }
86539
86799
  } else if (!stateProvider && taskNeeds.needsCrossStackResolver) logger.warn("Container Environment / Secrets entries contain Fn::ImportValue / Fn::GetStackOutput intrinsics. Pass --from-state (cdkd-deployed) or --from-cfn-stack (cdk-deployed) to substitute them against deployed state.");
86540
86800
  sigintHandler = () => {
86541
86801
  sigintCount += 1;
@@ -87075,7 +87335,7 @@ async function softReloadAgentContainer(containerId, newAssetSourceDir) {
87075
87335
  `${containerId}:${workdirDest}`
87076
87336
  ];
87077
87337
  try {
87078
- await execFileAsync(dockerCmd, cpArgs, { maxBuffer: 64 * 1024 * 1024 });
87338
+ await execFileAsync(dockerCmd, cpArgs, { maxBuffer: 67108864 });
87079
87339
  } catch (err) {
87080
87340
  throw new CdkdError(`softReloadAgentContainer: docker cp into '${containerId}:${workdir}' failed: ${describeDockerExecFailure(err, cpArgs)}.`, "LOCAL_INVOKE_AGENTCORE_WATCH_SOFT_RELOAD_CP_FAILED");
87081
87341
  }
@@ -87614,8 +87874,9 @@ async function buildSigV4HeadersIfRequested(options, resolved, loaded, host, por
87614
87874
  }
87615
87875
  const region = canonicalizeRegion(options.region ?? options.stackRegion ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? resolved.stack.region);
87616
87876
  if (!region) throw new CdkdError("--sigv4: no region resolved for the AgentCore signing scope. Pass --region <region>, set AWS_REGION, or use --from-cfn-stack with a region-bound stack.", "LOCAL_INVOKE_AGENTCORE_SIGV4_NO_REGION");
87877
+ const credentials = await resolveHostCredentialsForSigV4(options, resolved, loaded, region);
87617
87878
  const signed = await signAgentCoreInvocation({
87618
- credentials: await resolveHostCredentialsForSigV4(options, resolved, loaded, region),
87879
+ credentials,
87619
87880
  region,
87620
87881
  host,
87621
87882
  port,
@@ -88735,15 +88996,16 @@ async function localInvokeCommand(target, options) {
88735
88996
  }
88736
88997
  let resolvedAssumeRoleArn;
88737
88998
  if (typeof options.assumeRole === "string") resolvedAssumeRoleArn = options.assumeRole;
88738
- else if (options.assumeRole === true) if (!stateForRoleHint) logger.warn("--assume-role passed without an ARN, but no cdkd state was loaded. Pair it with --from-state, or pass the ARN explicitly: --assume-role <arn>. Falling back to the developer's shell credentials.");
88739
- else {
88740
- const arn = resolveExecutionRoleArnFromState(stateForRoleHint, lambda.logicalId);
88741
- if (arn) {
88742
- resolvedAssumeRoleArn = arn;
88743
- logger.info(`--assume-role: auto-resolved execution role from cdkd state: ${arn}`);
88744
- } else logger.warn(`--assume-role: could not resolve the execution role ARN from cdkd state for '${lambda.logicalId}'. Pass the ARN explicitly: --assume-role <arn>. Falling back to the developer's shell credentials.`);
88745
- }
88746
- else maybeSuggestAssumeRole(options, stateForRoleHint, lambda.logicalId);
88999
+ else if (options.assumeRole === true) {
89000
+ if (!stateForRoleHint) logger.warn("--assume-role passed without an ARN, but no cdkd state was loaded. Pair it with --from-state, or pass the ARN explicitly: --assume-role <arn>. Falling back to the developer's shell credentials.");
89001
+ else {
89002
+ const arn = resolveExecutionRoleArnFromState(stateForRoleHint, lambda.logicalId);
89003
+ if (arn) {
89004
+ resolvedAssumeRoleArn = arn;
89005
+ logger.info(`--assume-role: auto-resolved execution role from cdkd state: ${arn}`);
89006
+ } else logger.warn(`--assume-role: could not resolve the execution role ARN from cdkd state for '${lambda.logicalId}'. Pass the ARN explicitly: --assume-role <arn>. Falling back to the developer's shell credentials.`);
89007
+ }
89008
+ } else maybeSuggestAssumeRole(options, stateForRoleHint, lambda.logicalId);
88747
89009
  const event = await readEvent(options);
88748
89010
  const dockerEnv = {
88749
89011
  AWS_LAMBDA_FUNCTION_NAME: lambda.logicalId,
@@ -88800,7 +89062,8 @@ async function localInvokeCommand(target, options) {
88800
89062
  };
88801
89063
  process.on("SIGINT", sigintHandler);
88802
89064
  await waitForRieReady(containerHost, hostPort, 5e3);
88803
- const result = await invokeRie(containerHost, hostPort, event, Math.max(3e4, lambda.timeoutSec * 2 * 1e3));
89065
+ const invokeTimeoutMs = Math.max(3e4, lambda.timeoutSec * 2 * 1e3);
89066
+ const result = await invokeRie(containerHost, hostPort, event, invokeTimeoutMs);
88804
89067
  await new Promise((resolveDelay) => setTimeout(resolveDelay, 250));
88805
89068
  process.stdout.write(`${result.raw}\n`);
88806
89069
  } finally {
@@ -89519,4 +89782,4 @@ function buildProgram() {
89519
89782
 
89520
89783
  //#endregion
89521
89784
  export { buildProgram };
89522
- //# sourceMappingURL=program-CizHCByV.js.map
89785
+ //# sourceMappingURL=program-BRon74Fc.js.map