@go-to-k/cdkd 0.300.0 → 0.300.1

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.
Files changed (26) hide show
  1. package/dist/{asg-provider-COcKVcvZ.js → asg-provider-BS5i71bK.js} +3 -3
  2. package/dist/{asg-provider-COcKVcvZ.js.map → asg-provider-BS5i71bK.js.map} +1 -1
  3. package/dist/cli.js +2 -2
  4. package/dist/{deploy-engine-C-4ho8TJ.js → deploy-engine-BK4gG_5A.js} +296 -62
  5. package/dist/deploy-engine-BK4gG_5A.js.map +1 -0
  6. package/dist/{iam-policy-targets-BxP3yqlr.js → iam-policy-targets-DAs3w7QW.js} +43 -2
  7. package/dist/{iam-policy-targets-BxP3yqlr.js.map → iam-policy-targets-DAs3w7QW.js.map} +1 -1
  8. package/dist/{iam-role-provider-a-8z7Dpm.js → iam-role-provider-SmvPHPLC.js} +15 -10
  9. package/dist/iam-role-provider-SmvPHPLC.js.map +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -3
  12. package/dist/{neptune-provider-Bnr2VC6V.js → neptune-provider-CqZ1FaqT.js} +3 -3
  13. package/dist/{neptune-provider-Bnr2VC6V.js.map → neptune-provider-CqZ1FaqT.js.map} +1 -1
  14. package/dist/{program-BHjdsRtD.js → program-DVPHKsxv.js} +6 -6
  15. package/dist/{program-BHjdsRtD.js.map → program-DVPHKsxv.js.map} +1 -1
  16. package/dist/{provider-classes-CVC9_-km.js → provider-classes-CDzT2xg0.js} +227 -68
  17. package/dist/provider-classes-CDzT2xg0.js.map +1 -0
  18. package/dist/{rds-provider-QKN-WHF3.js → rds-provider-DraxDuQq.js} +13 -7
  19. package/dist/rds-provider-DraxDuQq.js.map +1 -0
  20. package/dist/{version-CXGQKplb.js → version-DTSDiQcV.js} +2 -2
  21. package/dist/{version-CXGQKplb.js.map → version-DTSDiQcV.js.map} +1 -1
  22. package/package.json +1 -1
  23. package/dist/deploy-engine-C-4ho8TJ.js.map +0 -1
  24. package/dist/iam-role-provider-a-8z7Dpm.js.map +0 -1
  25. package/dist/provider-classes-CVC9_-km.js.map +0 -1
  26. package/dist/rds-provider-QKN-WHF3.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { r as getAwsClients } from "./aws-clients-B_CEQGE1.js";
2
2
  import { B as safeMsg, F as displaySafe, I as displayStackName, L as isPasteableIdent, O as SECRET_REF_MAX_CODE_POINTS, P as displayIdent, a as getLogger, b as generateResourceNameWithFallback, n as isAwsAuthoredFailure, r as safeStringify, t as describeAwsFailure, y as generateResourceName, z as plainIdentOr } from "./aws-failure-text-BEQfs6za.js";
3
- import { $ as protectedReplacementAdvice, $n as isAmbiguousOutcomeError, $t as credentialFingerprint, A as isQuotableImportValue, B as isTerminalDeleteFailure, Bn as withheldTargetClause, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Gt as injectiveKeyPrefix, H as observeThenDisableProtection, In as plainOrDescribed, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mn as hasClauseBreak, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as isInertUnquoted, O as isPlainImportJson, P as remedyLogicalId, Pn as pasteableCommand, Q as pasteableAwsCommand, Qt as clientDefaultsFor, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, W as rdsFamilyProtectionSite, Wt as injectiveKey, X as WITHHELD_AWS_COMMAND, Xn as markReplayMayCollide, Xt as ambientClientDefaults, Y as UNNAMEABLE_ID_CLAUSE, Yn as markNameCollision, Yt as withPasteableAwsProfile, Z as isAwsCliLiteral, Zt as ambientCredentialConfig, _ as RecentIdSet, _t as createMaskedLogSinks, a as onlySecretDerived, ar as isMarkedNonRetryable, at as startInterruptWatch, b as isInsideWindow, bt as maskDeep, c as recordedPrincipalsRepair, cr as markRedactedCause, ct as canonicalizeRoute53QueryName, dt as compositeIdSkipResult, en as AccountIdUnavailableError, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gn as ProvisioningError, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, ir as THROTTLING_ERROR_NAMES, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jn as commandHole, jt as markAuxiliaryFailure, k as isPlainImportValue, lr as wrapMaskedAwsError, lt as compositeIdFormatMessage, nn as CdkdError, nr as isTransientServerError, o as readPrincipalLists, or as isThrottlingError, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pt as packCompositeId, q as userPoolProtectionSite, r as SECRET_DERIVED_READ_LIVE, sr as markNonRetryable, tr as isRetryableTransientError, u as clearOnUpdateRemoval, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ResourceUpdateNotSupportedError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation, zn as shellQuote } from "./iam-policy-targets-BxP3yqlr.js";
3
+ import { $ as protectedReplacementAdvice, $t as ambientCredentialConfig, A as isQuotableImportValue, B as isTerminalDeleteFailure, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Fn as isInertUnquoted, H as observeThenDisableProtection, Hn as withheldTargetClause, In as pasteableCommand, Kt as injectiveKey, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as commandHole, Nt as markSupersedesEarlierCreate, O as isPlainImportJson, P as remedyLogicalId, Pn as hasClauseBreak, Q as pasteableAwsCommand, Qn as markReplayMayCollide, Qt as ambientClientDefaults, Rn as plainOrDescribed, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, Vn as shellQuote, W as rdsFamilyProtectionSite, X as WITHHELD_AWS_COMMAND, Y as UNNAMEABLE_ID_CLAUSE, Z as isAwsCliLiteral, Zn as markNameCollision, Zt as withPasteableAwsProfile, _ as RecentIdSet, _t as createMaskedLogSinks, a as onlySecretDerived, at as startInterruptWatch, b as isInsideWindow, bn as ResourceUpdateNotSupportedError, bt as maskDeep, c as recordedPrincipalsRepair, cr as isThrottlingError, ct as canonicalizeRoute53QueryName, dr as wrapMaskedAwsError, dt as compositeIdSkipResult, en as clientDefaultsFor, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, in as CdkdError, ir as isTransientServerError, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jt as markAuxiliaryFailure, k as isPlainImportValue, lr as markNonRetryable, lt as compositeIdFormatMessage, nn as AccountIdUnavailableError, o as readPrincipalLists, or as THROTTLING_ERROR_NAMES, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pt as packCompositeId, q as userPoolProtectionSite, qt as injectiveKeyPrefix, r as SECRET_DERIVED_READ_LIVE, rr as isRetryableTransientError, sr as isMarkedNonRetryable, tn as credentialFingerprint, tr as isAmbiguousOutcomeError, u as clearOnUpdateRemoval, ur as markRedactedCause, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ProvisioningError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation } from "./iam-policy-targets-DAs3w7QW.js";
4
4
  import { s as ambientRegion } from "./aws-client-defaults-DBXBcg0J.js";
5
- import { $ as S3_AUTO_DELETE_OBJECTS_TAG, $a as findSilentDropProperties, Ao as lambdaFunctionNameForMask, Ar as unchangedBehindSecretReference, At as withNestedStackContext, Br as ec2InstanceProtectionSite, Bt as awaitInFlightSibling, C as withApiLimit, Cl as derivePartitionAndUrlSuffix, Co as requireConfigObject, Cr as getCurrentResourceSecrets, Cs as physicalNameCopiesOf, Ds as carriesSecretMask, Fl as renderAssemblyPathEscape, Fr as deleteSkipReason, G as deleteBudgetKey, Gt as replacedDeleteFailureVerdict, H as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Hr as observeThenDisableInstanceApiTermination, Ht as getStackRecords, Il as resolveAssemblyPath, Ir as withIndeterminateGuard, J as DELETE_INDEX_WAIT_PROCEED_NOTE, K as resolveDynamoDbDeleteBudgetClock, Li as passedParameterClassesOf, Lr as isWaitAbandonedError, Nl as describeFileReadFailure, Oo as withRetry, Pi as parseWebACLArn, Pl as displayAssemblyPath, Q as ECR_AUTO_DELETE_IMAGES_TAG, Rr as markWaitAbandoned, S as lookupEachName, Sl as canonicalizeRegion, So as requireConfigArray, Ss as recoverMaskedOutput, St as getNestedRevertRun, Tt as revertNestedChildFromJournal, U as beginDeleteWait, Uo as passedNoEchoParametersOf, Ur as reDisableInstanceApiTermination, V as DynamoDBGlobalTableProvider, Vr as isTerminationProtectionPropagationError, W as compensateRemovedDeletionProtection, Wi as accountArgs, Wr as reEnableInstanceApiTermination, X as deleteTableWithIndexBusyRetry, Xo as hasMaskableValues, Y as INDEX_SETTLE_POLL_INTERVAL_MS, Z as waitForIndexesSettled, Za as withheldAccountClause, _c as rewriteTemplateAssetReferences, _o as configBooleanRefusal, an as getCurrentProducerRegions, ar as acquireIdempotencyToken, b as chunks, bo as readConfigString, c as isAbsoluteAssetPath, cn as isRedactedRecordedValue, cr as planTagDiff, cs as markSameGenerationBag, do as coerceWarmThroughput$1, dr as tagMapAsList, ds as redactSecretsForState, et as hasCdkAutoDeleteTag, fc as stringifyValue, fi as s3BucketArn, fo as isWarmThroughputDecrease, fr as tagPlanWarning, gi as s3BucketWebsiteUrl, go as coerceCfnInteger, gs as dynamicReferenceTokens, hi as s3BucketRegionalDomainName, ho as coerceCfnBoolean, jo as sameLambdaFunctionAddress, ko as canonicalLambdaFunctionName, kr as slowCcOperationTimeoutMs, kt as getCurrentNestedStackContext, l as listNestedTemplateRows, li as outputReferenceProvenanceOf, ln as redactedDeleteAddressFields, lr as readTagList, ls as recordReferenceProvenanceEntry, mi as s3BucketDualStackDomainName, mo as toFiniteNumber, mr as stringifyIfAssigned, ms as withoutPhysicalNameCopies, nt as getPriorAttempts, or as DBPROXY_TAGS_WHAT, pi as s3BucketDomainName, po as toCfnInteger, pr as definedAttributes, q as resolveDynamoDbDeleteBudgetMs, rr as reserveStackCreateToken, rt as markRefusedBeforeApplying, s as findNestedTemplateTreeDefect, si as isSettledInstanceState, sn as REDACTED_DELETE_ADDRESS_SKIP_REASON, sr as DBPROXY_TAG_OPTIONS, t as DeployEngine, to as withoutSilentDropProperties, tr as earliestDefined, tt as isTruthyCfnBoolean, u as renderNestedTemplateTreeDefect, un as redactedDeleteAddressSkip, uo as WARM_THROUGHPUT_MEMBERS, ur as refuseMalformedDesiredTags, us as snapshotPassProvenance, vo as configIntegerRefusal, wi as getAccountInfo, wo as requireConfigString, ws as recordAttributeIdCopy, x as isAccessDeniedError, xo as replayWarn, ya as refuseMalformedNestedChildOutputs, yl as decodeListingKey, yo as configStringRefusal, za as refuseMalformedResourcesForDestroy } from "./deploy-engine-C-4ho8TJ.js";
6
- import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-a-8z7Dpm.js";
7
- import { a as resolveSecretDerivedPrincipals, i as isResolvableSecretPrincipalList, n as runDestroyForStack, o as canonicalizeIpProtocolValue, r as holdsUnprovenSecretPrincipalToken, s as resolvedResourceTimeoutMs, t as canonicalizeIpv4Cidr } from "./program-BHjdsRtD.js";
8
- import { RDSProvider } from "./rds-provider-QKN-WHF3.js";
9
- import { NeptuneProvider } from "./neptune-provider-Bnr2VC6V.js";
10
- import { ASGProvider } from "./asg-provider-COcKVcvZ.js";
5
+ import { $ as S3_AUTO_DELETE_OBJECTS_TAG, $a as withheldAccountClause, Ao as withRetry, At as withNestedStackContext, Br as markWaitAbandoned, Bt as awaitInFlightSibling, C as withApiLimit, Co as replayWarn, Ei as getAccountInfo, Eo as requireConfigString, Es as recordAttributeIdCopy, Fl as describeFileReadFailure, G as deleteBudgetKey, Go as passedNoEchoParametersOf, Gr as reDisableInstanceApiTermination, Gt as replacedDeleteFailureVerdict, H as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Hr as ec2InstanceProtectionSite, Ht as getStackRecords, Ii as parseWebACLArn, Il as displayAssemblyPath, J as DELETE_INDEX_WAIT_PROCEED_NOTE, K as resolveDynamoDbDeleteBudgetClock, Ki as accountArgs, Kr as reEnableInstanceApiTermination, Ll as renderAssemblyPathEscape, Lr as deleteSkipReason, Mo as lambdaFunctionNameForMask, Mr as unchangedBehindSecretReference, No as sameLambdaFunctionAddress, Q as ECR_AUTO_DELETE_IMAGES_TAG, Qo as hasMaskableValues, Rl as resolveAssemblyPath, Rr as withIndeterminateGuard, S as lookupEachName, So as readConfigString, St as getNestedRevertRun, Tl as derivePartitionAndUrlSuffix, To as requireConfigObject, Tr as getCurrentResourceSecrets, Ts as physicalNameCopiesOf, Tt as revertNestedChildFromJournal, U as beginDeleteWait, Ur as isTerminationProtectionPropagationError, V as DynamoDBGlobalTableProvider, Va as refuseMalformedResourcesForDestroy, W as compensateRemovedDeletionProtection, Wr as observeThenDisableInstanceApiTermination, X as deleteTableWithIndexBusyRetry, Y as INDEX_SETTLE_POLL_INTERVAL_MS, Z as waitForIndexesSettled, _i as s3BucketRegionalDomainName, _o as coerceCfnBoolean, an as getCurrentProducerRegions, ar as acquireIdempotencyToken, b as chunks, bo as configIntegerRefusal, c as isAbsoluteAssetPath, cn as isRedactedRecordedValue, cr as DBPROXY_TAGS_WHAT, di as outputReferenceProvenanceOf, dr as readTagList, ds as recordReferenceProvenanceEntry, et as hasCdkAutoDeleteTag, fo as WARM_THROUGHPUT_MEMBERS, fr as refuseMalformedDesiredTags, fs as snapshotPassProvenance, gi as s3BucketDualStackDomainName, go as toFiniteNumber, gr as stringifyIfAssigned, gs as withoutPhysicalNameCopies, hi as s3BucketDomainName, ho as toCfnInteger, hr as definedAttributes, jo as canonicalLambdaFunctionName, jr as slowCcOperationTimeoutMs, ks as carriesSecretMask, kt as getCurrentNestedStackContext, l as listNestedTemplateRows, li as isSettledInstanceState, ln as redactedDeleteAddressFields, lr as DBPROXY_TAG_OPTIONS, mc as stringifyValue, mi as s3BucketArn, mo as isWarmThroughputDecrease, mr as tagPlanWarning, nt as getPriorAttempts, or as isRefusedByName, po as coerceWarmThroughput$1, pr as tagMapAsList, ps as redactSecretsForState, q as resolveDynamoDbDeleteBudgetMs, ro as withoutSilentDropProperties, rr as reserveStackCreateToken, rt as markRefusedBeforeApplying, s as findNestedTemplateTreeDefect, sn as REDACTED_DELETE_ADDRESS_SKIP_REASON, sr as markDeleteStarted, t as DeployEngine, to as findSilentDropProperties, tr as earliestDefined, tt as isTruthyCfnBoolean, u as renderNestedTemplateTreeDefect, un as redactedDeleteAddressSkip, ur as planTagDiff, us as markSameGenerationBag, vi as s3BucketWebsiteUrl, vo as coerceCfnInteger, vs as dynamicReferenceTokens, wl as canonicalizeRegion, wo as requireConfigArray, ws as recoverMaskedOutput, x as isAccessDeniedError, xa as refuseMalformedNestedChildOutputs, xl as decodeListingKey, xo as configStringRefusal, yc as rewriteTemplateAssetReferences, yo as configBooleanRefusal, zi as passedParameterClassesOf, zr as isWaitAbandonedError } from "./deploy-engine-BK4gG_5A.js";
6
+ import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-SmvPHPLC.js";
7
+ import { a as resolveSecretDerivedPrincipals, i as isResolvableSecretPrincipalList, n as runDestroyForStack, o as canonicalizeIpProtocolValue, r as holdsUnprovenSecretPrincipalToken, s as resolvedResourceTimeoutMs, t as canonicalizeIpv4Cidr } from "./program-DVPHKsxv.js";
8
+ import { RDSProvider } from "./rds-provider-DraxDuQq.js";
9
+ import { NeptuneProvider } from "./neptune-provider-CqZ1FaqT.js";
10
+ import { ASGProvider } from "./asg-provider-BS5i71bK.js";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { 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, ListBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client } from "@aws-sdk/client-s3";
13
13
  import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreateAccessKeyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreatePolicyCommand, CreatePolicyVersionCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeletePolicyCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetAccessKeyLastUsedCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetPolicyCommand, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListEntitiesForPolicyCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListPoliciesCommand, ListPolicyTagsCommand, ListPolicyVersionsCommand, ListUserPoliciesCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagPolicyCommand, TagUserCommand, UntagPolicyCommand, UntagUserCommand, UpdateAccessKeyCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
@@ -417,7 +417,9 @@ var IAMPolicyProvider = class {
417
417
  }
418
418
  let secretPrincipalLacksGrant = false;
419
419
  const detached = context?.resolveSecretDerivedPrincipals?.retryMemo?.detached;
420
+ let removedAny = false;
420
421
  const onDetached = (kind, name) => {
422
+ removedAny = true;
421
423
  if (fromSecret(kind, name)) detached?.add(injectiveKey(kind, name));
422
424
  };
423
425
  const claimed = (kind, name) => {
@@ -505,7 +507,8 @@ var IAMPolicyProvider = class {
505
507
  this.logger.debug(`Successfully deleted IAM policy ${logicalId}`);
506
508
  } catch (error) {
507
509
  const cause = error instanceof Error ? error : void 0;
508
- throw maskError(new ProvisioningError(`Failed to delete IAM policy ${logicalId}: ${mask(error instanceof Error ? error.message : String(error))}`, resourceType, logicalId, physicalId, cause));
510
+ const failure = new ProvisioningError(`Failed to delete IAM policy ${logicalId}: ${mask(error instanceof Error ? error.message : String(error))}`, resourceType, logicalId, physicalId, cause);
511
+ throw maskError(removedAny ? markDeleteStarted(failure) : failure);
509
512
  }
510
513
  }
511
514
  async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
@@ -772,6 +775,7 @@ var IAMManagedPolicyProvider = class {
772
775
  async delete(logicalId, physicalId, resourceType, _properties, context) {
773
776
  const mask = maskerOrIdentity(context?.maskSecrets);
774
777
  this.logger.debug(mask(`Deleting IAM managed policy ${logicalId}: ${physicalId}`));
778
+ const progress = { stripped: false };
775
779
  try {
776
780
  try {
777
781
  await this.iamClient.send(new GetPolicyCommand({ PolicyArn: physicalId }));
@@ -782,7 +786,7 @@ var IAMManagedPolicyProvider = class {
782
786
  }
783
787
  throw error;
784
788
  }
785
- await this.detachAllPrincipals(physicalId);
789
+ await this.detachAllPrincipals(physicalId, progress);
786
790
  await this.deleteAllNonDefaultVersions(physicalId);
787
791
  await this.iamClient.send(new DeletePolicyCommand({ PolicyArn: physicalId }));
788
792
  this.logger.debug(`Successfully deleted IAM managed policy ${logicalId}`);
@@ -792,7 +796,8 @@ var IAMManagedPolicyProvider = class {
792
796
  return;
793
797
  }
794
798
  const cause = error instanceof Error ? error : void 0;
795
- throw this.wrapMaskedError(mask, error, (text) => new ProvisioningError(`Failed to delete IAM managed policy ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
799
+ const failure = this.wrapMaskedError(mask, error, (text) => new ProvisioningError(`Failed to delete IAM managed policy ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
800
+ throw progress.stripped ? markDeleteStarted(failure) : failure;
796
801
  }
797
802
  }
798
803
  async goneOnDelete(logicalId, physicalId, resourceType, context, mask) {
@@ -1035,7 +1040,7 @@ var IAMManagedPolicyProvider = class {
1035
1040
  } while (marker);
1036
1041
  return live;
1037
1042
  }
1038
- async detachAllPrincipals(policyArn) {
1043
+ async detachAllPrincipals(policyArn, progress) {
1039
1044
  try {
1040
1045
  let marker;
1041
1046
  while (true) {
@@ -1050,6 +1055,7 @@ var IAMManagedPolicyProvider = class {
1050
1055
  GroupName: g.GroupName,
1051
1056
  PolicyArn: policyArn
1052
1057
  }));
1058
+ if (progress) progress.stripped = true;
1053
1059
  } catch (err) {
1054
1060
  if (!(err instanceof NoSuchEntityException)) throw err;
1055
1061
  }
@@ -1061,6 +1067,7 @@ var IAMManagedPolicyProvider = class {
1061
1067
  RoleName: r.RoleName,
1062
1068
  PolicyArn: policyArn
1063
1069
  }));
1070
+ if (progress) progress.stripped = true;
1064
1071
  } catch (err) {
1065
1072
  if (!(err instanceof NoSuchEntityException)) throw err;
1066
1073
  }
@@ -1072,6 +1079,7 @@ var IAMManagedPolicyProvider = class {
1072
1079
  UserName: u.UserName,
1073
1080
  PolicyArn: policyArn
1074
1081
  }));
1082
+ if (progress) progress.stripped = true;
1075
1083
  } catch (err) {
1076
1084
  if (!(err instanceof NoSuchEntityException)) throw err;
1077
1085
  }
@@ -1317,6 +1325,7 @@ var IAMInstanceProfileProvider = class {
1317
1325
  }
1318
1326
  async delete(logicalId, physicalId, resourceType, _properties, context) {
1319
1327
  this.logger.debug(`Deleting IAM instance profile ${logicalId}: ${physicalId}`);
1328
+ let stripped = false;
1320
1329
  try {
1321
1330
  let roles = [];
1322
1331
  try {
@@ -1335,6 +1344,7 @@ var IAMInstanceProfileProvider = class {
1335
1344
  InstanceProfileName: physicalId,
1336
1345
  RoleName: roleName
1337
1346
  }));
1347
+ stripped = true;
1338
1348
  this.logger.debug(`Removed role ${roleName} from instance profile ${physicalId}`);
1339
1349
  } catch (error) {
1340
1350
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -1349,7 +1359,8 @@ var IAMInstanceProfileProvider = class {
1349
1359
  return;
1350
1360
  }
1351
1361
  const cause = error instanceof Error ? error : void 0;
1352
- throw new ProvisioningError(`Failed to delete IAM instance profile ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
1362
+ const failure = new ProvisioningError(`Failed to delete IAM instance profile ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
1363
+ throw stripped ? markDeleteStarted(failure) : failure;
1353
1364
  }
1354
1365
  }
1355
1366
  logGoneOnDelete(logicalId, physicalId, context) {
@@ -1513,7 +1524,10 @@ var IAMAccessKeyProvider = class {
1513
1524
  if (leftBehindKeyId !== void 0 && reconciled.has(leftBehindKeyId)) leftBehindKeyId = void 0;
1514
1525
  const cause = error instanceof Error ? error : void 0;
1515
1526
  const thrown = this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create IAM access key ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
1516
- if (leftBehindKeyId !== void 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindKeyId);
1527
+ if (leftBehindKeyId !== void 0) {
1528
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindKeyId);
1529
+ markNonRetryable(thrown);
1530
+ }
1517
1531
  throw thrown;
1518
1532
  }
1519
1533
  }
@@ -1999,9 +2013,11 @@ var IAMUserGroupProvider = class {
1999
2013
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
2000
2014
  const { value: v } = log;
2001
2015
  log.debug(`Deleting IAM user ${logicalId}: ${v(physicalId)}`);
2016
+ const progress = { stripped: false };
2017
+ let hadBoundary = false;
2002
2018
  try {
2003
2019
  try {
2004
- await this.iamClient.send(new GetUserCommand({ UserName: physicalId }));
2020
+ hadBoundary = (await this.iamClient.send(new GetUserCommand({ UserName: physicalId }))).User?.PermissionsBoundary !== void 0;
2005
2021
  } catch (error) {
2006
2022
  if (error instanceof NoSuchEntityException) {
2007
2023
  const clientRegion = await this.iamClient.config.region();
@@ -2012,18 +2028,20 @@ var IAMUserGroupProvider = class {
2012
2028
  }
2013
2029
  throw error;
2014
2030
  }
2015
- await this.removeUserFromAllGroups(physicalId, log);
2016
- await this.detachAllUserPolicies(physicalId, log);
2017
- await this.deleteAllUserInlinePolicies(physicalId, log);
2031
+ await this.removeUserFromAllGroups(physicalId, log, progress);
2032
+ await this.detachAllUserPolicies(physicalId, log, progress);
2033
+ await this.deleteAllUserInlinePolicies(physicalId, log, progress);
2018
2034
  try {
2019
2035
  await this.iamClient.send(new DeleteLoginProfileCommand({ UserName: physicalId }));
2036
+ progress.stripped = true;
2020
2037
  log.debug(`Deleted login profile for user ${v(physicalId)}`);
2021
2038
  } catch (error) {
2022
2039
  if (!(error instanceof NoSuchEntityException)) throw error;
2023
2040
  }
2024
- await this.deleteAllAccessKeys(physicalId, log);
2041
+ await this.deleteAllAccessKeys(physicalId, log, progress);
2025
2042
  try {
2026
2043
  await this.iamClient.send(new DeleteUserPermissionsBoundaryCommand({ UserName: physicalId }));
2044
+ if (hadBoundary) progress.stripped = true;
2027
2045
  } catch (error) {
2028
2046
  if (!(error instanceof NoSuchEntityException)) throw error;
2029
2047
  }
@@ -2031,7 +2049,8 @@ var IAMUserGroupProvider = class {
2031
2049
  log.debug(`Successfully deleted IAM user ${logicalId}`);
2032
2050
  } catch (error) {
2033
2051
  const cause = error instanceof Error ? error : void 0;
2034
- throw new ProvisioningError(log.mask(`Failed to delete IAM user ${logicalId}: ${error instanceof Error ? error.message : String(error)}`), resourceType, logicalId, physicalId, cause);
2052
+ const failure = new ProvisioningError(log.mask(`Failed to delete IAM user ${logicalId}: ${error instanceof Error ? error.message : String(error)}`), resourceType, logicalId, physicalId, cause);
2053
+ throw progress.stripped ? markDeleteStarted(failure) : failure;
2035
2054
  }
2036
2055
  }
2037
2056
  async readLiveGroups(userName) {
@@ -2047,7 +2066,7 @@ var IAMUserGroupProvider = class {
2047
2066
  } while (marker);
2048
2067
  return groups;
2049
2068
  }
2050
- async removeUserFromAllGroups(userName, log) {
2069
+ async removeUserFromAllGroups(userName, log, progress) {
2051
2070
  const { value: v } = log;
2052
2071
  try {
2053
2072
  const groups = (await this.iamClient.send(new ListGroupsForUserCommand({ UserName: userName }))).Groups || [];
@@ -2056,6 +2075,7 @@ var IAMUserGroupProvider = class {
2056
2075
  UserName: userName,
2057
2076
  GroupName: group.GroupName
2058
2077
  }));
2078
+ if (progress) progress.stripped = true;
2059
2079
  log.debug(`Removed user ${v(userName)} from group ${v(group.GroupName)}`);
2060
2080
  } catch (error) {
2061
2081
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -2065,7 +2085,7 @@ var IAMUserGroupProvider = class {
2065
2085
  throw error;
2066
2086
  }
2067
2087
  }
2068
- async deleteAllAccessKeys(userName, log) {
2088
+ async deleteAllAccessKeys(userName, log, progress) {
2069
2089
  const { value: v } = log;
2070
2090
  try {
2071
2091
  const keys = (await this.iamClient.send(new ListAccessKeysCommand({ UserName: userName }))).AccessKeyMetadata || [];
@@ -2074,6 +2094,7 @@ var IAMUserGroupProvider = class {
2074
2094
  UserName: userName,
2075
2095
  AccessKeyId: key.AccessKeyId
2076
2096
  }));
2097
+ if (progress) progress.stripped = true;
2077
2098
  log.debug(`Deleted access key ${key.AccessKeyId} for user ${v(userName)}`);
2078
2099
  }
2079
2100
  } catch (error) {
@@ -2081,7 +2102,7 @@ var IAMUserGroupProvider = class {
2081
2102
  throw error;
2082
2103
  }
2083
2104
  }
2084
- async detachAllUserPolicies(userName, log) {
2105
+ async detachAllUserPolicies(userName, log, progress) {
2085
2106
  const { value: v } = log;
2086
2107
  try {
2087
2108
  const policies = (await this.iamClient.send(new ListAttachedUserPoliciesCommand({ UserName: userName }))).AttachedPolicies || [];
@@ -2090,6 +2111,7 @@ var IAMUserGroupProvider = class {
2090
2111
  UserName: userName,
2091
2112
  PolicyArn: policy.PolicyArn
2092
2113
  }));
2114
+ if (progress) progress.stripped = true;
2093
2115
  log.debug(`Detached managed policy ${v(policy.PolicyArn)} from user ${v(userName)}`);
2094
2116
  } catch (error) {
2095
2117
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -2099,7 +2121,7 @@ var IAMUserGroupProvider = class {
2099
2121
  throw error;
2100
2122
  }
2101
2123
  }
2102
- async deleteAllUserInlinePolicies(userName, log) {
2124
+ async deleteAllUserInlinePolicies(userName, log, progress) {
2103
2125
  const { value: v } = log;
2104
2126
  try {
2105
2127
  const policyNames = (await this.iamClient.send(new ListUserPoliciesCommand({ UserName: userName }))).PolicyNames || [];
@@ -2108,6 +2130,7 @@ var IAMUserGroupProvider = class {
2108
2130
  UserName: userName,
2109
2131
  PolicyName: policyName
2110
2132
  }));
2133
+ if (progress) progress.stripped = true;
2111
2134
  log.debug(`Deleted inline policy ${v(policyName)} from user ${v(userName)}`);
2112
2135
  } catch (error) {
2113
2136
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -2291,10 +2314,11 @@ var IAMUserGroupProvider = class {
2291
2314
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
2292
2315
  const { value: v } = log;
2293
2316
  log.debug(`Deleting IAM group ${logicalId}: ${v(physicalId)}`);
2317
+ const progress = { stripped: false };
2294
2318
  try {
2295
- await this.detachAllGroupPolicies(physicalId, log);
2296
- await this.deleteAllGroupInlinePolicies(physicalId, log);
2297
- await this.removeAllUsersFromGroup(physicalId, log);
2319
+ await this.detachAllGroupPolicies(physicalId, log, progress);
2320
+ await this.deleteAllGroupInlinePolicies(physicalId, log, progress);
2321
+ await this.removeAllUsersFromGroup(physicalId, log, progress);
2298
2322
  await this.iamClient.send(new DeleteGroupCommand({ GroupName: physicalId }));
2299
2323
  log.debug(`Successfully deleted IAM group ${logicalId}`);
2300
2324
  } catch (error) {
@@ -2306,10 +2330,11 @@ var IAMUserGroupProvider = class {
2306
2330
  return;
2307
2331
  }
2308
2332
  const cause = error instanceof Error ? error : void 0;
2309
- throw new ProvisioningError(log.mask(`Failed to delete IAM group ${logicalId}: ${error instanceof Error ? error.message : String(error)}`), resourceType, logicalId, physicalId, cause);
2333
+ const failure = new ProvisioningError(log.mask(`Failed to delete IAM group ${logicalId}: ${error instanceof Error ? error.message : String(error)}`), resourceType, logicalId, physicalId, cause);
2334
+ throw progress.stripped ? markDeleteStarted(failure) : failure;
2310
2335
  }
2311
2336
  }
2312
- async detachAllGroupPolicies(groupName, log) {
2337
+ async detachAllGroupPolicies(groupName, log, progress) {
2313
2338
  const { value: v } = log;
2314
2339
  try {
2315
2340
  const policies = (await this.iamClient.send(new ListAttachedGroupPoliciesCommand({ GroupName: groupName }))).AttachedPolicies || [];
@@ -2318,6 +2343,7 @@ var IAMUserGroupProvider = class {
2318
2343
  GroupName: groupName,
2319
2344
  PolicyArn: policy.PolicyArn
2320
2345
  }));
2346
+ if (progress) progress.stripped = true;
2321
2347
  log.debug(`Detached managed policy ${v(policy.PolicyArn)} from group ${v(groupName)}`);
2322
2348
  } catch (error) {
2323
2349
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -2327,7 +2353,7 @@ var IAMUserGroupProvider = class {
2327
2353
  throw error;
2328
2354
  }
2329
2355
  }
2330
- async removeAllUsersFromGroup(groupName, log) {
2356
+ async removeAllUsersFromGroup(groupName, log, progress) {
2331
2357
  const { value: v } = log;
2332
2358
  try {
2333
2359
  const users = (await this.iamClient.send(new GetGroupCommand({ GroupName: groupName }))).Users || [];
@@ -2336,6 +2362,7 @@ var IAMUserGroupProvider = class {
2336
2362
  GroupName: groupName,
2337
2363
  UserName: user.UserName
2338
2364
  }));
2365
+ if (progress) progress.stripped = true;
2339
2366
  log.debug(`Removed user ${v(user.UserName)} from group ${v(groupName)}`);
2340
2367
  } catch (error) {
2341
2368
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -2364,7 +2391,7 @@ var IAMUserGroupProvider = class {
2364
2391
  log.debug(`Detached managed policy ${v(policyArn)} from group ${v(groupName)}`);
2365
2392
  }
2366
2393
  }
2367
- async deleteAllGroupInlinePolicies(groupName, log) {
2394
+ async deleteAllGroupInlinePolicies(groupName, log, progress) {
2368
2395
  const { value: v } = log;
2369
2396
  try {
2370
2397
  const policyNames = (await this.iamClient.send(new ListGroupPoliciesCommand({ GroupName: groupName }))).PolicyNames || [];
@@ -2373,6 +2400,7 @@ var IAMUserGroupProvider = class {
2373
2400
  GroupName: groupName,
2374
2401
  PolicyName: policyName
2375
2402
  }));
2403
+ if (progress) progress.stripped = true;
2376
2404
  log.debug(`Deleted inline policy ${v(policyName)} from group ${v(groupName)}`);
2377
2405
  } catch (error) {
2378
2406
  if (!(error instanceof NoSuchEntityException)) throw error;
@@ -2546,6 +2574,7 @@ var IAMUserGroupProvider = class {
2546
2574
  };
2547
2575
  }
2548
2576
  let secretUserNotMember = false;
2577
+ let removedAny = false;
2549
2578
  try {
2550
2579
  for (const userName of users ?? []) {
2551
2580
  if (resolvedNames.has(userName) && memo?.detached.has(injectiveKey("Users", userName)) !== true) {
@@ -2567,6 +2596,7 @@ var IAMUserGroupProvider = class {
2567
2596
  GroupName: groupName,
2568
2597
  UserName: userName
2569
2598
  }));
2599
+ removedAny = true;
2570
2600
  if (resolvedNames.has(userName)) memo?.detached.add(injectiveKey("Users", userName));
2571
2601
  this.logger.debug(`Removed user ${mask(userName)} from group ${groupName}`);
2572
2602
  } catch (error) {
@@ -2584,7 +2614,8 @@ var IAMUserGroupProvider = class {
2584
2614
  this.logger.debug(`Successfully deleted IAM UserToGroupAddition ${logicalId}`);
2585
2615
  } catch (error) {
2586
2616
  const cause = error instanceof Error ? error : void 0;
2587
- throw maskError(new ProvisioningError(`Failed to delete IAM UserToGroupAddition ${logicalId}: ${mask(error instanceof Error ? error.message : String(error))}`, resourceType, logicalId, physicalId, cause));
2617
+ const failure = new ProvisioningError(`Failed to delete IAM UserToGroupAddition ${logicalId}: ${mask(error instanceof Error ? error.message : String(error))}`, resourceType, logicalId, physicalId, cause);
2618
+ throw maskError(removedAny ? markDeleteStarted(failure) : failure);
2588
2619
  }
2589
2620
  }
2590
2621
  async isSameResource(journaledPhysicalId, record, resourceType, context) {
@@ -6136,11 +6167,13 @@ var SQSQueuePolicyProvider = class {
6136
6167
  const named = physicalId.includes(",") ? splitQueueUrls(physicalId) : recordedQueues(physicalId, context?.recordedAttributes);
6137
6168
  const queueUrls = [...physicalId.includes(",") ? [] : await this.queuesCarryingDocument(listedQueues(properties ?? {}).filter((url) => !named.includes(url)), properties?.["PolicyDocument"], logicalId), ...named];
6138
6169
  if (queueUrls.length === 0) throw new ProvisioningError(`Failed to delete SQS queue policy ${logicalId}: its physical id names no queue URL`, resourceType, logicalId, physicalId);
6170
+ let clearedAny = false;
6139
6171
  for (const queueUrl of queueUrls) try {
6140
6172
  await this.clearQueuePolicy(queueUrl, resourceType, logicalId, context?.expectedRegion);
6173
+ clearedAny = true;
6141
6174
  } catch (error) {
6142
- if (error instanceof ProvisioningError) throw error;
6143
- throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
6175
+ const failure = error instanceof ProvisioningError ? error : this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
6176
+ throw clearedAny ? markDeleteStarted(failure) : failure;
6144
6177
  }
6145
6178
  this.logger.debug(`Successfully deleted SQS queue policy ${logicalId}`);
6146
6179
  }
@@ -7251,11 +7284,13 @@ var SNSTopicPolicyProvider = class {
7251
7284
  if (named.length === 0) throw markNonRetryable(new ProvisioningError(`Failed to delete SNS topic policy ${logicalId}: its physical id is empty, so cdkd changed no topic. Set each topic the policy is attached to back to its default policy by hand, then drop the record with ${stateOrphanRecordRemedy(context, logicalId)}.`, resourceType, logicalId, physicalId));
7252
7285
  const topicArns = named.every((arn) => isSnsTopicArn(arn)) ? named : [.../* @__PURE__ */ new Set([...named.filter((arn) => isSnsTopicArn(arn)), ...listedTopics(properties ?? {})])];
7253
7286
  if (topicArns.length === 0) throw markNonRetryable(new ProvisioningError(`Failed to delete SNS topic policy ${logicalId}: its physical id names no SNS topic ARN and its Topics lists none either, so cdkd changed no topic. Set each topic the policy is attached to back to its default policy by hand, then drop the record with ${stateOrphanRecordRemedy(context, logicalId)}.`, resourceType, logicalId, physicalId));
7287
+ let clearedAny = false;
7254
7288
  for (const topicArn of topicArns) try {
7255
7289
  await this.resetTopicPolicy(topicArn, resourceType, logicalId, context?.expectedRegion);
7290
+ clearedAny = true;
7256
7291
  } catch (error) {
7257
- if (error instanceof ProvisioningError) throw error;
7258
- throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
7292
+ const failure = error instanceof ProvisioningError ? error : this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
7293
+ throw clearedAny ? markDeleteStarted(failure) : failure;
7259
7294
  }
7260
7295
  this.logger.debug(`Successfully deleted SNS topic policy ${logicalId}`);
7261
7296
  }
@@ -8038,8 +8073,10 @@ var LambdaFunctionProvider = class {
8038
8073
  async delete(logicalId, physicalId, resourceType, properties, context) {
8039
8074
  this.logger.debug(`Deleting Lambda function ${logicalId}: ${physicalId}`);
8040
8075
  const hasVpcConfig = this.hasVpcConfig(properties?.["VpcConfig"]);
8076
+ let stripped = false;
8041
8077
  if (hasVpcConfig) {
8042
8078
  try {
8079
+ stripped = true;
8043
8080
  await this.lambdaClient.send(new UpdateFunctionConfigurationCommand({
8044
8081
  FunctionName: physicalId,
8045
8082
  VpcConfig: {
@@ -8055,6 +8092,7 @@ var LambdaFunctionProvider = class {
8055
8092
  this.logFunctionGone(logicalId, physicalId, context);
8056
8093
  return;
8057
8094
  }
8095
+ if (isRefusedByName(error)) stripped = false;
8058
8096
  this.logger.warn(`Pre-delete VPC detach failed for ${physicalId}: ${describeAwsFailure(error).detail} — continuing with delete`);
8059
8097
  }
8060
8098
  await this.waitForLambdaUpdateCompleted(physicalId);
@@ -8070,7 +8108,8 @@ var LambdaFunctionProvider = class {
8070
8108
  return;
8071
8109
  }
8072
8110
  const cause = error instanceof Error ? error : void 0;
8073
- throw new ProvisioningError(`Failed to delete Lambda function ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
8111
+ const failure = new ProvisioningError(`Failed to delete Lambda function ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
8112
+ throw stripped ? markDeleteStarted(failure) : failure;
8074
8113
  }
8075
8114
  if (hasVpcConfig) await this.cleanupLambdaEnis(physicalId);
8076
8115
  }
@@ -10270,7 +10309,17 @@ var LambdaWebFunctionRevisionProvider = class {
10270
10309
  };
10271
10310
  } catch (error) {
10272
10311
  const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10273
- if (createdArn) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdArn);
10312
+ let leftBehindArn = createdArn;
10313
+ if (leftBehindArn) try {
10314
+ await this.delete(logicalId, leftBehindArn, resourceType);
10315
+ leftBehindArn = void 0;
10316
+ } catch (cleanupError) {
10317
+ log.warn(safeMsg`Failed to delete partially-created Lambda web function revision ${logicalId}: ${describeAwsFailure(cleanupError).detail}. The failed deploy records it for \`cdkd rollback --revert-failed\`, or delete it by hand`);
10318
+ }
10319
+ if (leftBehindArn) {
10320
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindArn);
10321
+ markNonRetryable(thrown);
10322
+ }
10274
10323
  throw thrown;
10275
10324
  }
10276
10325
  }
@@ -15080,6 +15129,7 @@ var EventBridgeRuleProvider = class {
15080
15129
  this.logger.debug(`Deleting EventBridge rule ${logicalId}: ${physicalId}`);
15081
15130
  const ruleName = this.extractRuleNameFromArn(physicalId);
15082
15131
  const busParam = this.busParamFromArn(physicalId);
15132
+ let stripped = false;
15083
15133
  try {
15084
15134
  let targetIds = [];
15085
15135
  try {
@@ -15102,6 +15152,7 @@ var EventBridgeRuleProvider = class {
15102
15152
  Ids: targetIds,
15103
15153
  ...busParam
15104
15154
  }));
15155
+ stripped = true;
15105
15156
  this.logger.debug(`Removed ${targetIds.length} targets from rule ${ruleName}`);
15106
15157
  }
15107
15158
  await this.eventBridgeClient.send(new DeleteRuleCommand({
@@ -15117,7 +15168,8 @@ var EventBridgeRuleProvider = class {
15117
15168
  return;
15118
15169
  }
15119
15170
  const cause = error instanceof Error ? error : void 0;
15120
- throw new ProvisioningError(`Failed to delete EventBridge rule ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
15171
+ const failure = new ProvisioningError(`Failed to delete EventBridge rule ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
15172
+ throw stripped ? markDeleteStarted(failure) : failure;
15121
15173
  }
15122
15174
  }
15123
15175
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -15383,8 +15435,9 @@ var EventBridgeBusProvider = class {
15383
15435
  }
15384
15436
  async delete(logicalId, physicalId, resourceType, _properties, context) {
15385
15437
  this.logger.debug(`Deleting EventBus ${logicalId}: ${physicalId}`);
15438
+ let stripped = false;
15386
15439
  try {
15387
- await this.cleanupRulesOnBus(physicalId);
15440
+ stripped = await this.cleanupRulesOnBus(physicalId);
15388
15441
  await this.eventBridgeClient.send(new DeleteEventBusCommand({ Name: physicalId }));
15389
15442
  this.logger.debug(`Successfully deleted EventBus ${logicalId}`);
15390
15443
  } catch (error) {
@@ -15402,7 +15455,8 @@ var EventBridgeBusProvider = class {
15402
15455
  return;
15403
15456
  }
15404
15457
  const cause = error instanceof Error ? error : void 0;
15405
- throw new ProvisioningError(`Failed to delete EventBus ${logicalId}: ${msg}`, resourceType, logicalId, physicalId, cause);
15458
+ const failure = new ProvisioningError(`Failed to delete EventBus ${logicalId}: ${msg}`, resourceType, logicalId, physicalId, cause);
15459
+ throw stripped ? markDeleteStarted(failure) : failure;
15406
15460
  }
15407
15461
  }
15408
15462
  getAttribute(physicalId, _resourceType, attributeName) {
@@ -15411,9 +15465,11 @@ var EventBridgeBusProvider = class {
15411
15465
  return Promise.resolve(void 0);
15412
15466
  }
15413
15467
  async cleanupRulesOnBus(busName) {
15468
+ let found = false;
15414
15469
  try {
15415
15470
  const rules = (await this.eventBridgeClient.send(new ListRulesCommand({ EventBusName: busName }))).Rules ?? [];
15416
- if (rules.length === 0) return;
15471
+ if (rules.length === 0) return false;
15472
+ found = true;
15417
15473
  this.logger.debug(`Cleaning up ${rules.length} rule(s) on bus ${busName}`);
15418
15474
  for (const rule of rules) {
15419
15475
  if (!rule.Name) continue;
@@ -15436,9 +15492,10 @@ var EventBridgeBusProvider = class {
15436
15492
  } catch {}
15437
15493
  }
15438
15494
  } catch (error) {
15439
- if (error instanceof ResourceNotFoundException$2) return;
15495
+ if (error instanceof ResourceNotFoundException$2) return found;
15440
15496
  this.logger.debug(`Failed to list rules on bus ${busName}: ${describeAwsFailure(error).detail}`);
15441
15497
  }
15498
+ return found;
15442
15499
  }
15443
15500
  async readCurrentState(physicalId, _logicalId, _resourceType) {
15444
15501
  try {
@@ -16143,7 +16200,10 @@ var EC2Provider = class {
16143
16200
  } catch (error) {
16144
16201
  const cause = error instanceof Error ? error : void 0;
16145
16202
  const thrown = new ProvisioningError(`Failed to create VPC ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
16146
- if (leftBehindId !== void 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindId);
16203
+ if (leftBehindId !== void 0) {
16204
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindId);
16205
+ markNonRetryable(thrown);
16206
+ }
16147
16207
  throw thrown;
16148
16208
  }
16149
16209
  }
@@ -16489,6 +16549,7 @@ var EC2Provider = class {
16489
16549
  let publicIp;
16490
16550
  let created = false;
16491
16551
  let createdId;
16552
+ let allocatedId;
16492
16553
  try {
16493
16554
  const input = {
16494
16555
  Domain: requireConfigString(properties["Domain"], "vpc", "AWS::EC2::EIP Domain", replayWarn(this.logger, context)),
@@ -16508,6 +16569,7 @@ var EC2Provider = class {
16508
16569
  }
16509
16570
  created = true;
16510
16571
  allocationId = response.AllocationId;
16572
+ allocatedId = allocationId;
16511
16573
  publicIp = response.PublicIp;
16512
16574
  try {
16513
16575
  createdId = this.eipPhysicalId(logicalId, publicIp, allocationId);
@@ -16532,9 +16594,31 @@ var EC2Provider = class {
16532
16594
  this.logger.debug(`Successfully created EIP ${logicalId}: ${allocationId} (${publicIp})`);
16533
16595
  } catch (error) {
16534
16596
  if (created) markAuxiliaryFailure(error, logicalId);
16597
+ if (createdId !== void 0 && allocatedId !== void 0) try {
16598
+ const releaseId = allocatedId;
16599
+ const watch = startInterruptWatch(`EIP ${logicalId} release`);
16600
+ try {
16601
+ await withRetry(() => this.ec2Client.send(new ReleaseAddressCommand({ AllocationId: releaseId })), logicalId, {
16602
+ maxRetries: 4,
16603
+ initialDelayMs: 500,
16604
+ isRetryable: (_text, releaseError) => isThrottlingError(releaseError),
16605
+ isInterrupted: watch.isInterrupted,
16606
+ onInterrupted: watch.onInterrupted
16607
+ });
16608
+ } finally {
16609
+ watch.dispose();
16610
+ }
16611
+ createdId = void 0;
16612
+ this.logger.debug(safeMsg`Released partially-created EIP ${logicalId} (${allocatedId})`);
16613
+ } catch (cleanupError) {
16614
+ this.logger.warn(safeMsg`Failed to release partially-created EIP ${logicalId} (${allocatedId}): ${describeAwsFailure(cleanupError).detail}. Manual release may be required: ${pasteableAwsCommand(context?.maskSecrets)`aws ec2 release-address --allocation-id ${allocatedId}`.render()}`);
16615
+ }
16535
16616
  const cause = error instanceof Error ? error : void 0;
16536
16617
  const thrown = new ProvisioningError(`Failed to create EIP ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
16537
- if (createdId !== void 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdId);
16618
+ if (createdId !== void 0) {
16619
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, createdId);
16620
+ markNonRetryable(thrown);
16621
+ }
16538
16622
  throw thrown;
16539
16623
  }
16540
16624
  return {
@@ -22205,6 +22289,7 @@ var CloudFrontDistributionProvider = class {
22205
22289
  }
22206
22290
  async delete(logicalId, physicalId, resourceType, _properties, context) {
22207
22291
  this.logger.debug(`Deleting CloudFront Distribution ${logicalId}: ${physicalId}`);
22292
+ let stripped = false;
22208
22293
  try {
22209
22294
  let etag;
22210
22295
  let config;
@@ -22224,11 +22309,13 @@ var CloudFrontDistributionProvider = class {
22224
22309
  if (config.Enabled) {
22225
22310
  this.logger.debug(`Disabling CloudFront Distribution ${physicalId} before deletion`);
22226
22311
  config.Enabled = false;
22227
- etag = (await this.cloudFrontClient.send(new UpdateDistributionCommand({
22312
+ const updateResponse = await this.cloudFrontClient.send(new UpdateDistributionCommand({
22228
22313
  Id: physicalId,
22229
22314
  IfMatch: etag,
22230
22315
  DistributionConfig: config
22231
- }))).ETag;
22316
+ }));
22317
+ stripped = true;
22318
+ etag = updateResponse.ETag;
22232
22319
  if (!await this.waitForDistributionStable(physicalId, false)) this.logger.warn(`Distribution ${shownId(physicalId)} disable did not settle (Deployed + disabled) within the wait budget; attempting delete anyway. If it fails with DistributionNotDisabled, retry the destroy or raise the budget with --resource-timeout AWS::CloudFront::Distribution=${commandHole("duration")}.`);
22233
22320
  etag = (await this.cloudFrontClient.send(new GetDistributionConfigCommand({ Id: physicalId }))).ETag;
22234
22321
  } else {
@@ -22248,7 +22335,8 @@ var CloudFrontDistributionProvider = class {
22248
22335
  return;
22249
22336
  }
22250
22337
  const cause = error instanceof Error ? error : void 0;
22251
- throw new ProvisioningError(`Failed to delete CloudFront Distribution ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
22338
+ const failure = new ProvisioningError(`Failed to delete CloudFront Distribution ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
22339
+ throw stripped ? markDeleteStarted(failure) : failure;
22252
22340
  }
22253
22341
  }
22254
22342
  async readCurrentState(physicalId, _logicalId, resourceType, _properties) {
@@ -24183,6 +24271,7 @@ var ECSProvider = class {
24183
24271
  if (skip) return skip;
24184
24272
  }
24185
24273
  } else cluster = recordedCluster;
24274
+ let stripped = false;
24186
24275
  try {
24187
24276
  try {
24188
24277
  await client.send(new UpdateServiceCommand({
@@ -24190,6 +24279,8 @@ var ECSProvider = class {
24190
24279
  service: physicalId,
24191
24280
  desiredCount: 0
24192
24281
  }));
24282
+ const recordedCount = properties?.["DesiredCount"];
24283
+ stripped = !(recordedCount === 0 || recordedCount === "0");
24193
24284
  this.logger.debug(`Scaled down ECS service ${physicalId} to 0`);
24194
24285
  } catch (error) {
24195
24286
  if (this.isServiceNotFoundException(error)) {
@@ -24214,7 +24305,8 @@ var ECSProvider = class {
24214
24305
  return;
24215
24306
  }
24216
24307
  const cause = error instanceof Error ? error : void 0;
24217
- throw new ProvisioningError(`Failed to delete ECS service ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
24308
+ const failure = new ProvisioningError(`Failed to delete ECS service ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
24309
+ throw stripped ? markDeleteStarted(failure) : failure;
24218
24310
  }
24219
24311
  }
24220
24312
  async getServiceAttribute(physicalId, attributeName) {
@@ -28487,9 +28579,10 @@ var Route53Provider = class {
28487
28579
  }
28488
28580
  async deleteHostedZone(logicalId, physicalId, resourceType, context) {
28489
28581
  this.logger.debug(`Deleting Route 53 hosted zone ${logicalId}: ${physicalId}`);
28582
+ const progress = { stripped: false };
28490
28583
  try {
28491
- await this.deleteQueryLoggingConfigForZone(physicalId, logicalId);
28492
- await this.ensureAcceleratedRecoveryDisabledForDelete(physicalId, logicalId);
28584
+ await this.deleteQueryLoggingConfigForZone(physicalId, logicalId, progress);
28585
+ await this.ensureAcceleratedRecoveryDisabledForDelete(physicalId, logicalId, progress);
28493
28586
  await this.getClient().send(new DeleteHostedZoneCommand({ Id: physicalId }));
28494
28587
  this.logger.debug(`Successfully deleted hosted zone ${logicalId}`);
28495
28588
  } catch (error) {
@@ -28499,12 +28592,12 @@ var Route53Provider = class {
28499
28592
  this.logger.debug(`Hosted zone ${physicalId} does not exist, skipping deletion`);
28500
28593
  return;
28501
28594
  }
28502
- if (error instanceof ProvisioningError) throw error;
28503
28595
  const cause = error instanceof Error ? error : void 0;
28504
- throw new ProvisioningError(`Failed to delete hosted zone ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
28596
+ const failure = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to delete hosted zone ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
28597
+ throw progress.stripped ? markDeleteStarted(failure) : failure;
28505
28598
  }
28506
28599
  }
28507
- async ensureAcceleratedRecoveryDisabledForDelete(physicalId, logicalId) {
28600
+ async ensureAcceleratedRecoveryDisabledForDelete(physicalId, logicalId, progress) {
28508
28601
  const client = this.getClient();
28509
28602
  const pollIntervalMs = Number.parseInt(process.env["CDKD_R53_ACCEL_RECOVERY_POLL_INTERVAL_MS"] ?? "15000", 10);
28510
28603
  const timeoutMs = Number.parseInt(process.env["CDKD_R53_ACCEL_RECOVERY_POLL_TIMEOUT_MS"] ?? "600000", 10);
@@ -28547,6 +28640,7 @@ var Route53Provider = class {
28547
28640
  HostedZoneId: physicalId,
28548
28641
  EnableAcceleratedRecovery: false
28549
28642
  }));
28643
+ progress.stripped = true;
28550
28644
  } else if (current === "DISABLING" || current === "DISABLING_HOSTED_ZONE_LOCKED") this.logger.debug(`Hosted zone ${physicalId} AcceleratedRecovery is already ${current} (a disabling phase); waiting for settle`);
28551
28645
  const settled = await waitFor(/* @__PURE__ */ new Set(["DISABLED"]), "DISABLED");
28552
28646
  this.logger.debug(`Hosted zone ${physicalId} AcceleratedRecoveryStatus settled to ${settled ?? "undefined (zone gone)"}`);
@@ -28899,11 +28993,18 @@ var Route53Provider = class {
28899
28993
  throw error;
28900
28994
  }
28901
28995
  }
28902
- async deleteQueryLoggingConfigForZone(zoneId, logicalId) {
28996
+ async deleteQueryLoggingConfigForZone(zoneId, logicalId, progress) {
28903
28997
  try {
28904
28998
  const configs = (await this.getClient().send(new ListQueryLoggingConfigsCommand({ HostedZoneId: zoneId }))).QueryLoggingConfigs ?? [];
28905
28999
  for (const config of configs) if (config.Id) {
28906
- await this.getClient().send(new DeleteQueryLoggingConfigCommand({ Id: config.Id }));
29000
+ const before = progress?.stripped;
29001
+ if (progress) progress.stripped = true;
29002
+ try {
29003
+ await this.getClient().send(new DeleteQueryLoggingConfigCommand({ Id: config.Id }));
29004
+ } catch (deleteError) {
29005
+ if (progress && before !== void 0 && isRefusedByName(deleteError)) progress.stripped = before;
29006
+ throw deleteError;
29007
+ }
28907
29008
  this.logger.debug(`Deleted query logging config ${config.Id} for hosted zone ${logicalId}`);
28908
29009
  }
28909
29010
  } catch (error) {
@@ -30085,7 +30186,10 @@ var CognitoUserPoolProvider = class {
30085
30186
  }
30086
30187
  const cause = error instanceof Error ? error : void 0;
30087
30188
  const thrown = new ProvisioningError(`Failed to create Cognito User Pool ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, poolName, cause);
30088
- if (poolLeftBehind && createdUserPoolId) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdUserPoolId);
30189
+ if (poolLeftBehind && createdUserPoolId) {
30190
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, createdUserPoolId);
30191
+ markNonRetryable(thrown);
30192
+ }
30089
30193
  throw thrown;
30090
30194
  }
30091
30195
  }
@@ -32940,7 +33044,10 @@ var AppSyncProvider = class {
32940
33044
  }
32941
33045
  const cause = error instanceof Error ? error : void 0;
32942
33046
  const thrown = new ProvisioningError(`Failed to create GraphQL API ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
32943
- if (apiLeftBehind && createdApiId) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdApiId);
33047
+ if (apiLeftBehind && createdApiId) {
33048
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, createdApiId);
33049
+ markNonRetryable(thrown);
33050
+ }
32944
33051
  throw thrown;
32945
33052
  }
32946
33053
  }
@@ -35693,10 +35800,17 @@ var GlueTriggerProvider = class {
35693
35800
  async delete(logicalId, physicalId, resourceType, _properties, context) {
35694
35801
  this.logger.debug(`Deleting Glue Trigger ${logicalId}: ${physicalId}`);
35695
35802
  assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
35803
+ let stripped = false;
35696
35804
  try {
35697
35805
  try {
35698
35806
  if ((await this.getClient().send(new GetTriggerCommand({ Name: physicalId }))).Trigger?.State === "ACTIVATED") {
35699
- await this.getClient().send(new StopTriggerCommand({ Name: physicalId }));
35807
+ stripped = true;
35808
+ try {
35809
+ await this.getClient().send(new StopTriggerCommand({ Name: physicalId }));
35810
+ } catch (stopError) {
35811
+ if (isRefusedByName(stopError)) stripped = false;
35812
+ throw stopError;
35813
+ }
35700
35814
  await this.waitForTriggerDeactivated(physicalId);
35701
35815
  }
35702
35816
  } catch (err) {
@@ -35711,7 +35825,8 @@ var GlueTriggerProvider = class {
35711
35825
  return;
35712
35826
  }
35713
35827
  const cause = error instanceof Error ? error : void 0;
35714
- throw new ProvisioningError(`Failed to delete Glue Trigger ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
35828
+ const failure = new ProvisioningError(`Failed to delete Glue Trigger ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
35829
+ throw stripped ? markDeleteStarted(failure) : failure;
35715
35830
  }
35716
35831
  }
35717
35832
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -35766,6 +35881,7 @@ var GlueTriggerProvider = class {
35766
35881
  const createKeyLatch = new AmbiguousCreateLatch("CreateKey");
35767
35882
  const keysCreatedByThisProcess = new RecentIdSet();
35768
35883
  const pendingKeys = /* @__PURE__ */ new Map();
35884
+ const supersededAttempts = /* @__PURE__ */ new Map();
35769
35885
  const RESUMABLE_KEY_STATES = /* @__PURE__ */ new Set([
35770
35886
  "Enabled",
35771
35887
  "Disabled",
@@ -35860,11 +35976,12 @@ var KMSProvider = class {
35860
35976
  enabled: properties["Enabled"] !== false
35861
35977
  })).digest("hex");
35862
35978
  let createdKeyId;
35979
+ let supersededPending = false;
35863
35980
  try {
35864
35981
  const resumed = await this.resumeKeyFromFailedAttempt(logicalId, attemptKey, inputDigest);
35865
35982
  let keyId;
35866
35983
  let keyArn;
35867
- if (resumed) ({keyId, keyArn} = resumed);
35984
+ if (resumed && resumed !== "superseded") ({keyId, keyArn} = resumed);
35868
35985
  else {
35869
35986
  const orphanWindow = createKeyLatch.take(logicalId);
35870
35987
  if (orphanWindow !== void 0) await this.reportPossibleOrphanKeys(logicalId, input, orphanWindow);
@@ -35885,6 +36002,9 @@ var KMSProvider = class {
35885
36002
  heldAtMs: Date.now()
35886
36003
  });
35887
36004
  createdKeyId = keyId;
36005
+ const declinedAtMs = supersededAttempts.get(attemptKey);
36006
+ supersededAttempts.delete(attemptKey);
36007
+ supersededPending = declinedAtMs !== void 0 && Date.now() - declinedAtMs <= 18e5;
35888
36008
  const replayWindow = replayedSendWindow(result, attemptStartMs);
35889
36009
  if (replayWindow !== void 0) await this.reportPossibleOrphanKeys(logicalId, input, replayWindow);
35890
36010
  }
@@ -35920,7 +36040,10 @@ var KMSProvider = class {
35920
36040
  }
35921
36041
  const cause = error instanceof Error ? error : void 0;
35922
36042
  const thrown = new ProvisioningError(`Failed to create KMS Key ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
35923
- if (createdKeyId !== void 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdKeyId);
36043
+ if (createdKeyId !== void 0) {
36044
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, createdKeyId);
36045
+ if (supersededPending) markSupersedesEarlierCreate(thrown);
36046
+ }
35924
36047
  throw thrown;
35925
36048
  }
35926
36049
  }
@@ -35943,6 +36066,8 @@ var KMSProvider = class {
35943
36066
  const deletion = aws`aws kms schedule-key-deletion --key-id ${pending.keyId}${region} --pending-window-in-days 7`.render();
35944
36067
  const notReused = (reason) => {
35945
36068
  this.logger.warn(safeMsg`KMS key ${pending.keyId} was created for ${logicalId} by an earlier attempt of this deploy, but ${reason}, so this attempt creates a new key and that one is not recorded in cdkd state. If it is unused, schedule its deletion with: ${deletion}`);
36069
+ setBounded(supersededAttempts, attemptKey, Date.now());
36070
+ return "superseded";
35946
36071
  };
35947
36072
  if (pending.inputDigest !== inputDigest) return notReused("this attempt was asked for a key with different inputs");
35948
36073
  let metadata;
@@ -40598,7 +40723,10 @@ var EMRClusterProvider = class {
40598
40723
  this.logger.warn(`Failed to roll back partially-created EMR Cluster ${clusterId}: ${describeAwsFailure(cleanupError).detail} — terminate it manually to stop billing`);
40599
40724
  }
40600
40725
  if (error instanceof ProvisioningError) {
40601
- if (survivorId !== void 0) markCreatedBeforeFailure(error, logicalId, resourceType, survivorId);
40726
+ if (survivorId !== void 0) {
40727
+ markCreatedBeforeFailure(error, logicalId, resourceType, survivorId);
40728
+ markNonRetryable(error);
40729
+ }
40602
40730
  throw error;
40603
40731
  }
40604
40732
  const cause = error instanceof Error ? error : void 0;
@@ -40606,6 +40734,7 @@ var EMRClusterProvider = class {
40606
40734
  if (survivorId !== void 0) {
40607
40735
  const thrown = new ProvisioningError(message, resourceType, logicalId, void 0, cause);
40608
40736
  markCreatedBeforeFailure(thrown, logicalId, resourceType, survivorId);
40737
+ markNonRetryable(thrown);
40609
40738
  throw thrown;
40610
40739
  }
40611
40740
  throw new ProvisioningError(message, resourceType, logicalId, void 0, cause);
@@ -41274,7 +41403,27 @@ var EMRInstanceGroupConfigProvider = class {
41274
41403
  };
41275
41404
  } catch (error) {
41276
41405
  const thrown = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to add EMR instance group ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0);
41277
- if (createdGroupId) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdGroupId);
41406
+ let leftBehindGroupId = createdGroupId;
41407
+ if (leftBehindGroupId && properties["InstanceRole"] === "TASK") {
41408
+ const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
41409
+ try {
41410
+ await this.getClient().send(new ModifyInstanceGroupsCommand({
41411
+ ClusterId: jobFlowId,
41412
+ InstanceGroups: [{
41413
+ InstanceGroupId: leftBehindGroupId,
41414
+ InstanceCount: 0
41415
+ }]
41416
+ }));
41417
+ log.warn(safeMsg`Scaled partially-created EMR TASK instance group ${logicalId} (${leftBehindGroupId}) to 0; EMR has no delete API, so the empty group stays on cluster ${log.value(jobFlowId)} until it terminates`);
41418
+ leftBehindGroupId = void 0;
41419
+ } catch (cleanupError) {
41420
+ log.warn(safeMsg`Failed to scale partially-created EMR TASK instance group ${logicalId} (${leftBehindGroupId}) to 0: ${describeAwsFailure(cleanupError).detail} — its instances are released when the parent cluster terminates`);
41421
+ }
41422
+ }
41423
+ if (leftBehindGroupId) {
41424
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindGroupId);
41425
+ markNonRetryable(thrown);
41426
+ }
41278
41427
  throw thrown;
41279
41428
  }
41280
41429
  }
@@ -41580,7 +41729,10 @@ var EMRInstanceFleetConfigProvider = class {
41580
41729
  };
41581
41730
  } catch (error) {
41582
41731
  const thrown = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to add EMR instance fleet ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0);
41583
- if (createdFleetId) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdFleetId);
41732
+ if (createdFleetId) {
41733
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, createdFleetId);
41734
+ markNonRetryable(thrown);
41735
+ }
41584
41736
  throw thrown;
41585
41737
  }
41586
41738
  }
@@ -42857,12 +43009,18 @@ var CloudTrailProvider = class {
42857
43009
  throw new ProvisioningError(`Failed to update CloudTrail Trail ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
42858
43010
  }
42859
43011
  }
42860
- async delete(logicalId, physicalId, resourceType, _properties, context) {
43012
+ async delete(logicalId, physicalId, resourceType, properties, context) {
42861
43013
  this.logger.debug(`Deleting CloudTrail Trail ${logicalId}: ${physicalId}`);
43014
+ const recordedIsLogging = properties?.["IsLogging"];
43015
+ const recordedStopped = recordedIsLogging === false || recordedIsLogging === "false";
43016
+ let stripped = false;
42862
43017
  try {
42863
43018
  try {
43019
+ stripped = !recordedStopped;
42864
43020
  await this.getClient().send(new StopLoggingCommand({ Name: physicalId }));
42865
- } catch {}
43021
+ } catch (stopError) {
43022
+ if (isRefusedByName(stopError)) stripped = false;
43023
+ }
42866
43024
  await this.getClient().send(new DeleteTrailCommand({ Name: physicalId }));
42867
43025
  this.logger.debug(`Successfully deleted CloudTrail Trail ${logicalId}`);
42868
43026
  } catch (error) {
@@ -42873,7 +43031,8 @@ var CloudTrailProvider = class {
42873
43031
  return;
42874
43032
  }
42875
43033
  const cause = error instanceof Error ? error : void 0;
42876
- throw new ProvisioningError(`Failed to delete CloudTrail Trail ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
43034
+ const failure = new ProvisioningError(`Failed to delete CloudTrail Trail ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
43035
+ throw stripped ? markDeleteStarted(failure) : failure;
42877
43036
  }
42878
43037
  }
42879
43038
  getAttribute(_physicalId, _resourceType, attributeName) {
@@ -46433,4 +46592,4 @@ var ACMCertificateProvider = class {
46433
46592
 
46434
46593
  //#endregion
46435
46594
  export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppSyncProvider, BudgetsBudgetProvider, CloudFrontDistributionProvider, CloudFrontOACProvider, CloudFrontOAIProvider, CloudTrailProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, CodeBuildProvider, CodeCommitRepositoryProvider, CognitoUserPoolProvider, DLMLifecyclePolicyProvider, DocDBProvider, DocDBSubnetGroupProvider, DynamoDBGlobalTableProvider, DynamoDBTableProvider, EC2Provider, ECRProvider, ECSProvider, EFSProvider, ELBv2Provider, EMRClusterProvider, EMRInstanceFleetConfigProvider, EMRInstanceGroupConfigProvider, ElastiCacheProvider, EventBridgeBusProvider, EventBridgeRuleProvider, FSxFileSystemProvider, FirehoseProvider, GlueConnectionProvider, GlueCrawlerProvider, GlueJobProvider, GlueProvider, GlueSecurityConfigurationProvider, GlueTriggerProvider, GlueWorkflowProvider, IAMAccessKeyProvider, IAMInstanceProfileProvider, IAMManagedPolicyProvider, IAMPolicyProvider, IAMRoleProvider, IAMUserGroupProvider, KMSProvider, KinesisStreamConsumerProvider, KinesisStreamProvider, LambdaEventInvokeConfigProvider, LambdaEventSourceMappingProvider, LambdaFunctionProvider, LambdaLayerVersionProvider, LambdaMicrovmImageProvider, LambdaNetworkConnectorProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaWebFunctionEndpointProvider, LambdaWebFunctionRevisionProvider, LogsLogGroupProvider, NeptuneProvider, NestedStackProvider, PipesPipeProvider, RDSDBProxyEndpointProvider, RDSDBProxyProvider, RDSDBProxyTargetGroupProvider, RDSProvider, Route53Provider, S3BucketPolicyProvider, S3BucketProvider, S3DirectoryBucketProvider, S3TablesProvider, S3VectorsProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, SNSTopicProvider, SQSQueuePolicyProvider, SQSQueueProvider, SSMParameterProvider, SchedulerScheduleProvider, SecretsManagerSecretProvider, ServiceDiscoveryProvider, StepFunctionsProvider, WAFv2WebACLProvider, WaitConditionHandleProvider };
46436
- //# sourceMappingURL=provider-classes-CVC9_-km.js.map
46595
+ //# sourceMappingURL=provider-classes-CDzT2xg0.js.map