@cdkd/cli 0.360.0 → 0.361.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{ambient-client-defaults-Zw14vfrI.js → ambient-client-defaults-Bq5rj529.js} +3 -3
  2. package/dist/{ambient-client-defaults-Zw14vfrI.js.map → ambient-client-defaults-Bq5rj529.js.map} +1 -1
  3. package/dist/{asg-provider-D1t6qsKn.js → asg-provider-7c1iqoaI.js} +6 -6
  4. package/dist/{asg-provider-D1t6qsKn.js.map → asg-provider-7c1iqoaI.js.map} +1 -1
  5. package/dist/cli.js +3 -3
  6. package/dist/{custom-resource-runtime-CIDXtQ5Q.js → custom-resource-runtime-xE15oufB.js} +6 -6
  7. package/dist/{custom-resource-runtime-CIDXtQ5Q.js.map → custom-resource-runtime-xE15oufB.js.map} +1 -1
  8. package/dist/{db-associated-roles-CYMYBGeh.js → db-associated-roles-RCr0v8tz.js} +2 -2
  9. package/dist/{db-associated-roles-CYMYBGeh.js.map → db-associated-roles-RCr0v8tz.js.map} +1 -1
  10. package/dist/{delete-started-dMEHah06.js → delete-started-BY94yU_N.js} +148 -6
  11. package/dist/delete-started-BY94yU_N.js.map +1 -0
  12. package/dist/{deploy-engine-T1iXkB24.js → deploy-engine-CkY2eTL9.js} +761 -186
  13. package/dist/deploy-engine-CkY2eTL9.js.map +1 -0
  14. package/dist/{ec2-termination-protection-Ct7iZKky.js → ec2-termination-protection-C50H1PZO.js} +6 -6
  15. package/dist/{ec2-termination-protection-Ct7iZKky.js.map → ec2-termination-protection-C50H1PZO.js.map} +1 -1
  16. package/dist/{ecr-uri-DMMMk4h5.js → ecr-uri-CHY7E5Ju.js} +2 -2
  17. package/dist/{ecr-uri-DMMMk4h5.js.map → ecr-uri-CHY7E5Ju.js.map} +1 -1
  18. package/dist/{expected-bucket-owner-D0my0zRR.js → expected-bucket-owner-BeB-z8ED.js} +2 -2
  19. package/dist/{expected-bucket-owner-D0my0zRR.js.map → expected-bucket-owner-BeB-z8ED.js.map} +1 -1
  20. package/dist/{iam-role-provider-R89AqWLY.js → iam-role-provider-DzDXdyx5.js} +52 -13
  21. package/dist/iam-role-provider-DzDXdyx5.js.map +1 -0
  22. package/dist/{image-plan-nkTmvIbr.js → image-plan-CKRVQgWU.js} +8 -8
  23. package/dist/{image-plan-nkTmvIbr.js.map → image-plan-CKRVQgWU.js.map} +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +5 -5
  27. package/dist/{logger-Fqr4kSBL.js → logger-CZTXRggO.js} +2 -2
  28. package/dist/{logger-Fqr4kSBL.js.map → logger-CZTXRggO.js.map} +1 -1
  29. package/dist/{neptune-provider-BMDYjSf5.js → neptune-provider-BPnu4P-b.js} +7 -7
  30. package/dist/{neptune-provider-BMDYjSf5.js.map → neptune-provider-BPnu4P-b.js.map} +1 -1
  31. package/dist/{program-Di80isf8.js → program-uYb3oSBF.js} +360 -41
  32. package/dist/program-uYb3oSBF.js.map +1 -0
  33. package/dist/{provider-classes-Bkb_H0Sp.js → provider-classes-CpwN6g8B.js} +671 -148
  34. package/dist/provider-classes-CpwN6g8B.js.map +1 -0
  35. package/dist/{rds-provider-BcNL1C0E.js → rds-provider-CjaaTJEe.js} +74 -14
  36. package/dist/rds-provider-CjaaTJEe.js.map +1 -0
  37. package/dist/{read-replica-mqoiWJdM.js → read-replica-8-Idke_l.js} +3 -3
  38. package/dist/{read-replica-mqoiWJdM.js.map → read-replica-8-Idke_l.js.map} +1 -1
  39. package/dist/{replacement-rules-Y1UE2Vqb.js → replacement-rules-Bs3dhR_O.js} +3 -3
  40. package/dist/{replacement-rules-Y1UE2Vqb.js.map → replacement-rules-Bs3dhR_O.js.map} +1 -1
  41. package/dist/{resource-deadline-BSt_tRep.js → resource-deadline-CSd19ZNv.js} +21 -21
  42. package/dist/{resource-deadline-BSt_tRep.js.map → resource-deadline-CSd19ZNv.js.map} +1 -1
  43. package/dist/{restore-source-guard-CDrsW4tB.js → restore-source-guard-D7zwBxYx.js} +4 -4
  44. package/dist/{restore-source-guard-CDrsW4tB.js.map → restore-source-guard-D7zwBxYx.js.map} +1 -1
  45. package/dist/{run-cli-BKSKYUvl.js → run-cli-BD5KBGA1.js} +2 -2
  46. package/dist/{run-cli-BKSKYUvl.js.map → run-cli-BD5KBGA1.js.map} +1 -1
  47. package/dist/{settle-own-write-members-BqIDAx00.js → settle-own-write-members-B4h_lONt.js} +41 -23
  48. package/dist/{settle-own-write-members-BqIDAx00.js.map → settle-own-write-members-B4h_lONt.js.map} +1 -1
  49. package/dist/{version-yPbqfysZ.js → version-BAoHSHRL.js} +2 -2
  50. package/dist/{version-yPbqfysZ.js.map → version-BAoHSHRL.js.map} +1 -1
  51. package/package.json +1 -1
  52. package/dist/delete-started-dMEHah06.js.map +0 -1
  53. package/dist/deploy-engine-T1iXkB24.js.map +0 -1
  54. package/dist/iam-role-provider-R89AqWLY.js.map +0 -1
  55. package/dist/program-Di80isf8.js.map +0 -1
  56. package/dist/provider-classes-Bkb_H0Sp.js.map +0 -1
  57. package/dist/rds-provider-BcNL1C0E.js.map +0 -1
@@ -1,26 +1,26 @@
1
- import { a as IamCreateClientCache, i as isEntityAlreadyExists, n as collectInlinePolicyNamesManagedBySiblings, r as iamEntityLeftByThisCreate, t as IAMRoleProvider } from "./iam-role-provider-R89AqWLY.js";
2
- import { A as configStringRefusal, B as generateResourceName, D as coerceCfnInteger, E as coerceCfnBoolean, F as requireConfigString, J as getCurrentStackName, M as replayWarn, N as requireConfigArray, O as configBooleanRefusal, P as requireConfigObject, U as recordedGeneratedNameKept, V as generateResourceNameWithFallback, Y as isBeforeStateRead, c as VERBOSE_POINTER, d as describeAwsStatusReason, f as isAwsAuthoredFailure, g as verbosePointerTail, h as verbosePointerSentence, j as readConfigString, k as configIntegerRefusal, n as getLogger, p as safeStringify, q as getCurrentStackInstanceId, u as describeAwsFailure, w as generatedNameFor } from "./logger-Fqr4kSBL.js";
1
+ import { a as restoreOwnWriteRemovals, c as isEntityAlreadyExists, i as recordOwnWriteRemoval, l as IamCreateClientCache, n as collectInlinePolicyNamesManagedBySiblings, o as takeOwnWriteRemovals, r as clearOwnWriteRemovals, s as iamEntityLeftByThisCreate, t as IAMRoleProvider } from "./iam-role-provider-DzDXdyx5.js";
2
+ import { A as configStringRefusal, B as generateResourceName, D as coerceCfnInteger, E as coerceCfnBoolean, F as requireConfigString, J as getCurrentStackName, M as replayWarn, N as requireConfigArray, O as configBooleanRefusal, P as requireConfigObject, U as recordedGeneratedNameKept, V as generateResourceNameWithFallback, Y as isBeforeStateRead, c as VERBOSE_POINTER, d as describeAwsStatusReason, f as isAwsAuthoredFailure, g as verbosePointerTail, h as verbosePointerSentence, j as readConfigString, k as configIntegerRefusal, n as getLogger, p as safeStringify, q as getCurrentStackInstanceId, u as describeAwsFailure, w as generatedNameFor } from "./logger-CZTXRggO.js";
3
3
  import { d as withApiGatewayPacing, l as s3ClientDefaults, r as getAwsClients } from "./aws-clients-DOkPjjAW.js";
4
- import { D as markReplayMayCollide, E as markNameCollision, F as isAmbiguousOutcomeError, G as markRedactedCause, I as isExplicitDenyError, K as wrapMaskedAwsError, M as explicitDenyPolicyKind, O as relayedNameCollision, Q as AccountIdUnavailableError, R as isRetryableTransientError, U as isThrottlingError, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, at as ProvisioningError, et as CdkdError, i as credentialFingerprint, n as ambientCredentialConfig, r as clientDefaultsFor, t as ambientClientDefaults, x as hasReplayMayCollide, z as isTransientServerError } from "./ambient-client-defaults-Zw14vfrI.js";
5
- import { $ as isProceedDbStatus, $t as markAuxiliaryFailure, A as isPlainImportJson, At as canonicalizeRoute53QueryName, B as assertRegionMatch, Bt as createMaskedRetryLogger, C as isInsideWindow, Ct as SECRET_DERIVED_READ_LIVE, D as withoutServerErrorRetries, E as setBounded, Et as readPrincipalLists, F as refusalTypeShown, Ft as packCompositeId, G as logGroupProtectionSite, H as markNotGone, Ht as maskDeep, I as remedyLogicalId, K as observeThenDisableProtection, L as resolveExplicitPhysicalId, Lt as segmentAfterAnchor, M as isQuotableImportValue, Mt as compositeIdSeparatorRefusal, N as normalizeAwsTagsToCfn, Nt as compositeIdSkipResult, O as VALUE_NOT_SHOWN, Ot as recordedPrincipalsRepair, P as quotedRemedyLogicalId, Pt as logicalIdShown, R as DriftReadRefusedError, Rt as stateOrphanRecordRemedy, S as createAttemptKey, T as replayedSendWindow, Tt as onlySecretDerived, Ut as maskerOrIdentity, Vt as isSecretDerivedValue, W as deleteWithProtectionCompensation, Wt as withDerivedNameMasks, X as PROTECTION_FLIP_RETRY_WAIT_MS, Y as userPoolProtectionSite, Z as deleteAfterProtectionFlipWithFinalSnapshot, Zt as isAuxiliaryFailure, _ as AMBIGUOUS_LATCH_TTL_MS, _n as withPasteableAwsProfile, a as clearOnUpdateRemoval, b as RecentIdSet, bt as startInterruptWatch, c as removedTemplateKeys, dt as WITHHELD_AWS_COMMAND, en as markCreatedBeforeFailure, et as isTerminalDbWaitStatus, ft as isAwsCliLiteral, g as retractCreatedResource, ht as renderDisableCommand, it as protectionFlipKey, j as isPlainImportValue, jt as compositeIdFormatMessage, k as importRemedyCommand, l as withRemovalDefaults, m as reportCreatedResource, mt as protectedReplacementAdvice, n as enclosingDeadlineRemainingMs, nt as ProtectionFlipRegistry, ot as ElapsedBudget, pt as pasteableAwsCommand, q as rdsFamilyProtectionSite, qt as clearCreatedBeforeFailure, rt as isTerminalDeleteFailure, st as ElapsedBudgetRegistry, t as enclosingDeadlineExpired, tn as markSupersedesEarlierCreate, ut as UNNAMEABLE_ID_CLAUSE, v as AmbiguousCreateLatch, vn as injectiveKey, w as replayFollowedAmbiguousAttempt, wt as holdsSecretDerivedEntry, x as ambiguousAttemptLead, y as CREATION_DATE_SKEW_MARGIN_MS, yn as injectiveKeyPrefix, yt as isInterruptedWaitError, z as RESOURCE_NOT_FOUND, zt as createMaskedLogSinks } from "./resource-deadline-BSt_tRep.js";
6
- import { A as displayStackName, L as truncateCodePoints, N as plainIdentOr, O as displayIdent, P as safeMsg, S as SECRET_REF_MAX_CODE_POINTS, T as asIsMessage, _ as shellQuote, c as deployReplaceCommand, d as pasteableCommand, j as isPasteableIdent, k as displaySafe, l as hasClauseBreak, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, s as commandHole, u as isInertUnquoted, v as withheldTargetClause } from "./version-yPbqfysZ.js";
7
- import { gt as slowCcOperationTimeoutMs, n as isRefusedByName, r as markDeleteStarted } from "./delete-started-dMEHah06.js";
8
- import { $ as effectiveInventoryItem, A as tagListsMatch, B as LIFECYCLE_DEFAULT_STATUS, C as reconcileSgRules, D as singleSecurityGroupRuleId, E as sgRuleKey, F as clearLifecycleWritesOf, G as canonicalizeItemList, H as LIFECYCLE_RULE_PATH, I as lifecycleSettleTarget, J as lifecycleUsesFilterForm, K as effectiveLifecycleConfiguration, L as recordLifecycleWrite, M as declaredSgRulesRead, N as mergeDeclaredSgRules, O as stackIngressRuleHolder, P as LIFECYCLE_BASELINE_REREAD_DELAYS_MS, Q as effectiveIntelligentTieringItem, R as settleLifecycleRead, S as narrowIngressIpProtocol, T as securityGroupRuleMatchesCfnIngress, U as LIFECYCLE_TAG_FILTERS_PATH, V as LIFECYCLE_FILTER_PATH, W as canonicalizeBlock, X as EVENTBRIDGE_CONFIG_PATH, Y as parseCfnTimestamp, Z as effectiveAnalyticsItem, _ as flattenIpPermissions, a as resolveSecretDerivedPrincipals, at as declaresBucketObjectLock, b as isDefaultEgressRule, c as readSgIngressById, ct as isPlainObject$4, d as SG_RULE_PAGE_SIZE, dt as shownLifecycleRuleId, et as effectiveNotificationConfiguration, f as authorizeDefinitelyNotApplied, g as descriptionKey, h as comparableIngressIdentity, i as isResolvableSecretPrincipalList, it as configItemId, j as markCopiesAgreed, k as survivingRecordOfRuleId, l as siblingIdOwnedSgRules, lt as manualBucketDeletionClause, m as canonicalizeSgRuleProtocol, n as runDestroyForStack, nt as caughtErrorName, o as refuseRevertRevokingSiblingRules, ot as declaresNestedObjectLock, p as canonicalizeSgInlineRuleProtocols, q as lifecycleRuleScope, r as holdsUnprovenSecretPrincipalToken, rt as coerceCfnNumber, s as sgRuleDiffKey, st as describeValue$1, t as canonicalizeIpv4Cidr, tt as eventBridgeEnabledOf, u as SG_READBACK_RETRY_DELAY_MS, ut as mergeLegacySingular, v as ingressRuleIdentity, w as securityGroupReadbackDelays, x as isResendableSocketFailure, y as isConnectTimeout, z as takeLifecycleWrite } from "./program-Di80isf8.js";
9
- import { $ as recordTagWrite, $r as redactedDeleteAddressSkip, $s as LEGACY_HANDLE_ID_PREFIX, As as parseWebACLArn, At as DELETE_INDEX_WAIT_PROCEED_NOTE, B as declaredStreamTagsMember, Ba as SNS_DEFAULT_POLICY_ID, Bl as findSdkUnwiredProperties, Bs as getAccountInfo, Bt as isTruthyCfnBoolean, Co as waitForLambdaFunctionActive, Cr as calculateResourceDrift, Ct as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Do as RecordedIdentityMismatchError, Dr as verbatimEchoDriftKeys, Dt as deleteBudgetKey, El as refuseMalformedResourcesForDestroy, Eo as RecordedIdentityError, Et as compensateRemovedDeletionProtection, Fa as withoutSiblingAttachedArns, Fo as withIndeterminateGuard, Ft as relayedIndexBusyDelete, G as streamDeclaresTags, Ga as memberReadFailure, Go as APPSYNC_APIKEY_ARN_RESOURCE_PATH, Ha as declaredPolicyDocument, I as DynamoDBGlobalTableProvider, Ia as withoutSiblingOwned, Ii as getStackRecords, Ir as acquireIdempotencyToken, It as waitForIndexesSettled, Iu as rewriteTemplateAssetReferences, J as streamTagsMatchDeclared, Ja as settleDeclaredMember, K as streamMemberRefusals, Ka as policyDocumentMatchesDeclared, Ki as replacedDeleteFailureVerdict, L as STREAM_POLICY_KEY, La as KMS_DEFAULT_KEY_POLICY_ID, Lt as ECR_AUTO_DELETE_IMAGES_TAG, Ma as collectManagedPolicyArnsAttachedBySiblings, Ml as withheldAccountClause, Mr as earliestDefined, Mt as TABLE_INDEX_NOUN, Na as collectPrincipalsAttachingPolicy, Nt as deleteTableWithIndexBusyRetry, Oo as assertRecordedIdentity, Ot as resolveDynamoDbDeleteBudgetClock, Pa as isStoredExpression, Pi as awaitInFlightSibling, Po as deleteSkipReason, Pr as reserveStackCreateToken, Ps as outputReferenceProvenanceOf, Pt as maskedLogger, Q as isDynamoDBTableArnIn, Qr as redactedDeleteAddressFields, Qt as licensedNameHolder, R as STREAM_TAGS_KEY, Ro as markWaitAbandoned, Rt as S3_AUTO_DELETE_OBJECTS_TAG, St as DYNAMODB_DELETE_DEADLINE_MARGIN_MS, To as waitForGoneAfterDelete, Tt as beginDeleteWait, U as reverseMapStreamPolicy, Ua as efsPolicyMatchesDeclared, Ul as withoutSdkUnwiredProperties, V as planStreamMemberOps, Va as declaredMemberDocument, W as streamDeclaresPolicy, Wa as lambdaPermissionMatchesDeclared, Wo as isSettledInstanceState, X as clearTagWrites, Xa as attemptedPolicyDocument, Xr as REDACTED_DELETE_ADDRESS_SKIP_REASON, Y as TAGS_BASELINE_REREAD_DELAYS_MS, Ya as warnUnsettledMember, Za as policyContentKey, Zr as isRedactedRecordedValue, _n as getCurrentNestedStackContext, _s as s3BucketDomainName, _t as planIndexContributorInsightsOps, _u as renderNestedTemplateTreeDefect, ao as evaluateSignals, at as planTimeToLive, bs as s3BucketWebsiteUrl, bt as reverseMapTableContributorInsights, cc as WARM_THROUGHPUT_MEMBERS, cr as siblingOwnedSgRuleIdentities, ct as planVectorIndexUpdates, dc as toCfnInteger, dd as displayAssemblyPath, dr as SG_RULE_ID_PATTERN, dt as vectorIndexesSettled, ec as isLegacyHandleId, en as chunks, et as settleWrittenTags, fc as toFiniteNumber, fr as cfnIngressPortValue, ft as vectorIndexesShapeDetail, fu as stringifyValue, ga as secretNamedAttributeNamesOf, gl as refuseMalformedNestedChildOutputs, gs as s3BucketArn, gt as planContributorInsightsOp, gu as listNestedTemplateRows, ht as indexDeclaresContributorInsights, hu as isAbsoluteAssetPath, io as classifyHandleUrl, it as isTtlRateLimited, ja as collectGroupsAddedBySiblings, jl as accountArgs, jt as INDEX_SETTLE_POLL_INTERVAL_MS, kt as resolveDynamoDbDeleteBudgetMs, lc as coerceWarmThroughput$1, lt as readbackVectorIndexes, md as resolveAssemblyPath, mr as sgProtocolKey, mt as contributorInsightsRefusals, mu as findNestedTemplateTreeDefect, nn as lookupEachName, nt as takeTagWrite, ot as readTtlSpec, pd as renderAssemblyPathEscape, pn as revertNestedChildFromJournal, po as getCurrentResourceSecrets, pr as recordedSgRuleId, pt as CONTRIBUTOR_INSIGHTS_KEY, q as streamPolicyMatchesDeclared, qa as reReadUntilSettled, qo as maskedSecretSegment, rn as withApiLimit, ro as WaitConditionSignalStore, rt as isTtlAlreadyDisabled, st as sendTtlWaitingOutRateLimit, t as DeployEngine, tn as isAccessDeniedError, uc as isWarmThroughputDecrease, ud as describeFileReadFailure, ui as getCurrentProducerRegions, un as getNestedRevertRun, ur as withoutSiblingOwnedSgRules, ut as vectorIndexesForCreate, vn as withNestedStackContext, vs as s3BucketDualStackDomainName, vt as readContributorInsightsSpec, wt as DYNAMODB_DELETE_POLL_COST_MS, wu as decodeListingKey, xc as passedParameterClassesOf, xt as stripIndexContributorInsights, ys as s3BucketRegionalDomainName, yt as reverseMapIndexContributorInsights, z as declaredStreamPolicyMember, za as OWN_WRITE_REREAD_DELAYS_MS, zt as hasCdkAutoDeleteTag } from "./deploy-engine-T1iXkB24.js";
10
- import { _ as isUsableAttemptedName, c as planTagDiff, d as tagMapAsList, f as tagPlanWarning, g as stringifyIfAssigned, h as definedAttributes, i as refuseRestoreFromItself, l as readTagList, m as modifyDbInstanceWhenAvailable, o as DBPROXY_TAGS_WHAT, p as isModifyNotAvailableRefusal, s as DBPROXY_TAG_OPTIONS, u as refuseMalformedDesiredTags } from "./restore-source-guard-CDrsW4tB.js";
11
- import { W as timePhase, _ as onlySecretReferencesDiffer, a as reDisableInstanceApiTermination, c as resolvedResourceTimeoutMs, f as markRefusedBeforeApplying, i as observeThenDisableInstanceApiTermination, j as withRetry, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, r as isTerminationProtectionPropagationError, s as resolvedPerTypeResourceTimeoutMs, u as getPriorAttempts, v as unchangedBehindSecretReference } from "./ec2-termination-protection-Ct7iZKky.js";
12
- import { a as principalOwnWriteMembers, c as stringListMember, d as normalizeRecordName, f as planSubscriptionAttributes, n as declaredStringList, o as settleOwnWriteMembers } from "./settle-own-write-members-BqIDAx00.js";
4
+ import { D as markReplayMayCollide, E as markNameCollision, F as isAmbiguousOutcomeError, G as markRedactedCause, I as isExplicitDenyError, K as wrapMaskedAwsError, M as explicitDenyPolicyKind, O as relayedNameCollision, Q as AccountIdUnavailableError, R as isRetryableTransientError, U as isThrottlingError, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, at as ProvisioningError, et as CdkdError, i as credentialFingerprint, n as ambientCredentialConfig, r as clientDefaultsFor, t as ambientClientDefaults, x as hasReplayMayCollide, z as isTransientServerError } from "./ambient-client-defaults-Bq5rj529.js";
5
+ import { $ as isProceedDbStatus, $t as markAuxiliaryFailure, A as assertRegionMatch, At as canonicalizeRoute53QueryName, B as resolveExplicitPhysicalId, Bt as createMaskedRetryLogger, C as isInsideWindow, Ct as SECRET_DERIVED_READ_LIVE, D as withoutServerErrorRetries, E as setBounded, Et as readPrincipalLists, F as isQuotableImportValue, Ft as packCompositeId, G as logGroupProtectionSite, H as markNotGone, Ht as maskDeep, I as normalizeAwsTagsToCfn, K as observeThenDisableProtection, L as quotedRemedyLogicalId, Lt as segmentAfterAnchor, M as importRemedyCommand, Mt as compositeIdSeparatorRefusal, N as isPlainImportJson, Nt as compositeIdSkipResult, O as DriftReadRefusedError, Ot as recordedPrincipalsRepair, P as isPlainImportValue, Pt as logicalIdShown, R as refusalTypeShown, Rt as stateOrphanRecordRemedy, S as createAttemptKey, T as replayedSendWindow, Tt as onlySecretDerived, Ut as maskerOrIdentity, Vt as isSecretDerivedValue, W as deleteWithProtectionCompensation, Wt as withDerivedNameMasks, X as PROTECTION_FLIP_RETRY_WAIT_MS, Y as userPoolProtectionSite, Z as deleteAfterProtectionFlipWithFinalSnapshot, Zt as isAuxiliaryFailure, _ as AMBIGUOUS_LATCH_TTL_MS, _n as withPasteableAwsProfile, a as clearOnUpdateRemoval, b as RecentIdSet, bt as startInterruptWatch, c as removedTemplateKeys, dt as WITHHELD_AWS_COMMAND, en as markCreatedBeforeFailure, et as isTerminalDbWaitStatus, ft as isAwsCliLiteral, g as retractCreatedResource, ht as renderDisableCommand, it as protectionFlipKey, j as VALUE_NOT_SHOWN, jt as compositeIdFormatMessage, k as RESOURCE_NOT_FOUND, l as withRemovalDefaults, m as reportCreatedResource, mt as protectedReplacementAdvice, n as enclosingDeadlineRemainingMs, nt as ProtectionFlipRegistry, ot as ElapsedBudget, pt as pasteableAwsCommand, q as rdsFamilyProtectionSite, qt as clearCreatedBeforeFailure, rt as isTerminalDeleteFailure, st as ElapsedBudgetRegistry, t as enclosingDeadlineExpired, tn as markSupersedesEarlierCreate, ut as UNNAMEABLE_ID_CLAUSE, v as AmbiguousCreateLatch, vn as injectiveKey, w as replayFollowedAmbiguousAttempt, wt as holdsSecretDerivedEntry, x as ambiguousAttemptLead, y as CREATION_DATE_SKEW_MARGIN_MS, yn as injectiveKeyPrefix, yt as isInterruptedWaitError, z as remedyLogicalId, zt as createMaskedLogSinks } from "./resource-deadline-CSd19ZNv.js";
6
+ import { A as displayStackName, L as truncateCodePoints, N as plainIdentOr, O as displayIdent, P as safeMsg, S as SECRET_REF_MAX_CODE_POINTS, T as asIsMessage, _ as shellQuote, c as deployReplaceCommand, d as pasteableCommand, j as isPasteableIdent, k as displaySafe, l as hasClauseBreak, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, s as commandHole, u as isInertUnquoted, v as withheldTargetClause } from "./version-BAoHSHRL.js";
7
+ import { St as slowCcOperationTimeoutMs, Tt as identityTimestamp, _t as RecordedIdentityMismatchError, gt as RecordedIdentityError, jt as isoTimestampAttribute, n as isRefusedByName, r as markDeleteStarted, vt as assertRecordedIdentity, xt as recordedIdentityId } from "./delete-started-BY94yU_N.js";
8
+ import { $ as recordTagWrite, $a as verbatimEchoDriftKeys, $r as REDACTED_DELETE_ADDRESS_SKIP_REASON, $s as LEGACY_HANDLE_ID_PREFIX, As as parseWebACLArn, At as DELETE_INDEX_WAIT_PROCEED_NOTE, B as declaredStreamTagsMember, Ba as KMS_DEFAULT_KEY_POLICY_ID, Bl as findSdkUnwiredProperties, Bs as getAccountInfo, Bt as isTruthyCfnBoolean, Ct as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Do as waitForLambdaFunctionActive, Dr as calculateResourceDrift, Dt as deleteBudgetKey, El as refuseMalformedResourcesForDestroy, Et as compensateRemovedDeletionProtection, Fa as collectManagedPolicyArnsAttachedBySiblings, Fo as withIndeterminateGuard, Fr as earliestDefined, Ft as relayedIndexBusyDelete, G as streamDeclaresTags, Ga as declaredPolicyDocument, Go as APPSYNC_APIKEY_ARN_RESOURCE_PATH, Ha as OWN_WRITE_REREAD_DELAYS_MS, I as DynamoDBGlobalTableProvider, Ia as collectPrincipalsAttachingPolicy, It as waitForIndexesSettled, Iu as rewriteTemplateAssetReferences, J as streamTagsMatchDeclared, Ja as memberReadFailure, K as streamMemberRefusals, Ka as efsPolicyMatchesDeclared, L as STREAM_POLICY_KEY, La as isStoredExpression, Li as awaitInFlightSibling, Lr as reserveStackCreateToken, Lt as ECR_AUTO_DELETE_IMAGES_TAG, Ml as withheldAccountClause, Mt as TABLE_INDEX_NOUN, Nt as deleteTableWithIndexBusyRetry, Ot as resolveDynamoDbDeleteBudgetClock, Pa as collectGroupsAddedBySiblings, Po as deleteSkipReason, Ps as outputReferenceProvenanceOf, Pt as maskedLogger, Q as isDynamoDBTableArnIn, Qa as warnUnsettledMember, R as STREAM_TAGS_KEY, Ra as withoutSiblingAttachedArns, Ro as markWaitAbandoned, Rt as S3_AUTO_DELETE_OBJECTS_TAG, St as DYNAMODB_DELETE_DEADLINE_MARGIN_MS, Tt as beginDeleteWait, U as reverseMapStreamPolicy, Ua as SNS_DEFAULT_POLICY_ID, Ul as withoutSdkUnwiredProperties, V as planStreamMemberOps, W as streamDeclaresPolicy, Wa as declaredMemberDocument, Wo as isSettledInstanceState, X as clearTagWrites, Xa as reReadUntilSettled, Y as TAGS_BASELINE_REREAD_DELAYS_MS, Ya as policyDocumentMatchesDeclared, Yi as replacedDeleteFailureVerdict, Za as settleDeclaredMember, _o as getCurrentResourceSecrets, _r as recordedSgRuleId, _s as s3BucketDomainName, _t as planIndexContributorInsightsOps, _u as renderNestedTemplateTreeDefect, an as lookupEachName, at as planTimeToLive, bn as getCurrentNestedStackContext, bs as s3BucketWebsiteUrl, bt as reverseMapTableContributorInsights, cc as WARM_THROUGHPUT_MEMBERS, co as classifyHandleUrl, ct as planVectorIndexUpdates, dc as toCfnInteger, dd as displayAssemblyPath, dt as vectorIndexesSettled, ec as isLegacyHandleId, ei as isRedactedRecordedValue, eo as attemptedPolicyDocument, et as settleWrittenTags, fc as toFiniteNumber, fr as siblingOwnedSgRuleIdentities, ft as vectorIndexesShapeDetail, fu as stringifyValue, gl as refuseMalformedNestedChildOutputs, gn as revertNestedChildFromJournal, gr as cfnIngressPortValue, gs as s3BucketArn, gt as planContributorInsightsOp, gu as listNestedTemplateRows, hr as SG_RULE_ID_PATTERN, ht as indexDeclaresContributorInsights, hu as isAbsoluteAssetPath, in as isAccessDeniedError, it as isTtlRateLimited, jl as accountArgs, jt as INDEX_SETTLE_POLL_INTERVAL_MS, ko as waitForGoneAfterDelete, kt as resolveDynamoDbDeleteBudgetMs, lc as coerceWarmThroughput$1, lo as evaluateSignals, lt as readbackVectorIndexes, md as resolveAssemblyPath, mr as withoutSiblingOwnedSgRules, mt as contributorInsightsRefusals, mu as findNestedTemplateTreeDefect, ni as redactedDeleteAddressSkip, nt as takeTagWrite, on as withApiLimit, ot as readTtlSpec, pd as renderAssemblyPathEscape, pi as getCurrentProducerRegions, pn as getNestedRevertRun, pt as CONTRIBUTOR_INSIGHTS_KEY, q as streamPolicyMatchesDeclared, qa as lambdaPermissionMatchesDeclared, qo as maskedSecretSegment, rn as chunks, rt as isTtlAlreadyDisabled, so as WaitConditionSignalStore, st as sendTtlWaitingOutRateLimit, t as DeployEngine, ti as redactedDeleteAddressFields, tn as licensedNameHolder, to as policyContentKey, uc as isWarmThroughputDecrease, ud as describeFileReadFailure, ut as vectorIndexesForCreate, vr as sgProtocolKey, vs as s3BucketDualStackDomainName, vt as readContributorInsightsSpec, wt as DYNAMODB_DELETE_POLL_COST_MS, wu as decodeListingKey, xc as passedParameterClassesOf, xn as withNestedStackContext, xt as stripIndexContributorInsights, ya as secretNamedAttributeNamesOf, ys as s3BucketRegionalDomainName, yt as reverseMapIndexContributorInsights, z as declaredStreamPolicyMember, za as withoutSiblingOwned, zi as getStackRecords, zr as acquireIdempotencyToken, zt as hasCdkAutoDeleteTag } from "./deploy-engine-CkY2eTL9.js";
9
+ import { $ as effectiveInventoryItem, A as tagListsMatch, B as LIFECYCLE_DEFAULT_STATUS, C as reconcileSgRules, D as singleSecurityGroupRuleId, E as sgRuleKey, F as clearLifecycleWritesOf, G as canonicalizeItemList, H as LIFECYCLE_RULE_PATH, I as lifecycleSettleTarget, J as lifecycleUsesFilterForm, K as effectiveLifecycleConfiguration, L as recordLifecycleWrite, M as sgRemovalRuleKey, N as sgRuleListMember, O as stackIngressRuleHolder, P as LIFECYCLE_BASELINE_REREAD_DELAYS_MS, Q as effectiveIntelligentTieringItem, R as settleLifecycleRead, S as narrowIngressIpProtocol, T as securityGroupRuleMatchesCfnIngress, U as LIFECYCLE_TAG_FILTERS_PATH, V as LIFECYCLE_FILTER_PATH, W as canonicalizeBlock, X as EVENTBRIDGE_CONFIG_PATH, Y as parseCfnTimestamp, Z as effectiveAnalyticsItem, _ as flattenIpPermissions, a as resolveSecretDerivedPrincipals, at as declaresBucketObjectLock, b as isDefaultEgressRule, c as readSgIngressById, ct as isPlainObject$4, d as SG_RULE_PAGE_SIZE, dt as shownLifecycleRuleId, et as effectiveNotificationConfiguration, f as authorizeDefinitelyNotApplied, g as descriptionKey, h as comparableIngressIdentity, i as isResolvableSecretPrincipalList, it as configItemId, j as markCopiesAgreed, k as survivingRecordOfRuleId, l as siblingIdOwnedSgRules, lt as manualBucketDeletionClause, m as canonicalizeSgRuleProtocol, n as runDestroyForStack, nt as caughtErrorName, o as refuseRevertRevokingSiblingRules, ot as declaresNestedObjectLock, p as canonicalizeSgInlineRuleProtocols, q as lifecycleRuleScope, r as holdsUnprovenSecretPrincipalToken, rt as coerceCfnNumber, s as sgRuleDiffKey, st as describeValue$1, t as canonicalizeIpv4Cidr, tt as eventBridgeEnabledOf, u as SG_READBACK_RETRY_DELAY_MS, ut as mergeLegacySingular, v as ingressRuleIdentity, w as securityGroupReadbackDelays, x as isResendableSocketFailure, y as isConnectTimeout, z as takeLifecycleWrite } from "./program-uYb3oSBF.js";
10
+ import { _ as isUsableAttemptedName, c as planTagDiff, d as tagMapAsList, f as tagPlanWarning, g as stringifyIfAssigned, h as definedAttributes, i as refuseRestoreFromItself, l as readTagList, m as modifyDbInstanceWhenAvailable, o as DBPROXY_TAGS_WHAT, p as isModifyNotAvailableRefusal, s as DBPROXY_TAG_OPTIONS, u as refuseMalformedDesiredTags } from "./restore-source-guard-D7zwBxYx.js";
11
+ import { W as timePhase, _ as onlySecretReferencesDiffer, a as reDisableInstanceApiTermination, c as resolvedResourceTimeoutMs, f as markRefusedBeforeApplying, i as observeThenDisableInstanceApiTermination, j as withRetry, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, r as isTerminationProtectionPropagationError, s as resolvedPerTypeResourceTimeoutMs, u as getPriorAttempts, v as unchangedBehindSecretReference } from "./ec2-termination-protection-C50H1PZO.js";
12
+ import { a as principalOwnWriteMembers, c as stringListMember, d as normalizeRecordName, f as planSubscriptionAttributes, n as declaredStringList, o as settleOwnWriteMembers } from "./settle-own-write-members-B4h_lONt.js";
13
13
  import { n as canonicalizeRegion, r as derivePartitionAndUrlSuffix } from "./aws-partition-DA0r2sr-.js";
14
14
  import { f as ambientRegion, r as awsEndpointOverrideActive } from "./aws-client-defaults-DAebi99J.js";
15
- import { $ as snapshotPassProvenance, At as withoutPhysicalNameCopies, C as passedNoEchoParametersOf, I as markSameGenerationBag, Nt as dynamicReferenceTokens, W as redactForState, Z as recordReferenceProvenanceEntry, a as emrClusterInstancesReplaced, cn as recordAttributeIdCopy, i as ecsServiceLaunchTypeSetOrChanged, it as hasMaskableValues, l as sameLambdaFunctionAddress, mn as carriesSecretMask, n as blockDeviceMappingsDifferOnlyInDeleteOnTermination, o as canonicalLambdaFunctionName, on as recoverMaskedOutput, s as lambdaFunctionNameForMask, sn as physicalNameCopiesOf } from "./replacement-rules-Y1UE2Vqb.js";
16
- import { RDSProvider } from "./rds-provider-BcNL1C0E.js";
17
- import { NeptuneProvider } from "./neptune-provider-BMDYjSf5.js";
18
- import { ASGProvider } from "./asg-provider-D1t6qsKn.js";
15
+ import { $ as snapshotPassProvenance, At as withoutPhysicalNameCopies, C as passedNoEchoParametersOf, I as markSameGenerationBag, Nt as dynamicReferenceTokens, W as redactForState, Z as recordReferenceProvenanceEntry, a as emrClusterInstancesReplaced, cn as recordAttributeIdCopy, i as ecsServiceLaunchTypeSetOrChanged, it as hasMaskableValues, l as sameLambdaFunctionAddress, mn as carriesSecretMask, n as blockDeviceMappingsDifferOnlyInDeleteOnTermination, o as canonicalLambdaFunctionName, on as recoverMaskedOutput, s as lambdaFunctionNameForMask, sn as physicalNameCopiesOf } from "./replacement-rules-Bs3dhR_O.js";
16
+ import { RDSProvider } from "./rds-provider-CjaaTJEe.js";
17
+ import { NeptuneProvider } from "./neptune-provider-BPnu4P-b.js";
18
+ import { ASGProvider } from "./asg-provider-7c1iqoaI.js";
19
19
  import { createHash, randomUUID } from "node:crypto";
20
20
  import { CreateBucketCommand, CreateBucketMetadataConfigurationCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetadataConfigurationCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAbacCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketMetadataConfigurationCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAbacCommand, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, UpdateBucketMetadataAnnotationTableConfigurationCommand, UpdateBucketMetadataInventoryTableConfigurationCommand, UpdateBucketMetadataJournalTableConfigurationCommand } from "@aws-sdk/client-s3";
21
- 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, UpdateGroupCommand, UpdateLoginProfileCommand, UpdateUserCommand } from "@aws-sdk/client-iam";
21
+ 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, GetRoleCommand, 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, UpdateGroupCommand, UpdateLoginProfileCommand, UpdateUserCommand } from "@aws-sdk/client-iam";
22
22
  import { CreateQueueCommand, DeleteQueueCommand, GetQueueAttributesCommand, GetQueueUrlCommand, ListQueueTagsCommand, QueueDoesNotExist, SQSClient, SetQueueAttributesCommand, TagQueueCommand, UntagQueueCommand } from "@aws-sdk/client-sqs";
23
- import { CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesCommand, GetTopicAttributesCommand, InvalidParameterException, ListSubscriptionsByTopicCommand, ListTagsForResourceCommand, ListTopicsCommand, NotFoundException, SNSClient, SetSubscriptionAttributesCommand, SetTopicAttributesCommand, SubscribeCommand, TagResourceCommand, UnsubscribeCommand, UntagResourceCommand } from "@aws-sdk/client-sns";
23
+ import { AuthorizationErrorException, CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesCommand, GetTopicAttributesCommand, InvalidParameterException, ListSubscriptionsByTopicCommand, ListTagsForResourceCommand, ListTopicsCommand, NotFoundException, SNSClient, SetSubscriptionAttributesCommand, SetTopicAttributesCommand, SubscribeCommand, TagResourceCommand, UnsubscribeCommand, UntagResourceCommand } from "@aws-sdk/client-sns";
24
24
  import { AddPermissionCommand, CreateEventSourceMappingCommand, CreateFunctionCommand, CreateFunctionUrlConfigCommand, DeleteEventSourceMappingCommand, DeleteFunctionCodeSigningConfigCommand, DeleteFunctionCommand, DeleteFunctionConcurrencyCommand, DeleteFunctionEventInvokeConfigCommand, DeleteFunctionUrlConfigCommand, DeleteLayerVersionCommand, GetEventSourceMappingCommand, GetFunctionCodeSigningConfigCommand, GetFunctionCommand, GetFunctionConcurrencyCommand, GetFunctionConfigurationCommand, GetFunctionEventInvokeConfigCommand, GetFunctionRecursionConfigCommand, GetFunctionScalingConfigCommand, GetFunctionUrlConfigCommand, GetLayerVersionByArnCommand, GetPolicyCommand as GetPolicyCommand$1, GetRuntimeManagementConfigCommand, LambdaClient, ListEventSourceMappingsCommand, ListLayerVersionsCommand, ListTagsCommand, PublishLayerVersionCommand, PublishVersionCommand, PutFunctionCodeSigningConfigCommand, PutFunctionConcurrencyCommand, PutFunctionEventInvokeConfigCommand, PutFunctionRecursionConfigCommand, PutFunctionScalingConfigCommand, PutRuntimeManagementConfigCommand, RemovePermissionCommand, ResourceNotFoundException, TagResourceCommand as TagResourceCommand$1, UntagResourceCommand as UntagResourceCommand$1, UpdateEventSourceMappingCommand, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand, UpdateFunctionUrlConfigCommand, waitUntilFunctionActiveV2, waitUntilFunctionUpdatedV2 } from "@aws-sdk/client-lambda";
25
25
  import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
26
26
  import { AllocateAddressCommand, AssociateAddressCommand, AssociateIamInstanceProfileCommand, AssociateNatGatewayAddressCommand, AssociateRouteTableCommand, AssociateSubnetCidrBlockCommand, AttachInternetGatewayCommand, AttachVolumeCommand, AttachVpnGatewayCommand, AuthorizeSecurityGroupEgressCommand, AuthorizeSecurityGroupIngressCommand, CreateInternetGatewayCommand, CreateNatGatewayCommand, CreateNetworkAclCommand, CreateNetworkAclEntryCommand, CreateRouteCommand, CreateRouteTableCommand, CreateSecurityGroupCommand, CreateSubnetCommand, CreateTagsCommand, CreateVpcCommand, DeleteInternetGatewayCommand, DeleteNatGatewayCommand, DeleteNetworkAclCommand, DeleteNetworkAclEntryCommand, DeleteNetworkInterfaceCommand, DeleteRouteCommand, DeleteRouteTableCommand, DeleteSecurityGroupCommand, DeleteSubnetCommand, DeleteTagsCommand, DeleteVpcCommand, DescribeAddressesCommand, DescribeAvailabilityZonesCommand, DescribeIamInstanceProfileAssociationsCommand, DescribeInstanceAttributeCommand, DescribeInstanceCreditSpecificationsCommand, DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeNetworkInterfacesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupRulesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVolumesCommand, DescribeVpcAttributeCommand, DescribeVpcsCommand, DescribeVpnGatewaysCommand, DetachInternetGatewayCommand, DetachVolumeCommand, DetachVpnGatewayCommand, DisassociateAddressCommand, DisassociateIamInstanceProfileCommand, DisassociateNatGatewayAddressCommand, DisassociateRouteTableCommand, DisassociateSubnetCidrBlockCommand, EC2Client, GetIpamPoolAllocationsCommand, ModifyInstanceAttributeCommand, ModifyInstanceCreditSpecificationCommand, ModifyInstanceMetadataOptionsCommand, ModifyInstancePlacementCommand, ModifyPrivateDnsNameOptionsCommand, ModifySubnetAttributeCommand, ModifyVpcAttributeCommand, ModifyVpcTenancyCommand, MonitorInstancesCommand, ReleaseAddressCommand, ReplaceIamInstanceProfileAssociationCommand, ReplaceNetworkAclAssociationCommand, ReplaceNetworkAclEntryCommand, ReplaceRouteCommand, RevokeSecurityGroupEgressCommand, RevokeSecurityGroupIngressCommand, RunInstancesCommand, StartInstancesCommand, StopInstancesCommand, TerminateInstancesCommand, UnmonitorInstancesCommand, UpdateSecurityGroupRuleDescriptionsEgressCommand, UpdateSecurityGroupRuleDescriptionsIngressCommand, waitUntilInstanceRunning, waitUntilInstanceTerminated, waitUntilNatGatewayAvailable, waitUntilNatGatewayDeleted } from "@aws-sdk/client-ec2";
@@ -244,6 +244,140 @@ function revertReplacementRefusal(resourceType, logicalId, reason) {
244
244
  return new ResourceUpdateNotSupportedError(resourceType, logicalId, `${reason}, so reverting it would replace it, and a drift revert never replaces a resource. Nothing was changed; re-deploy with ${deployReplaceCommand()} to replace it`);
245
245
  }
246
246
 
247
+ // src/provisioning/providers/iam-policy/principal-identity.ts
248
+ const PRINCIPAL_SPECS = {
249
+ role: {
250
+ resourceType: "AWS::IAM::Role",
251
+ label: "IAM role",
252
+ attribute: "RoleId",
253
+ read: async (client, name) => (await client.send(new GetRoleCommand({ RoleName: name }))).Role?.RoleId
254
+ },
255
+ group: {
256
+ resourceType: "AWS::IAM::Group",
257
+ label: "IAM group",
258
+ attribute: "GroupId",
259
+ read: async (client, name) => (await client.send(new GetGroupCommand({
260
+ GroupName: name,
261
+ MaxItems: 1
262
+ }))).Group?.GroupId
263
+ },
264
+ user: {
265
+ resourceType: "AWS::IAM::User",
266
+ label: "IAM user",
267
+ attribute: "UserId",
268
+ read: async (client, name) => (await client.send(new GetUserCommand({ UserName: name }))).User?.UserId
269
+ }
270
+ };
271
+ function inStackRecordedIds(kind, name) {
272
+ const view = getStackRecords();
273
+ if (view === void 0) return void 0;
274
+ const { resourceType } = PRINCIPAL_SPECS[kind];
275
+ let found;
276
+ for (const [logicalId, record] of view.live()) {
277
+ if (record.resourceType !== resourceType || record.physicalId !== name) continue;
278
+ const recorded = recordedIdentityId(resourceType, { recordedAttributes: record.attributes });
279
+ if (recorded === void 0) continue;
280
+ if (found === void 0) found = {
281
+ logicalId,
282
+ key: recorded.key,
283
+ values: []
284
+ };
285
+ if (!found.values.includes(recorded.value)) found.values.push(recorded.value);
286
+ }
287
+ return found;
288
+ }
289
+ async function verifyInlinePolicyPrincipal(params) {
290
+ const { client, kind, name, policyLogicalId, physicalId, operation } = params;
291
+ const recorded = inStackRecordedIds(kind, name);
292
+ if (recorded === void 0) return { kind: "unchecked" };
293
+ const spec = PRINCIPAL_SPECS[kind];
294
+ const value = recorded.values[0];
295
+ const read = async () => {
296
+ const id = await spec.read(client, name);
297
+ return id !== void 0 && recorded.values.includes(id) ? value : id;
298
+ };
299
+ try {
300
+ await assertRecordedIdentity({
301
+ label: spec.label,
302
+ resourceType: spec.resourceType,
303
+ logicalId: recorded.logicalId,
304
+ physicalId: name,
305
+ liveId: await read(),
306
+ reread: read,
307
+ context: { recordedAttributes: { [recorded.key]: value } }
308
+ });
309
+ return { kind: "verified" };
310
+ } catch (error) {
311
+ if (error instanceof NoSuchEntityException) return { kind: "gone" };
312
+ if (error instanceof RecordedIdentityMismatchError) return {
313
+ kind: "mismatch",
314
+ principalLogicalId: recorded.logicalId,
315
+ label: spec.label,
316
+ attribute: error.attribute
317
+ };
318
+ if (error instanceof RecordedIdentityError) throw new InlinePolicyPrincipalUnconfirmedError(policyLogicalId, physicalId, `${spec.label} ${recorded.logicalId}`, recorded.key, operation);
319
+ throw error;
320
+ }
321
+ }
322
+ const PRINCIPAL_READ_CONCURRENCY = 5;
323
+ async function verifyInlinePolicyPrincipals(params) {
324
+ const { client, principals, policyLogicalId, physicalId, operation } = params;
325
+ const distinct = principals.filter(([kind, name], i) => principals.findIndex(([k, n]) => injectiveKey(k, n) === injectiveKey(kind, name)) === i);
326
+ const results = [];
327
+ let next = 0;
328
+ const worker = async () => {
329
+ while (next < distinct.length) {
330
+ const index = next++;
331
+ const [kind, name] = distinct[index];
332
+ try {
333
+ results[index] = {
334
+ status: "fulfilled",
335
+ value: await verifyInlinePolicyPrincipal({
336
+ client,
337
+ kind,
338
+ name,
339
+ policyLogicalId,
340
+ physicalId,
341
+ operation
342
+ })
343
+ };
344
+ } catch (reason) {
345
+ results[index] = {
346
+ status: "rejected",
347
+ reason
348
+ };
349
+ }
350
+ }
351
+ };
352
+ await Promise.all(Array.from({ length: Math.min(5, distinct.length) }, worker));
353
+ const verdicts = /* @__PURE__ */ new Map();
354
+ for (const [index, result] of results.entries()) {
355
+ if (result.status === "rejected") throw result.reason;
356
+ const [kind, name] = distinct[index];
357
+ verdicts.set(injectiveKey(kind, name), result.value);
358
+ }
359
+ return verdicts;
360
+ }
361
+ var InlinePolicyPrincipalUnconfirmedError = class InlinePolicyPrincipalUnconfirmedError extends RecordedIdentityError {
362
+ constructor(policyLogicalId, physicalId, principal, attribute, operation) {
363
+ super((operation === "update" ? `Cannot remove IAM policy ${policyLogicalId} from ${principal} during an update: ` : `Cannot delete IAM policy ${policyLogicalId} from ${principal}: `) + `AWS answered without its ${attribute}, so cdkd cannot confirm it is the one cdkd created; nothing was sent to it and the record is kept. Re-run the operation.`, "AWS::IAM::Policy", policyLogicalId, physicalId);
364
+ Object.setPrototypeOf(this, InlinePolicyPrincipalUnconfirmedError.prototype);
365
+ this.name = "InlinePolicyPrincipalUnconfirmedError";
366
+ markNotGone(this);
367
+ }
368
+ };
369
+ var InlinePolicyPrincipalMismatchError = class InlinePolicyPrincipalMismatchError extends RecordedIdentityError {
370
+ constructor(params) {
371
+ const { policyLogicalId, physicalId, mismatches, context } = params;
372
+ const named = mismatches.map((m) => `${m.label} ${m.principalLogicalId} (its ${m.attribute} differs)`).join(", ");
373
+ super(`Cannot delete IAM policy ${policyLogicalId} from ${named}: the principal holding the name cdkd recorded is not the one cdkd created, so cdkd sent it no delete and kept the record (the principal's own record refuses its delete the same way). Leave that principal alone; if the one cdkd created is gone (its inline policy went with it), drop the record with ${stateOrphanRecordRemedy(context, policyLogicalId)}.`, "AWS::IAM::Policy", policyLogicalId, physicalId);
374
+ Object.setPrototypeOf(this, InlinePolicyPrincipalMismatchError.prototype);
375
+ this.name = "InlinePolicyPrincipalMismatchError";
376
+ markNonRetryable(this);
377
+ markNotGone(this);
378
+ }
379
+ };
380
+
247
381
  // src/provisioning/providers/iam-policy/update.ts
248
382
  async function update$42(logicalId, physicalId, resourceType, properties, previousProperties, context) {
249
383
  const oldPolicyName = physicalId.includes(":") ? physicalId.split(":")[0] : physicalId;
@@ -330,6 +464,40 @@ async function update$42(logicalId, physicalId, resourceType, properties, previo
330
464
  }
331
465
  ];
332
466
  const renamedAway = oldPolicyNames.filter((name) => name.toLowerCase() !== newPolicyName.toLowerCase());
467
+ const claimAnswers = /* @__PURE__ */ new Map();
468
+ const isClaimed = (kind, name, policyName) => {
469
+ const key = injectiveKey(kind, name, policyName);
470
+ let answer = claimAnswers.get(key);
471
+ if (answer === void 0) {
472
+ answer = context?.inlinePolicyClaimed?.(kind, name, policyName) === true;
473
+ claimAnswers.set(key, answer);
474
+ }
475
+ return answer;
476
+ };
477
+ const leaving = kinds.flatMap(({ kind, desired, recorded }) => {
478
+ const stays = new Set([...desired].map((name) => name.toLowerCase()));
479
+ return [...recorded].filter((name) => !stays.has(name.toLowerCase())).filter((name) => oldPolicyNames.some((policyName) => !isClaimed(kind, name, policyName))).map((name) => [kind, name]);
480
+ });
481
+ const verdicts = await verifyInlinePolicyPrincipals({
482
+ client: this.iamClient,
483
+ principals: leaving,
484
+ policyLogicalId: logicalId,
485
+ physicalId,
486
+ operation: "update"
487
+ });
488
+ const warned = /* @__PURE__ */ new Set();
489
+ const settledByVerdict = (kind, name) => {
490
+ const key = injectiveKey(kind, name);
491
+ const verdict = verdicts.get(key);
492
+ if (verdict?.kind === "mismatch") {
493
+ if (!warned.has(key)) {
494
+ warned.add(key);
495
+ log.warn(`IAM policy ${logicalId}: the ${verdict.label} ${verdict.principalLogicalId} leaving its principals is not the one cdkd created (its ${verdict.attribute} differs from the recorded one), so cdkd sent it no removal: the one cdkd created is gone, and its inline policy with it. Leave that ${verdict.label} alone.`);
496
+ }
497
+ return true;
498
+ }
499
+ return verdict?.kind === "gone";
500
+ };
333
501
  for (const { kind, desired, recorded, put, remove } of kinds) {
334
502
  for (const name of desired) {
335
503
  await put(name, newPolicyName);
@@ -337,10 +505,11 @@ async function update$42(logicalId, physicalId, resourceType, properties, previo
337
505
  }
338
506
  const stays = new Set([...desired].map((name) => name.toLowerCase()));
339
507
  for (const name of recorded) for (const policyName of stays.has(name.toLowerCase()) ? renamedAway : oldPolicyNames) {
340
- if (context?.inlinePolicyClaimed?.(kind, name, policyName) === true) {
508
+ if (isClaimed(kind, name, policyName)) {
341
509
  log.debug(`Kept inline policy ${v(policyName)} on ${kind} ${v(name)}: another resource of this deploy or rollback wrote it`);
342
510
  continue;
343
511
  }
512
+ if (!stays.has(name.toLowerCase()) && settledByVerdict(kind, name)) continue;
344
513
  try {
345
514
  await remove(name, policyName);
346
515
  log.debug(`Removed inline policy ${v(policyName)} from ${kind} ${v(name)}`);
@@ -356,6 +525,7 @@ async function update$42(logicalId, physicalId, resourceType, properties, previo
356
525
  attributes: { PolicyName: newPolicyName }
357
526
  };
358
527
  } catch (error) {
528
+ if (error instanceof RecordedIdentityError) throw error;
359
529
  const cause = error instanceof Error ? error : void 0;
360
530
  throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to update IAM policy ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
361
531
  }
@@ -444,8 +614,18 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
444
614
  removedAny = true;
445
615
  if (fromSecret(kind, name)) detached?.add(injectiveKey(kind, name));
446
616
  };
617
+ const claimAnswers = /* @__PURE__ */ new Map();
618
+ const isClaimed = (kind, name) => {
619
+ const key = injectiveKey(kind, name);
620
+ let answer = claimAnswers.get(key);
621
+ if (answer === void 0) {
622
+ answer = context?.inlinePolicyClaimed?.(kind, name, policyName) === true;
623
+ claimAnswers.set(key, answer);
624
+ }
625
+ return answer;
626
+ };
447
627
  const claimed = (kind, name) => {
448
- if (context?.inlinePolicyClaimed?.(kind, name, policyName) !== true) return false;
628
+ if (!isClaimed(kind, name)) return false;
449
629
  this.logger.debug(safeMsg`Kept inline policy ${policyName} on ${kind} ${mask(name)}: another resource of this deploy or rollback wrote it`);
450
630
  return true;
451
631
  };
@@ -454,8 +634,35 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
454
634
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, `${physicalId} (${target})`);
455
635
  if (principal !== void 0 && fromSecret(principal.kind, principal.name) && detached?.has(injectiveKey(principal.kind, principal.name)) !== true) secretPrincipalLacksGrant = true;
456
636
  };
637
+ const verdicts = /* @__PURE__ */ new Map();
638
+ const mismatches = [];
639
+ const settledByVerdict = async (kind, name, target, principal) => {
640
+ const verdict = verdicts.get(injectiveKey(kind, name));
641
+ if (verdict?.kind === "mismatch") {
642
+ if (!mismatches.includes(verdict)) mismatches.push(verdict);
643
+ return true;
644
+ }
645
+ if (verdict?.kind === "gone") {
646
+ await onNotFound(target, principal);
647
+ return true;
648
+ }
649
+ return false;
650
+ };
457
651
  try {
458
- if (legacyRoleFromPhysicalId && !claimed("role", legacyRoleFromPhysicalId)) {
652
+ const toVerify = [
653
+ ...legacyRoleFromPhysicalId ? [["role", legacyRoleFromPhysicalId]] : [],
654
+ ...(roles ?? []).map((name) => ["role", name]),
655
+ ...(groups ?? []).map((name) => ["group", name]),
656
+ ...(users ?? []).map((name) => ["user", name])
657
+ ].filter(([kind, name]) => !isClaimed(kind, name));
658
+ for (const [key, verdict] of await verifyInlinePolicyPrincipals({
659
+ client: this.iamClient,
660
+ principals: toVerify,
661
+ policyLogicalId: logicalId,
662
+ physicalId,
663
+ operation: "delete"
664
+ })) verdicts.set(key, verdict);
665
+ if (legacyRoleFromPhysicalId && !claimed("role", legacyRoleFromPhysicalId) && !await settledByVerdict("role", legacyRoleFromPhysicalId, `role ${mask(legacyRoleFromPhysicalId)}`)) {
459
666
  const firstRole = legacyRoleFromPhysicalId;
460
667
  try {
461
668
  await this.iamClient.send(new DeleteRolePolicyCommand({
@@ -470,6 +677,11 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
470
677
  }
471
678
  if (roles) for (const roleName of roles) {
472
679
  if (claimed("role", roleName)) continue;
680
+ const roleTarget = {
681
+ kind: "Roles",
682
+ name: roleName
683
+ };
684
+ if (await settledByVerdict("role", roleName, `role ${mask(roleName)}`, roleTarget)) continue;
473
685
  try {
474
686
  await this.iamClient.send(new DeleteRolePolicyCommand({
475
687
  RoleName: roleName,
@@ -487,6 +699,11 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
487
699
  }
488
700
  if (groups) for (const groupName of groups) {
489
701
  if (claimed("group", groupName)) continue;
702
+ const groupTarget = {
703
+ kind: "Groups",
704
+ name: groupName
705
+ };
706
+ if (await settledByVerdict("group", groupName, `group ${mask(groupName)}`, groupTarget)) continue;
490
707
  try {
491
708
  await this.iamClient.send(new DeleteGroupPolicyCommand({
492
709
  GroupName: groupName,
@@ -504,6 +721,11 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
504
721
  }
505
722
  if (users) for (const userName of users) {
506
723
  if (claimed("user", userName)) continue;
724
+ const userTarget = {
725
+ kind: "Users",
726
+ name: userName
727
+ };
728
+ if (await settledByVerdict("user", userName, `user ${mask(userName)}`, userTarget)) continue;
507
729
  try {
508
730
  await this.iamClient.send(new DeleteUserPolicyCommand({
509
731
  UserName: userName,
@@ -519,6 +741,12 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
519
741
  else throw error;
520
742
  }
521
743
  }
744
+ if (mismatches.length > 0) throw new InlinePolicyPrincipalMismatchError({
745
+ policyLogicalId: logicalId,
746
+ physicalId,
747
+ mismatches,
748
+ context
749
+ });
522
750
  if (secretPrincipalLacksGrant) {
523
751
  this.logger.warn(safeMsg`IAM policy ${logicalId}: a principal the secret's CURRENT value names does not hold this inline policy. The value may have rotated since the policy was attached, so a principal only the OLD value named may still hold it; or an earlier cdkd run already removed it there, or that principal was deleted first. The record is KEPT rather than read as deleted: delete the inline policy from any old principal by hand (the principals the current value names are done), then drop this record with ${pasteableCommand("cdkd orphan", [{ hole: "constructPath" }]).command}, or, with no CDK app, ${stateOrphanRecordRemedy(context, logicalId)}.`);
524
752
  return {
@@ -528,6 +756,7 @@ async function deleteImpl$40(logicalId, physicalId, resourceType, properties, co
528
756
  }
529
757
  this.logger.debug(`Successfully deleted IAM policy ${logicalId}`);
530
758
  } catch (error) {
759
+ if (error instanceof RecordedIdentityError) throw removedAny ? markDeleteStarted(error) : error;
531
760
  const cause = error instanceof Error ? error : void 0;
532
761
  const opMask = createMaskedLogSinks(this.logger, context?.maskSecrets).mask;
533
762
  const failure = this.wrapMaskedError((text) => mask(opMask(text)), error, (text) => new ProvisioningError(`Failed to delete IAM policy ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
@@ -730,12 +959,6 @@ var IAMPolicyProvider = class {
730
959
  }
731
960
  };
732
961
 
733
- // src/provisioning/attribute-timestamp.ts
734
- function isoTimestampAttribute(value) {
735
- if (!(value instanceof Date) || Number.isNaN(value.getTime())) return void 0;
736
- return value.toISOString().replace(/\.000Z$/, "Z");
737
- }
738
-
739
962
  // src/provisioning/providers/iam-managed-policy/shared.ts
740
963
  function managedPolicyAttributes(policyArn, policy) {
741
964
  return definedAttributes({
@@ -1097,6 +1320,7 @@ async function deleteImpl$39(logicalId, physicalId, resourceType, _properties, c
1097
1320
  // src/provisioning/providers/iam-managed-policy/read-state.ts
1098
1321
  const AWS_MANAGED_POLICY_ARN_RE = /^arn:aws[a-z0-9-]*:iam::aws:/;
1099
1322
  async function readCurrentState$40(physicalId, logicalId, _resourceType, properties, context) {
1323
+ const removed = context?.afterOwnWrite === true ? takeOwnWriteRemovals("AWS::IAM::ManagedPolicy", physicalId) : void 0;
1100
1324
  let policy;
1101
1325
  try {
1102
1326
  policy = (await this.iamClient.send(new GetPolicyCommand({ PolicyArn: physicalId }))).Policy;
@@ -1139,7 +1363,7 @@ async function readCurrentState$40(physicalId, logicalId, _resourceType, propert
1139
1363
  } catch (err) {
1140
1364
  if (!(err instanceof NoSuchEntityException)) throw err;
1141
1365
  }
1142
- if (context?.afterOwnWrite === true && properties !== void 0) await settleOwnWriteMembers(result, managedPolicyOwnWriteMembers.call(this, physicalId, properties, context), this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::ManagedPolicy", key));
1366
+ if (context?.afterOwnWrite === true && properties !== void 0) await settleOwnWriteMembers(result, managedPolicyOwnWriteMembers.call(this, physicalId, properties, context, removed), this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::ManagedPolicy", key));
1143
1367
  return result;
1144
1368
  }
1145
1369
  async function readDefaultVersionDocument(physicalId, versionId) {
@@ -1177,7 +1401,7 @@ async function readAttachments(physicalId, properties, context) {
1177
1401
  Users: own("Users", users)
1178
1402
  };
1179
1403
  }
1180
- function managedPolicyOwnWriteMembers(physicalId, properties, context) {
1404
+ function managedPolicyOwnWriteMembers(physicalId, properties, context, removed) {
1181
1405
  const members = [];
1182
1406
  const document = declaredMemberDocument(properties["PolicyDocument"]);
1183
1407
  if (document !== void 0) members.push({
@@ -1203,12 +1427,13 @@ function managedPolicyOwnWriteMembers(physicalId, properties, context) {
1203
1427
  "Users"
1204
1428
  ]) {
1205
1429
  const declared = declaredStringList(properties[key]);
1206
- if (declared === void 0) continue;
1207
- members.push(stringListMember(key, declared, async () => {
1430
+ const gone = removed?.get(key);
1431
+ if (declared === void 0 && (gone?.size ?? 0) === 0) continue;
1432
+ members.push(stringListMember(key, declared ?? [], async () => {
1208
1433
  const round = served[key]++;
1209
1434
  rounds[round] ??= readAttachments.call(this, physicalId, properties, context);
1210
1435
  return { value: (await rounds[round])[key] };
1211
- }));
1436
+ }, gone));
1212
1437
  }
1213
1438
  return members;
1214
1439
  }
@@ -1366,6 +1591,7 @@ var IAMManagedPolicyProvider = class {
1366
1591
  }
1367
1592
  async updatePrincipals(policyArn, newGroups, oldGroups, newRoles, oldRoles, newUsers, oldUsers, log) {
1368
1593
  const { value: v } = log;
1594
+ clearOwnWriteRemovals(MANAGED_POLICY_TYPE, policyArn);
1369
1595
  const newGroupSet = new Set(newGroups || []);
1370
1596
  const oldGroupSet = new Set(oldGroups || []);
1371
1597
  for (const g of newGroupSet) if (!oldGroupSet.has(g)) {
@@ -1375,14 +1601,17 @@ var IAMManagedPolicyProvider = class {
1375
1601
  }));
1376
1602
  log.debug(`Attached ${v(policyArn)} to group ${v(g)}`);
1377
1603
  }
1378
- for (const g of oldGroupSet) if (!newGroupSet.has(g)) try {
1379
- await this.iamClient.send(new DetachGroupPolicyCommand({
1380
- GroupName: g,
1381
- PolicyArn: policyArn
1382
- }));
1383
- log.debug(`Detached ${v(policyArn)} from group ${v(g)}`);
1384
- } catch (err) {
1385
- if (!(err instanceof NoSuchEntityException)) throw err;
1604
+ for (const g of oldGroupSet) if (!newGroupSet.has(g)) {
1605
+ try {
1606
+ await this.iamClient.send(new DetachGroupPolicyCommand({
1607
+ GroupName: g,
1608
+ PolicyArn: policyArn
1609
+ }));
1610
+ log.debug(`Detached ${v(policyArn)} from group ${v(g)}`);
1611
+ } catch (err) {
1612
+ if (!(err instanceof NoSuchEntityException)) throw err;
1613
+ }
1614
+ recordOwnWriteRemoval(MANAGED_POLICY_TYPE, policyArn, "Groups", g);
1386
1615
  }
1387
1616
  const newRoleSet = new Set(newRoles || []);
1388
1617
  const oldRoleSet = new Set(oldRoles || []);
@@ -1393,14 +1622,17 @@ var IAMManagedPolicyProvider = class {
1393
1622
  }));
1394
1623
  log.debug(`Attached ${v(policyArn)} to role ${v(r)}`);
1395
1624
  }
1396
- for (const r of oldRoleSet) if (!newRoleSet.has(r)) try {
1397
- await this.iamClient.send(new DetachRolePolicyCommand({
1398
- RoleName: r,
1399
- PolicyArn: policyArn
1400
- }));
1401
- log.debug(`Detached ${v(policyArn)} from role ${v(r)}`);
1402
- } catch (err) {
1403
- if (!(err instanceof NoSuchEntityException)) throw err;
1625
+ for (const r of oldRoleSet) if (!newRoleSet.has(r)) {
1626
+ try {
1627
+ await this.iamClient.send(new DetachRolePolicyCommand({
1628
+ RoleName: r,
1629
+ PolicyArn: policyArn
1630
+ }));
1631
+ log.debug(`Detached ${v(policyArn)} from role ${v(r)}`);
1632
+ } catch (err) {
1633
+ if (!(err instanceof NoSuchEntityException)) throw err;
1634
+ }
1635
+ recordOwnWriteRemoval(MANAGED_POLICY_TYPE, policyArn, "Roles", r);
1404
1636
  }
1405
1637
  const newUserSet = new Set(newUsers || []);
1406
1638
  const oldUserSet = new Set(oldUsers || []);
@@ -1411,14 +1643,17 @@ var IAMManagedPolicyProvider = class {
1411
1643
  }));
1412
1644
  log.debug(`Attached ${v(policyArn)} to user ${v(u)}`);
1413
1645
  }
1414
- for (const u of oldUserSet) if (!newUserSet.has(u)) try {
1415
- await this.iamClient.send(new DetachUserPolicyCommand({
1416
- UserName: u,
1417
- PolicyArn: policyArn
1418
- }));
1419
- log.debug(`Detached ${v(policyArn)} from user ${v(u)}`);
1420
- } catch (err) {
1421
- if (!(err instanceof NoSuchEntityException)) throw err;
1646
+ for (const u of oldUserSet) if (!newUserSet.has(u)) {
1647
+ try {
1648
+ await this.iamClient.send(new DetachUserPolicyCommand({
1649
+ UserName: u,
1650
+ PolicyArn: policyArn
1651
+ }));
1652
+ log.debug(`Detached ${v(policyArn)} from user ${v(u)}`);
1653
+ } catch (err) {
1654
+ if (!(err instanceof NoSuchEntityException)) throw err;
1655
+ }
1656
+ recordOwnWriteRemoval(MANAGED_POLICY_TYPE, policyArn, "Users", u);
1422
1657
  }
1423
1658
  }
1424
1659
  async readLivePrincipals(policyArn) {
@@ -1691,6 +1926,7 @@ var IAMInstanceProfileProvider = class {
1691
1926
  const log = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[properties["InstanceProfileName"], physicalId], [previousProperties["InstanceProfileName"], physicalId]]);
1692
1927
  const { value: v } = log;
1693
1928
  log.debug(`Updating IAM instance profile ${logicalId}: ${v(physicalId)}`);
1929
+ clearOwnWriteRemovals(INSTANCE_PROFILE_TYPE, physicalId);
1694
1930
  const newPrincipals = readPrincipalLists({ Roles: properties["Roles"] });
1695
1931
  let oldPrincipals = readPrincipalLists({ Roles: previousProperties["Roles"] });
1696
1932
  if (!("malformed" in newPrincipals) && onlySecretDerived(oldPrincipals)) try {
@@ -1705,15 +1941,18 @@ var IAMInstanceProfileProvider = class {
1705
1941
  const newRoles = newPrincipals.lists.Roles ?? [];
1706
1942
  const oldRoles = oldPrincipals.lists.Roles ?? [];
1707
1943
  try {
1708
- for (const roleName of oldRoles) if (!newRoles.includes(roleName)) try {
1709
- await this.iamClient.send(new RemoveRoleFromInstanceProfileCommand({
1710
- InstanceProfileName: physicalId,
1711
- RoleName: roleName
1712
- }));
1713
- log.debug(`Removed role ${v(roleName)} from instance profile ${v(physicalId)}`);
1714
- } catch (error) {
1715
- if (!(error instanceof NoSuchEntityException)) throw error;
1716
- log.debug(`Role ${v(roleName)} already removed from instance profile ${v(physicalId)}`);
1944
+ for (const roleName of oldRoles) if (!newRoles.includes(roleName)) {
1945
+ try {
1946
+ await this.iamClient.send(new RemoveRoleFromInstanceProfileCommand({
1947
+ InstanceProfileName: physicalId,
1948
+ RoleName: roleName
1949
+ }));
1950
+ log.debug(`Removed role ${v(roleName)} from instance profile ${v(physicalId)}`);
1951
+ } catch (error) {
1952
+ if (!(error instanceof NoSuchEntityException)) throw error;
1953
+ log.debug(`Role ${v(roleName)} already removed from instance profile ${v(physicalId)}`);
1954
+ }
1955
+ recordOwnWriteRemoval(INSTANCE_PROFILE_TYPE, physicalId, "Roles", roleName);
1717
1956
  }
1718
1957
  for (const roleName of newRoles) if (!oldRoles.includes(roleName)) {
1719
1958
  try {
@@ -1848,6 +2087,7 @@ var IAMInstanceProfileProvider = class {
1848
2087
  return token;
1849
2088
  }
1850
2089
  async readCurrentState(physicalId, logicalId, _resourceType, properties, context) {
2090
+ const removed = context?.afterOwnWrite === true ? takeOwnWriteRemovals(INSTANCE_PROFILE_TYPE, physicalId)?.get("Roles") : void 0;
1851
2091
  let profile;
1852
2092
  try {
1853
2093
  profile = (await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }))).InstanceProfile;
@@ -1861,10 +2101,10 @@ var IAMInstanceProfileProvider = class {
1861
2101
  if (profile.Path !== void 0) result["Path"] = profile.Path;
1862
2102
  result["Roles"] = profileRoleNames(profile);
1863
2103
  const declared = context?.afterOwnWrite === true ? declaredStringList(properties?.["Roles"]) : void 0;
1864
- if (declared !== void 0) await settleOwnWriteMembers(result, [stringListMember("Roles", declared, async () => {
2104
+ if (declared !== void 0 || (removed?.size ?? 0) > 0) await settleOwnWriteMembers(result, [stringListMember("Roles", declared ?? [], async () => {
1865
2105
  const resp = await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }));
1866
2106
  return resp.InstanceProfile ? { value: profileRoleNames(resp.InstanceProfile) } : "failed";
1867
- })], this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::InstanceProfile", key));
2107
+ }, removed)], this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::InstanceProfile", key));
1868
2108
  return result;
1869
2109
  }
1870
2110
  async import(input) {
@@ -2447,10 +2687,12 @@ async function createUser(logicalId, resourceType, properties, log) {
2447
2687
  }
2448
2688
 
2449
2689
  // src/provisioning/providers/iam-user-group/user-update.ts
2690
+ const USER_TYPE = "AWS::IAM::User";
2450
2691
  async function updateUser(logicalId, physicalId, resourceType, properties, previousProperties, log, claimed) {
2451
2692
  const { value: v } = log;
2452
2693
  log.debug(`Updating IAM user ${logicalId}: ${v(physicalId)}`);
2453
2694
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
2695
+ clearOwnWriteRemovals(USER_TYPE, physicalId);
2454
2696
  const groups = await readPrincipalSides({
2455
2697
  desired: { Groups: properties["Groups"] },
2456
2698
  recorded: { Groups: previousProperties["Groups"] },
@@ -2491,6 +2733,7 @@ async function updateUser(logicalId, physicalId, resourceType, properties, previ
2491
2733
  log.debug(`Updated permissions boundary on user ${v(physicalId)}`);
2492
2734
  } else if (oldPermBoundary) {
2493
2735
  await this.iamClient.send(new DeleteUserPermissionsBoundaryCommand({ UserName: physicalId }));
2736
+ recordOwnWriteRemoval(USER_TYPE, physicalId, "PermissionsBoundary", oldPermBoundary);
2494
2737
  log.debug(`Removed permissions boundary from user ${v(physicalId)}`);
2495
2738
  }
2496
2739
  }
@@ -2569,14 +2812,17 @@ async function updateUserManagedPolicies(userName, newPolicies, oldPolicies, log
2569
2812
  }));
2570
2813
  log.debug(`Attached managed policy ${v(policyArn)} to user ${v(userName)}`);
2571
2814
  }
2572
- for (const policyArn of oldSet) if (!newSet.has(policyArn)) try {
2573
- await this.iamClient.send(new DetachUserPolicyCommand({
2574
- UserName: userName,
2575
- PolicyArn: policyArn
2576
- }));
2577
- log.debug(`Detached managed policy ${v(policyArn)} from user ${v(userName)}`);
2578
- } catch (error) {
2579
- if (!(error instanceof NoSuchEntityException)) throw error;
2815
+ for (const policyArn of oldSet) if (!newSet.has(policyArn)) {
2816
+ try {
2817
+ await this.iamClient.send(new DetachUserPolicyCommand({
2818
+ UserName: userName,
2819
+ PolicyArn: policyArn
2820
+ }));
2821
+ log.debug(`Detached managed policy ${v(policyArn)} from user ${v(userName)}`);
2822
+ } catch (error) {
2823
+ if (!(error instanceof NoSuchEntityException)) throw error;
2824
+ }
2825
+ recordOwnWriteRemoval(USER_TYPE, userName, "ManagedPolicyArns", policyArn);
2580
2826
  }
2581
2827
  }
2582
2828
  async function updateUserGroups(userName, newGroups, oldGroups, log) {
@@ -2590,14 +2836,17 @@ async function updateUserGroups(userName, newGroups, oldGroups, log) {
2590
2836
  }));
2591
2837
  log.debug(`Added user ${v(userName)} to group ${v(groupName)}`);
2592
2838
  }
2593
- for (const groupName of oldSet) if (!newSet.has(groupName)) try {
2594
- await this.iamClient.send(new RemoveUserFromGroupCommand({
2595
- UserName: userName,
2596
- GroupName: groupName
2597
- }));
2598
- log.debug(`Removed user ${v(userName)} from group ${v(groupName)}`);
2599
- } catch (error) {
2600
- if (!(error instanceof NoSuchEntityException)) throw error;
2839
+ for (const groupName of oldSet) if (!newSet.has(groupName)) {
2840
+ try {
2841
+ await this.iamClient.send(new RemoveUserFromGroupCommand({
2842
+ UserName: userName,
2843
+ GroupName: groupName
2844
+ }));
2845
+ log.debug(`Removed user ${v(userName)} from group ${v(groupName)}`);
2846
+ } catch (error) {
2847
+ if (!(error instanceof NoSuchEntityException)) throw error;
2848
+ }
2849
+ recordOwnWriteRemoval(USER_TYPE, userName, "Groups", groupName);
2601
2850
  }
2602
2851
  }
2603
2852
  async function updateUserInlinePolicies(userName, newPolicies, oldPolicies, log, claimed) {
@@ -2627,6 +2876,7 @@ async function updateUserInlinePolicies(userName, newPolicies, oldPolicies, log,
2627
2876
  } catch (error) {
2628
2877
  if (!(error instanceof NoSuchEntityException)) throw error;
2629
2878
  }
2879
+ recordOwnWriteRemoval(USER_TYPE, userName, "Policies", policyName);
2630
2880
  }
2631
2881
  }
2632
2882
 
@@ -2778,6 +3028,7 @@ async function deleteAllUserInlinePolicies(userName, log, progress) {
2778
3028
  }
2779
3029
 
2780
3030
  // src/provisioning/providers/iam-user-group/group.ts
3031
+ const GROUP_TYPE = "AWS::IAM::Group";
2781
3032
  async function createGroup(logicalId, resourceType, properties, log) {
2782
3033
  const { value: v } = log;
2783
3034
  log.debug(`Creating IAM group ${logicalId}`);
@@ -2865,6 +3116,7 @@ async function createGroup(logicalId, resourceType, properties, log) {
2865
3116
  async function updateGroup(logicalId, physicalId, resourceType, properties, previousProperties, log, claimed) {
2866
3117
  const { value: v } = log;
2867
3118
  log.debug(`Updating IAM group ${logicalId}: ${v(physicalId)}`);
3119
+ clearOwnWriteRemovals(GROUP_TYPE, physicalId);
2868
3120
  try {
2869
3121
  const newPath = iamPathOf(properties["Path"]);
2870
3122
  if (newPath !== iamPathOf(previousProperties["Path"])) {
@@ -2984,6 +3236,7 @@ async function updateGroupManagedPolicies(groupName, newPolicies, oldPolicies, l
2984
3236
  GroupName: groupName,
2985
3237
  PolicyArn: policyArn
2986
3238
  }));
3239
+ recordOwnWriteRemoval(GROUP_TYPE, groupName, "ManagedPolicyArns", policyArn);
2987
3240
  log.debug(`Detached managed policy ${v(policyArn)} from group ${v(groupName)}`);
2988
3241
  }
2989
3242
  }
@@ -3033,6 +3286,7 @@ async function updateGroupInlinePolicies(groupName, newPolicies, oldPolicies, lo
3033
3286
  } catch (error) {
3034
3287
  if (!(error instanceof NoSuchEntityException)) throw error;
3035
3288
  }
3289
+ recordOwnWriteRemoval(GROUP_TYPE, groupName, "Policies", policyName);
3036
3290
  }
3037
3291
  }
3038
3292
 
@@ -3274,6 +3528,7 @@ async function readCurrentState$39(physicalId, logicalId, resourceType, properti
3274
3528
  }
3275
3529
  }
3276
3530
  async function readUserCurrentState(physicalId, properties, context, logicalId = physicalId) {
3531
+ const removed = context?.afterOwnWrite === true ? takeOwnWriteRemovals("AWS::IAM::User", physicalId) : void 0;
3277
3532
  let user;
3278
3533
  try {
3279
3534
  user = (await this.iamClient.send(new GetUserCommand({ UserName: physicalId }))).User;
@@ -3310,7 +3565,7 @@ async function readUserCurrentState(physicalId, properties, context, logicalId =
3310
3565
  managedPolicyArns: async () => ({ value: await reads.managedPolicyArns() }),
3311
3566
  groups: async () => ({ value: await reads.groups() }),
3312
3567
  policies: async () => ({ value: await reads.policies() })
3313
- }), this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::User", key));
3568
+ }, removed), this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::User", key));
3314
3569
  return result;
3315
3570
  }
3316
3571
  function userMemberReads(physicalId, properties, context) {
@@ -3327,6 +3582,7 @@ function userMemberReads(physicalId, properties, context) {
3327
3582
  };
3328
3583
  }
3329
3584
  async function readGroupCurrentState(physicalId, properties, context, logicalId = physicalId) {
3585
+ const removed = context?.afterOwnWrite === true ? takeOwnWriteRemovals("AWS::IAM::Group", physicalId) : void 0;
3330
3586
  let group;
3331
3587
  try {
3332
3588
  group = (await this.iamClient.send(new GetGroupCommand({ GroupName: physicalId }))).Group;
@@ -3356,7 +3612,7 @@ async function readGroupCurrentState(physicalId, properties, context, logicalId
3356
3612
  if (context?.afterOwnWrite === true && properties !== void 0) await settleOwnWriteMembers(result, principalOwnWriteMembers(properties, {
3357
3613
  managedPolicyArns: async () => ({ value: await managedPolicyArns() }),
3358
3614
  policies: async () => ({ value: await policies() })
3359
- }), this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::Group", key));
3615
+ }, removed), this.ownWriteRereadDelaysMs, (key) => warnUnsettledMember(this.logger, logicalId, "AWS::IAM::Group", key));
3360
3616
  return result;
3361
3617
  }
3362
3618
  async function collectInlinePolicies(kind, physicalId, statePolicies, context) {
@@ -8440,6 +8696,56 @@ var SNSTopicProvider = class {
8440
8696
  }
8441
8697
  };
8442
8698
 
8699
+ // src/provisioning/providers/sns-subscription/topic-membership.ts
8700
+ const membershipTiming = { absentRecheckMs: 2e3 };
8701
+ async function confirmTopicMembership(client, topicArn, subscriptionArn, attributes) {
8702
+ const pending = attributes["PendingConfirmation"] === "true" ? {
8703
+ protocol: attributes["Protocol"],
8704
+ endpoint: attributes["Endpoint"]
8705
+ } : void 0;
8706
+ const read = async () => {
8707
+ try {
8708
+ return await readTopicMembership(client, topicArn, subscriptionArn, pending);
8709
+ } catch (err) {
8710
+ const topicAccount = topicArn.split(":")[4];
8711
+ const owner = attributes["Owner"];
8712
+ if (err instanceof AuthorizationErrorException && owner !== void 0 && topicAccount !== void 0 && owner !== topicAccount) return "unconfirmable";
8713
+ throw err;
8714
+ }
8715
+ };
8716
+ let verdict = await read();
8717
+ if (verdict === "absent") {
8718
+ await new Promise((resolve) => setTimeout(resolve, membershipTiming.absentRecheckMs));
8719
+ verdict = await read();
8720
+ }
8721
+ if (verdict === "listed" || verdict === "unconfirmable") return verdict;
8722
+ return "gone";
8723
+ }
8724
+ async function readTopicMembership(client, topicArn, subscriptionArn, pending) {
8725
+ let nextToken;
8726
+ do {
8727
+ let resp;
8728
+ try {
8729
+ resp = await client.send(new ListSubscriptionsByTopicCommand({
8730
+ TopicArn: topicArn,
8731
+ ...nextToken && { NextToken: nextToken }
8732
+ }));
8733
+ } catch (err) {
8734
+ if (err instanceof NotFoundException) return "topic-gone";
8735
+ throw err;
8736
+ }
8737
+ for (const s of resp?.Subscriptions ?? []) {
8738
+ if (s.SubscriptionArn === subscriptionArn) return "listed";
8739
+ if (pending !== void 0 && s.SubscriptionArn === "PendingConfirmation" && s.Protocol === pending.protocol && s.Endpoint !== void 0 && pending.endpoint !== void 0 && maskUrlPassword(s.Endpoint) === maskUrlPassword(pending.endpoint)) return "listed";
8740
+ }
8741
+ nextToken = resp?.NextToken;
8742
+ } while (nextToken);
8743
+ return "absent";
8744
+ }
8745
+ function maskUrlPassword(endpoint) {
8746
+ return endpoint.replace(/^(https?:\/\/[^:/?#@]*:)[^/?#@]*@/i, "$1****@");
8747
+ }
8748
+
8443
8749
  // src/provisioning/providers/sns-subscription-provider.ts
8444
8750
  const SNS_SUBSCRIPTION_DELETE_THREW_REASON = "the Unsubscribe call did not complete, so the old subscription is unproven";
8445
8751
  const CREATE_ONLY_FIELDS = [
@@ -8610,7 +8916,7 @@ var SNSSubscriptionProvider = class {
8610
8916
  logPendingConfirmationSkip(logicalId, physicalId) {
8611
8917
  this.logger.warn(`SNS subscription ${logicalId} (${physicalId}) is pending confirmation and cannot be unsubscribed; skipping deletion to match CloudFormation behavior (the pending record expires automatically within 3 days)`);
8612
8918
  }
8613
- async readCurrentState(physicalId, _logicalId, _resourceType) {
8919
+ async readCurrentState(physicalId, _logicalId, _resourceType, _properties, context) {
8614
8920
  if (physicalId === "PendingConfirmation" || physicalId === "pending confirmation") return;
8615
8921
  let attributes;
8616
8922
  try {
@@ -8620,6 +8926,10 @@ var SNSSubscriptionProvider = class {
8620
8926
  throw err;
8621
8927
  }
8622
8928
  if (!attributes) return void 0;
8929
+ const topicArn = attributes["TopicArn"];
8930
+ if (context?.afterOwnWrite !== true && topicArn) {
8931
+ if (await confirmTopicMembership(this.snsClient, topicArn, physicalId, attributes) === "gone") return RESOURCE_NOT_FOUND;
8932
+ }
8623
8933
  const result = {};
8624
8934
  if (attributes["TopicArn"] !== void 0) result["TopicArn"] = attributes["TopicArn"];
8625
8935
  if (attributes["Protocol"] !== void 0) result["Protocol"] = attributes["Protocol"];
@@ -14153,29 +14463,30 @@ async function deleteTableResource(logicalId, physicalId, resourceType, context,
14153
14463
  this.logger.debug(`Deleting DynamoDB table ${logicalId}: ${physicalId}`);
14154
14464
  const loopLogger = maskedLogger(this.logger, context?.maskSecrets, physicalId);
14155
14465
  const budget = this.deleteBudgets.acquire(deleteBudgetKey(physicalId, context?.expectedRegion), resolveDynamoDbDeleteBudgetMs(), resolveDynamoDbDeleteBudgetClock(), DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS);
14156
- if (context?.removeProtection === true) try {
14157
- let observedProtectionOn = false;
14158
- try {
14159
- observedProtectionOn = (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }))).Table?.DeletionProtectionEnabled === true;
14160
- } catch (observeError) {
14161
- const mask = maskerOrIdentity(context?.maskSecrets);
14162
- this.logger.debug(mask(safeMsg`Could not read DeletionProtectionEnabled on ${mask(physicalId)} before disabling it: ${mask(describeAwsFailure(observeError).detail)}`));
14163
- }
14164
- await this.dynamoDBClient.send(new UpdateTableCommand({
14165
- TableName: physicalId,
14166
- DeletionProtectionEnabled: false
14167
- }));
14168
- if (observedProtectionOn) flip.flippedOffByThisRun = true;
14169
- this.logger.debug(`Disabled DeletionProtectionEnabled on DynamoDB table ${logicalId}, waiting for ACTIVE`);
14170
- try {
14171
- await this.waitForTableActiveAfterUpdate(physicalId, 60, budget);
14172
- } catch (waitErr) {
14173
- this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not wait for table ${physicalId} ACTIVE after disabling protection: ${describeAwsFailure(waitErr).detail}`));
14174
- }
14175
- } catch (flipError) {
14176
- if (!(flipError instanceof ResourceNotFoundException$1)) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable DeletionProtectionEnabled on ${physicalId}: ${describeAwsFailure(flipError).detail}`));
14177
- }
14178
14466
  try {
14467
+ const identityRead = await readRecordedTableIdentity.call(this, logicalId, physicalId, resourceType, context);
14468
+ if (context?.removeProtection === true) try {
14469
+ let observedProtectionOn = false;
14470
+ try {
14471
+ observedProtectionOn = (identityRead ?? await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }))).Table?.DeletionProtectionEnabled === true;
14472
+ } catch (observeError) {
14473
+ const mask = maskerOrIdentity(context?.maskSecrets);
14474
+ this.logger.debug(mask(safeMsg`Could not read DeletionProtectionEnabled on ${mask(physicalId)} before disabling it: ${mask(describeAwsFailure(observeError).detail)}`));
14475
+ }
14476
+ await this.dynamoDBClient.send(new UpdateTableCommand({
14477
+ TableName: physicalId,
14478
+ DeletionProtectionEnabled: false
14479
+ }));
14480
+ if (observedProtectionOn) flip.flippedOffByThisRun = true;
14481
+ this.logger.debug(`Disabled DeletionProtectionEnabled on DynamoDB table ${logicalId}, waiting for ACTIVE`);
14482
+ try {
14483
+ await this.waitForTableActiveAfterUpdate(physicalId, 60, budget);
14484
+ } catch (waitErr) {
14485
+ this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not wait for table ${physicalId} ACTIVE after disabling protection: ${describeAwsFailure(waitErr).detail}`));
14486
+ }
14487
+ } catch (flipError) {
14488
+ if (!(flipError instanceof ResourceNotFoundException$1)) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable DeletionProtectionEnabled on ${physicalId}: ${describeAwsFailure(flipError).detail}`));
14489
+ }
14179
14490
  const reArmPolls = () => {
14180
14491
  const wait = beginDeleteWait(900, budget);
14181
14492
  return {
@@ -14230,6 +14541,13 @@ async function deleteTableResource(logicalId, physicalId, resourceType, context,
14230
14541
  this.deleteBudgets.release(deleteBudgetKey(physicalId, context?.expectedRegion));
14231
14542
  this.protectionFlips.release(deleteBudgetKey(physicalId, context?.expectedRegion));
14232
14543
  } catch (error) {
14544
+ if (error instanceof RecordedIdentityError) {
14545
+ if (flip.flippedOffByThisRun && !flip.deleteAccepted) {
14546
+ flip.flippedOffByThisRun = false;
14547
+ this.logger.warn(safeMsg`DynamoDB table ${logicalId}: an earlier attempt of this delete turned its deletion protection off, ` + "and cdkd did not turn it back on because it cannot confirm the DynamoDB table now under the name is the one it recorded; check the deletion protection of the one you keep.");
14548
+ }
14549
+ throw error;
14550
+ }
14233
14551
  if (error instanceof ResourceNotFoundException$1) {
14234
14552
  const clientRegion = await this.dynamoDBClient.config.region();
14235
14553
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
@@ -14244,6 +14562,24 @@ async function deleteTableResource(logicalId, physicalId, resourceType, context,
14244
14562
  throw error instanceof Error && error.name.includes("NotFound") ? markNotGone(thrown) : thrown;
14245
14563
  }
14246
14564
  }
14565
+ async function readRecordedTableIdentity(logicalId, physicalId, resourceType, context) {
14566
+ if (recordedIdentityId(resourceType, context) === void 0) return void 0;
14567
+ let latest = await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }));
14568
+ await assertRecordedIdentity({
14569
+ label: "DynamoDB table",
14570
+ replacedBy: "a restore from a backup or to a point in time under the same table name",
14571
+ resourceType,
14572
+ logicalId,
14573
+ physicalId,
14574
+ liveId: latest.Table?.TableId,
14575
+ reread: async () => {
14576
+ latest = await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }));
14577
+ return latest.Table?.TableId;
14578
+ },
14579
+ context
14580
+ });
14581
+ return latest;
14582
+ }
14247
14583
 
14248
14584
  // src/provisioning/providers/dynamodb-table/drift.ts
14249
14585
  function getDriftUnorderedPaths$7(resourceType) {
@@ -16147,6 +16483,12 @@ function assertUsableRetention(raw, coerced, logicalId, resourceType) {
16147
16483
  if (detail === void 0) return;
16148
16484
  throw new ProvisioningError(`${logicalId} (${resourceType}): RetentionInDays must be a positive CloudFormation Integer (optional sign then decimal digits, as a number or a string — 30 or '30'); ${detail}`, resourceType, logicalId);
16149
16485
  }
16486
+ function logGroupIdentityToken(group) {
16487
+ return group.creationTime === void 0 ? void 0 : `${group.arn}@${group.creationTime}`;
16488
+ }
16489
+ function listedCreationTime(created) {
16490
+ return typeof created === "number" && Number.isSafeInteger(created) && created > 0 ? created : void 0;
16491
+ }
16150
16492
 
16151
16493
  // src/provisioning/providers/logs-loggroup/own-replay.ts
16152
16494
  const createLogGroupLatch = new AmbiguousCreateLatch("CreateLogGroup");
@@ -16279,7 +16621,7 @@ async function create$33(logicalId, resourceType, properties, context) {
16279
16621
  this.logger.debug(`Successfully created log group ${logicalId}: ${logGroupName}`);
16280
16622
  return {
16281
16623
  physicalId: logGroupName,
16282
- attributes: { Arn: await this.buildArn(logGroupName) }
16624
+ attributes: await this.createdAttributes(logGroupName)
16283
16625
  };
16284
16626
  } catch (error) {
16285
16627
  const cause = error instanceof Error ? error : void 0;
@@ -16425,10 +16767,19 @@ async function applyUpdate$4(logicalId, physicalId, resourceType, properties, pr
16425
16767
  return {
16426
16768
  physicalId,
16427
16769
  wasReplaced: false,
16428
- attributes: { Arn: await this.buildArn(physicalId) }
16770
+ attributes: await this.createdAttributes(physicalId)
16429
16771
  };
16430
16772
  }
16431
16773
 
16774
+ // src/provisioning/identity-read-denied.ts
16775
+ function deniedIdentityReadRefusal(error, params) {
16776
+ if (!isAccessDeniedError(error)) return void 0;
16777
+ const { label, permission, resourceType, logicalId, physicalId, context } = params;
16778
+ const name = error.name;
16779
+ const errorClass = typeof name === "string" && /^[A-Za-z0-9]{1,64}$/.test(name) ? name : "a 403";
16780
+ return markNotGone(markNonRetryable(new RecordedIdentityError(`Cannot delete ${label} ${logicalId}: AWS refused the ${permission} read cdkd makes to confirm it is the one cdkd created (${errorClass}), so cdkd sent no delete and kept the record. Grant ${permission} to the identity running cdkd and re-run, or, to stop managing it without deleting it, drop the record with ${stateOrphanRecordRemedy(context, logicalId)}.`, resourceType, logicalId, physicalId)));
16781
+ }
16782
+
16432
16783
  // src/provisioning/providers/logs-loggroup/delete.ts
16433
16784
  async function deleteImpl$33(logicalId, physicalId, resourceType, _properties, context) {
16434
16785
  await deleteWithProtectionCompensation({
@@ -16451,6 +16802,39 @@ async function deleteImpl$33(logicalId, physicalId, resourceType, _properties, c
16451
16802
  }
16452
16803
  async function deleteOnce$2(logicalId, physicalId, resourceType, context, flip) {
16453
16804
  this.logger.debug(`Deleting log group ${logicalId}: ${physicalId}`);
16805
+ let identityRead;
16806
+ if (recordedIdentityId(resourceType, context) !== void 0) {
16807
+ const read = async () => {
16808
+ identityRead = await this.readIdentityIfExists(physicalId);
16809
+ return identityRead;
16810
+ };
16811
+ try {
16812
+ const first = await read();
16813
+ if (first !== void 0) await assertRecordedIdentity({
16814
+ label: "log group",
16815
+ resourceType,
16816
+ logicalId,
16817
+ physicalId,
16818
+ liveId: logGroupIdentityToken(first),
16819
+ reread: async () => {
16820
+ const again = await read();
16821
+ return again === void 0 ? void 0 : logGroupIdentityToken(again);
16822
+ },
16823
+ context,
16824
+ recreatedBy: "for example Lambda writing to its /aws/lambda/<function> group"
16825
+ });
16826
+ } catch (error) {
16827
+ if (error instanceof RecordedIdentityError) throw error;
16828
+ throw deniedIdentityReadRefusal(error, {
16829
+ label: "log group",
16830
+ permission: "logs:DescribeLogGroups",
16831
+ resourceType,
16832
+ logicalId,
16833
+ physicalId,
16834
+ context
16835
+ }) ?? this.wrapDeleteError(logicalId, physicalId, resourceType, context, error);
16836
+ }
16837
+ }
16454
16838
  if (context?.removeProtection === true) try {
16455
16839
  await observeThenDisableProtection({
16456
16840
  flip,
@@ -16459,6 +16843,7 @@ async function deleteOnce$2(logicalId, physicalId, resourceType, context, flip)
16459
16843
  mask: context?.maskSecrets,
16460
16844
  guardName: "DeletionProtectionEnabled",
16461
16845
  observe: async () => {
16846
+ if (identityRead !== void 0) return identityRead.deletionProtectionEnabled;
16462
16847
  return ((await this.logsClient.send(new DescribeLogGroupsCommand({ logGroupNamePrefix: physicalId }))).logGroups?.find((g) => g.logGroupName === physicalId))?.deletionProtectionEnabled === true;
16463
16848
  },
16464
16849
  disable: async () => {
@@ -16483,11 +16868,14 @@ async function deleteOnce$2(logicalId, physicalId, resourceType, context, flip)
16483
16868
  this.logGoneOnDelete(logicalId, physicalId, context);
16484
16869
  return;
16485
16870
  }
16486
- const cause = error instanceof Error ? error : void 0;
16487
- const thrown = this.wrapCaughtError(maskerOrIdentity(context?.maskSecrets), error, (text) => new ProvisioningError(`Failed to delete log group ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
16488
- throw error instanceof Error && error.name.includes("NotFound") ? markNotGone(thrown) : thrown;
16871
+ throw this.wrapDeleteError(logicalId, physicalId, resourceType, context, error);
16489
16872
  }
16490
16873
  }
16874
+ function wrapDeleteError$5(logicalId, physicalId, resourceType, context, error) {
16875
+ const cause = error instanceof Error ? error : void 0;
16876
+ const thrown = this.wrapCaughtError(maskerOrIdentity(context?.maskSecrets), error, (text) => new ProvisioningError(`Failed to delete log group ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
16877
+ return error instanceof Error && error.name.includes("NotFound") ? markNotGone(thrown) : thrown;
16878
+ }
16491
16879
  function logGoneOnDelete(logicalId, physicalId, context) {
16492
16880
  if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Log group ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
16493
16881
  else this.logger.debug(`Log group ${physicalId} does not exist, skipping deletion`);
@@ -16511,8 +16899,21 @@ async function resourceIdentity$3(physicalId, resourceType, context) {
16511
16899
  if (await this.logsClient.config.region() !== context.expectedRegion) return void 0;
16512
16900
  const group = await this.readIdentityIfExists(physicalId);
16513
16901
  if (group === void 0) return RESOURCE_NOT_FOUND;
16514
- if (group.creationTime === void 0) return void 0;
16515
- return `${group.arn}@${group.creationTime}`;
16902
+ return logGroupIdentityToken(group);
16903
+ }
16904
+ async function createdAttributes(name) {
16905
+ let group;
16906
+ try {
16907
+ group = await this.readIdentityIfExists(name);
16908
+ } catch (error) {
16909
+ this.logger.debug(safeMsg`Could not read log group identity after writing it: ${describeAwsFailure(error).summary}`);
16910
+ }
16911
+ const listedArn = group === void 0 ? void 0 : `${group.arn}:*`;
16912
+ const arn = listedArn !== void 0 && listedArn.endsWith(`:log-group:${name}:*`) ? listedArn : await this.buildArn(name);
16913
+ return {
16914
+ Arn: arn,
16915
+ ...definedAttributes({ LogGroupIdentity: group !== void 0 && listedArn === arn ? logGroupIdentityToken(group) : void 0 })
16916
+ };
16516
16917
  }
16517
16918
  async function readIdentityIfExists(name) {
16518
16919
  let found;
@@ -16527,10 +16928,10 @@ async function readIdentityIfExists(name) {
16527
16928
  if (found === void 0) return void 0;
16528
16929
  const arn = found.logGroupArn;
16529
16930
  if (typeof arn !== "string" || arn === "") throw new Error("CloudWatch Logs returned no logGroupArn");
16530
- const created = found.creationTime;
16531
16931
  return {
16532
16932
  arn,
16533
- creationTime: typeof created === "number" && Number.isSafeInteger(created) && created > 0 ? created : void 0
16933
+ creationTime: listedCreationTime(found.creationTime),
16934
+ deletionProtectionEnabled: found.deletionProtectionEnabled === true
16534
16935
  };
16535
16936
  }
16536
16937
  async function buildArn(logGroupName) {
@@ -16614,10 +17015,17 @@ async function readCurrentState$33(physicalId, logicalId, _resourceType, propert
16614
17015
  async function importImpl$33(input) {
16615
17016
  const explicit = resolveExplicitPhysicalId(input, "LogGroupName");
16616
17017
  if (explicit) try {
16617
- return (await this.logsClient.send(new DescribeLogGroupsCommand({ logGroupNamePrefix: explicit }))).logGroups?.find((g) => g.logGroupName === explicit) ? {
17018
+ const found = (await this.logsClient.send(new DescribeLogGroupsCommand({ logGroupNamePrefix: explicit }))).logGroups?.find((g) => g.logGroupName === explicit);
17019
+ if (!found) return null;
17020
+ const arn = found.logGroupArn;
17021
+ return {
16618
17022
  physicalId: explicit,
16619
- attributes: {}
16620
- } : null;
17023
+ attributes: definedAttributes({ LogGroupIdentity: typeof arn === "string" && arn !== "" ? logGroupIdentityToken({
17024
+ arn,
17025
+ creationTime: listedCreationTime(found.creationTime),
17026
+ deletionProtectionEnabled: found.deletionProtectionEnabled === true
17027
+ }) : void 0 })
17028
+ };
16621
17029
  } catch (err) {
16622
17030
  if (err instanceof ResourceNotFoundException$5) return null;
16623
17031
  throw err;
@@ -16679,6 +17087,9 @@ var LogsLogGroupProvider = class {
16679
17087
  logGoneOnDelete(logicalId, physicalId, context) {
16680
17088
  return logGoneOnDelete.call(this, logicalId, physicalId, context);
16681
17089
  }
17090
+ wrapDeleteError(logicalId, physicalId, resourceType, context, error) {
17091
+ return wrapDeleteError$5.call(this, logicalId, physicalId, resourceType, context, error);
17092
+ }
16682
17093
  isSameResource(journaledPhysicalId, record, resourceType, context) {
16683
17094
  return isSameResource$7.call(this, journaledPhysicalId, record, resourceType, context);
16684
17095
  }
@@ -16688,6 +17099,9 @@ var LogsLogGroupProvider = class {
16688
17099
  readIdentityIfExists(name) {
16689
17100
  return readIdentityIfExists.call(this, name);
16690
17101
  }
17102
+ createdAttributes(name) {
17103
+ return createdAttributes.call(this, name);
17104
+ }
16691
17105
  buildArn(logGroupName) {
16692
17106
  return buildArn.call(this, logGroupName);
16693
17107
  }
@@ -22364,6 +22778,10 @@ async function applyInlineEgress(groupId, egressRules) {
22364
22778
  this.logger.debug(`SecurityGroup ${groupId} egress equals the AWS default allow-all rule; skipping the redundant revoke + re-authorize`);
22365
22779
  return;
22366
22780
  }
22781
+ const defaultEgress = {
22782
+ IpProtocol: "-1",
22783
+ CidrIp: "0.0.0.0/0"
22784
+ };
22367
22785
  try {
22368
22786
  await this.ec2Client.send(new RevokeSecurityGroupEgressCommand({
22369
22787
  GroupId: groupId,
@@ -22372,8 +22790,10 @@ async function applyInlineEgress(groupId, egressRules) {
22372
22790
  IpRanges: [{ CidrIp: "0.0.0.0/0" }]
22373
22791
  }]
22374
22792
  }));
22793
+ noteRevokedRule(groupId, defaultEgress, "egress");
22375
22794
  } catch (error) {
22376
22795
  if (!this.isNotFoundError(error)) throw error;
22796
+ noteRevokedRule(groupId, defaultEgress, "egress");
22377
22797
  }
22378
22798
  if (egressRules.length === 0) return;
22379
22799
  await this.ec2Client.send(new AuthorizeSecurityGroupEgressCommand({
@@ -22384,6 +22804,7 @@ async function applyInlineEgress(groupId, egressRules) {
22384
22804
  async function updateSecurityGroup(logicalId, physicalId, resourceType, properties, previousProperties, context) {
22385
22805
  this.logger.debug(`Updating SecurityGroup ${logicalId}: ${physicalId}`);
22386
22806
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
22807
+ clearOwnWriteRemovals(SECURITY_GROUP_TYPE, physicalId);
22387
22808
  if (context?.desiredFromAwsReadback === true && (context.siblingSgRuleIds?.size ?? 0) > 0) await refuseRevertRevokingSiblingRules((group) => this.listGroupRules(group), logicalId, physicalId, resourceType, properties, previousProperties, context.siblingSgRuleIds);
22388
22809
  try {
22389
22810
  await this.applyTagDiff(physicalId, resourceType, logicalId, previousProperties["Tags"], properties["Tags"], maskerOrIdentity(context?.maskSecrets));
@@ -22521,6 +22942,18 @@ function buildIpPermission(properties, direction = "ingress", inline = false) {
22521
22942
  }
22522
22943
  return permission;
22523
22944
  }
22945
+ const SECURITY_GROUP_TYPE = "AWS::EC2::SecurityGroup";
22946
+ function noteRevokedRule(groupId, rule, direction, revoked) {
22947
+ let key = sgRemovalRuleKey(rule, direction);
22948
+ const referenced = revoked?.length === 1 ? revoked[0]?.ReferencedGroupId : void 0;
22949
+ if (key === void 0 && direction === "ingress" && referenced !== void 0) key = sgRemovalRuleKey({
22950
+ ...rule,
22951
+ SourceSecurityGroupName: void 0,
22952
+ SourceSecurityGroupId: referenced
22953
+ }, direction);
22954
+ if (key === void 0) return;
22955
+ recordOwnWriteRemoval(SECURITY_GROUP_TYPE, groupId, direction === "egress" ? "SecurityGroupEgress" : "SecurityGroupIngress", key);
22956
+ }
22524
22957
  async function applySecurityGroupRuleDiff(groupId, previousRules, nextRules, direction, logicalId) {
22525
22958
  const ruleKey = (rule) => sgRuleDiffKey(rule, direction);
22526
22959
  const prevByKey = /* @__PURE__ */ new Map();
@@ -22545,16 +22978,16 @@ async function applySecurityGroupRuleDiff(groupId, previousRules, nextRules, dir
22545
22978
  }
22546
22979
  }
22547
22980
  try {
22548
- if (direction === "egress") await this.ec2Client.send(new RevokeSecurityGroupEgressCommand({
22981
+ noteRevokedRule(groupId, rule, direction, (direction === "egress" ? await this.ec2Client.send(new RevokeSecurityGroupEgressCommand({
22549
22982
  GroupId: groupId,
22550
22983
  IpPermissions: [this.buildIpPermission(rule, "egress")]
22551
- }));
22552
- else await this.ec2Client.send(new RevokeSecurityGroupIngressCommand({
22984
+ })) : await this.ec2Client.send(new RevokeSecurityGroupIngressCommand({
22553
22985
  GroupId: groupId,
22554
22986
  IpPermissions: [this.buildIpPermission(rule, "ingress", true)]
22555
- }));
22987
+ })))?.RevokedSecurityGroupRules);
22556
22988
  } catch (error) {
22557
22989
  if (!this.isNotFoundError(error)) throw error;
22990
+ noteRevokedRule(groupId, rule, direction);
22558
22991
  }
22559
22992
  }
22560
22993
  for (const rule of toDescribe) {
@@ -25439,8 +25872,12 @@ async function readRouteTableCurrentState(physicalId) {
25439
25872
  return result;
25440
25873
  }
25441
25874
  async function readSecurityGroupCurrentState(physicalId, properties, context) {
25875
+ const removed = context?.afterOwnWrite === true ? takeOwnWriteRemovals("AWS::EC2::SecurityGroup", physicalId) : void 0;
25442
25876
  const sg = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [physicalId] }))).SecurityGroups?.[0];
25443
- if (!sg) return RESOURCE_NOT_FOUND;
25877
+ if (!sg) {
25878
+ if (removed !== void 0) restoreOwnWriteRemovals("AWS::EC2::SecurityGroup", physicalId, removed);
25879
+ return RESOURCE_NOT_FOUND;
25880
+ }
25444
25881
  const idOwned = await siblingIdOwnedSgRules(this, physicalId, properties, context);
25445
25882
  const result = {};
25446
25883
  if (sg.GroupName !== void 0) result["GroupName"] = sg.GroupName;
@@ -25452,18 +25889,14 @@ async function readSecurityGroupCurrentState(physicalId, properties, context) {
25452
25889
  if (context?.afterOwnWrite === true && properties !== void 0) {
25453
25890
  const members = [];
25454
25891
  for (const [key, direction] of [["SecurityGroupIngress", "ingress"], ["SecurityGroupEgress", "egress"]]) {
25455
- const declared = properties[key];
25456
- if (!Array.isArray(declared)) continue;
25457
- members.push({
25458
- key,
25459
- declared,
25460
- matches: (value) => declaredSgRulesRead(value, declared, direction),
25461
- whenUnsettled: (newest) => reconcileSgRules(mergeDeclaredSgRules(newest, declared, direction), declared, direction),
25462
- read: async () => {
25463
- const group = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [physicalId] }))).SecurityGroups?.[0];
25464
- return group ? { value: sgRuleLists(group, physicalId, properties, context, idOwned)[key] } : "failed";
25465
- }
25466
- });
25892
+ const listed = properties[key];
25893
+ const revoked = removed?.get(key);
25894
+ if (!Array.isArray(listed) && (revoked?.size ?? 0) === 0) continue;
25895
+ const declared = Array.isArray(listed) ? listed : [];
25896
+ members.push(sgRuleListMember(key, direction, declared, revoked, (rules) => reconcileSgRules(rules, declared, direction), async () => {
25897
+ const group = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [physicalId] }))).SecurityGroups?.[0];
25898
+ return group ? { value: sgRuleLists(group, physicalId, properties, context, idOwned)[key] } : "failed";
25899
+ }));
25467
25900
  }
25468
25901
  await settleOwnWriteMembers(result, members, OWN_WRITE_REREAD_DELAYS_MS, (key) => warnUnsettledMember(this.logger, physicalId, "AWS::EC2::SecurityGroup", key));
25469
25902
  }
@@ -32330,7 +32763,8 @@ async function update$27(logicalId, physicalId, resourceType, properties, previo
32330
32763
  attributes: {
32331
32764
  Arn: physicalId,
32332
32765
  Name: describeResponse.name,
32333
- StateMachineRevisionId: stateMachineRevisionId(describeResponse)
32766
+ StateMachineRevisionId: stateMachineRevisionId(describeResponse),
32767
+ ...definedAttributes({ CreationDate: identityTimestamp(describeResponse.creationDate) })
32334
32768
  }
32335
32769
  };
32336
32770
  } catch (error) {
@@ -32417,7 +32851,8 @@ async function importImpl$26(input) {
32417
32851
  attributes: definedAttributes({
32418
32852
  Arn: input.knownPhysicalId,
32419
32853
  Name: resp.name,
32420
- StateMachineRevisionId: stateMachineRevisionId(resp)
32854
+ StateMachineRevisionId: stateMachineRevisionId(resp),
32855
+ CreationDate: identityTimestamp(resp.creationDate)
32421
32856
  })
32422
32857
  };
32423
32858
  } catch (err) {
@@ -32491,8 +32926,11 @@ var StepFunctionsProvider = class {
32491
32926
  this.logger.debug(`Successfully created Step Functions state machine ${logicalId}: ${stateMachineArn}`);
32492
32927
  const name = stateMachineArn.split(":").pop() || stateMachineName;
32493
32928
  let revisionId;
32929
+ let creationDate;
32494
32930
  try {
32495
- revisionId = stateMachineRevisionId(await this.getClient().send(new DescribeStateMachineCommand({ stateMachineArn })));
32931
+ const described = await this.getClient().send(new DescribeStateMachineCommand({ stateMachineArn }));
32932
+ revisionId = stateMachineRevisionId(described);
32933
+ creationDate = described.creationDate;
32496
32934
  } catch (describeError) {
32497
32935
  this.logger.debug(`Could not read the revision id of ${logicalId} after create: ${describeAwsFailure(describeError).detail}`);
32498
32936
  }
@@ -32501,7 +32939,8 @@ var StepFunctionsProvider = class {
32501
32939
  attributes: definedAttributes({
32502
32940
  Arn: stateMachineArn,
32503
32941
  Name: name,
32504
- StateMachineRevisionId: revisionId
32942
+ StateMachineRevisionId: revisionId,
32943
+ CreationDate: identityTimestamp(creationDate)
32505
32944
  })
32506
32945
  };
32507
32946
  } catch (error) {
@@ -32523,9 +32962,33 @@ var StepFunctionsProvider = class {
32523
32962
  async delete(logicalId, physicalId, resourceType, _properties, context) {
32524
32963
  this.logger.debug(`Deleting Step Functions state machine ${logicalId}: ${physicalId}`);
32525
32964
  try {
32965
+ if (recordedIdentityId(resourceType, context) !== void 0) {
32966
+ const readCreationDate = async () => identityTimestamp((await this.getClient().send(new DescribeStateMachineCommand({ stateMachineArn: physicalId }))).creationDate);
32967
+ try {
32968
+ await assertRecordedIdentity({
32969
+ label: "Step Functions state machine",
32970
+ resourceType,
32971
+ logicalId,
32972
+ physicalId,
32973
+ liveId: await readCreationDate(),
32974
+ reread: readCreationDate,
32975
+ context
32976
+ });
32977
+ } catch (readError) {
32978
+ throw deniedIdentityReadRefusal(readError, {
32979
+ label: "Step Functions state machine",
32980
+ permission: "states:DescribeStateMachine",
32981
+ resourceType,
32982
+ logicalId,
32983
+ physicalId,
32984
+ context
32985
+ }) ?? readError;
32986
+ }
32987
+ }
32526
32988
  await this.getClient().send(new DeleteStateMachineCommand({ stateMachineArn: physicalId }));
32527
32989
  this.logger.debug(`Successfully deleted Step Functions state machine ${logicalId}`);
32528
32990
  } catch (error) {
32991
+ if (error instanceof RecordedIdentityError) throw error;
32529
32992
  if (error instanceof StateMachineDoesNotExist) {
32530
32993
  const clientRegion = await this.getClient().config.region();
32531
32994
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
@@ -32612,6 +33075,18 @@ var StepFunctionsProvider = class {
32612
33075
  const resp = await this.getClient().send(new DescribeStateMachineCommand({ stateMachineArn: physicalId }));
32613
33076
  return resp.creationDate instanceof Date ? resp.creationDate.getTime() : void 0;
32614
33077
  }
33078
+ async resourceIdentity(physicalId, resourceType, context) {
33079
+ if (resourceType !== "AWS::StepFunctions::StateMachine") return void 0;
33080
+ if (!/^arn:[^:]+:states:[^:]+:\d{12}:stateMachine:[^:]+$/.test(physicalId)) return void 0;
33081
+ if (await this.getClient().config.region() !== context.expectedRegion) return void 0;
33082
+ try {
33083
+ const resp = await this.getClient().send(new DescribeStateMachineCommand({ stateMachineArn: physicalId }));
33084
+ return identityTimestamp(resp.creationDate);
33085
+ } catch (error) {
33086
+ if (error instanceof StateMachineDoesNotExist) return RESOURCE_NOT_FOUND;
33087
+ throw error;
33088
+ }
33089
+ }
32615
33090
  import(input) {
32616
33091
  return importImpl$26.call(this, input);
32617
33092
  }
@@ -64564,6 +65039,7 @@ var ECRProvider = class {
64564
65039
  const desiredTags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
64565
65040
  const repositoryName = properties["RepositoryName"] || generatedNameFor("AWS::ECR::Repository", logicalId);
64566
65041
  let repositoryCreated = false;
65042
+ let createdAt;
64567
65043
  try {
64568
65044
  const tags = properties["Tags"] !== void 0 && properties["Tags"] !== null ? desiredTags : void 0;
64569
65045
  const scanningConfig = this.toSdkScanningConfig(properties["ImageScanningConfiguration"]);
@@ -64578,8 +65054,9 @@ var ECRProvider = class {
64578
65054
  ...tags ? { tags } : {}
64579
65055
  }));
64580
65056
  repositoryCreated = true;
64581
- reportCreatedResource(logicalId, resourceType, repositoryName);
64582
65057
  const repo = response.repository;
65058
+ createdAt = identityTimestamp(repo?.createdAt);
65059
+ reportCreatedResource(logicalId, resourceType, repositoryName, createdAt);
64583
65060
  if (!repo?.repositoryName) throw new Error("CreateRepository did not return repository name");
64584
65061
  const lifecyclePolicy = properties["LifecyclePolicy"];
64585
65062
  if (lifecyclePolicy?.LifecyclePolicyText) {
@@ -64603,14 +65080,15 @@ var ECRProvider = class {
64603
65080
  physicalId: repo.repositoryName,
64604
65081
  attributes: definedAttributes({
64605
65082
  Arn: repo.repositoryArn,
64606
- RepositoryUri: repo.repositoryUri
65083
+ RepositoryUri: repo.repositoryUri,
65084
+ CreatedAt: createdAt
64607
65085
  })
64608
65086
  };
64609
65087
  } catch (error) {
64610
65088
  if (repositoryCreated) markAuxiliaryFailure(error, logicalId);
64611
65089
  const cause = error instanceof Error ? error : void 0;
64612
65090
  const thrown = this.wrapCaughtError(maskerOrIdentity(context?.maskSecrets), error, (text) => new ProvisioningError(`Failed to create ECR Repository ${logicalId}: ${text}`, resourceType, logicalId, repositoryName, cause));
64613
- if (repositoryCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, repositoryName);
65091
+ if (repositoryCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, repositoryName, createdAt);
64614
65092
  throw thrown;
64615
65093
  }
64616
65094
  }
@@ -64700,7 +65178,8 @@ var ECRProvider = class {
64700
65178
  wasReplaced: false,
64701
65179
  attributes: definedAttributes({
64702
65180
  Arn: repo?.repositoryArn,
64703
- RepositoryUri: repo?.repositoryUri
65181
+ RepositoryUri: repo?.repositoryUri,
65182
+ CreatedAt: identityTimestamp(repo?.createdAt)
64704
65183
  })
64705
65184
  };
64706
65185
  } catch (error) {
@@ -64720,6 +65199,32 @@ var ECRProvider = class {
64720
65199
  this.logger.debug(`Deleting ECR Repository ${logicalId}: ${physicalId}`);
64721
65200
  const force = context?.forceDataDelete === true || isTruthyCfnBoolean(properties?.["EmptyOnDelete"]) || hasCdkAutoDeleteTag(properties, "aws-cdk:auto-delete-images");
64722
65201
  try {
65202
+ if (recordedIdentityId(resourceType, context) !== void 0) {
65203
+ const readCreatedAt = async () => {
65204
+ const repo = (await this.getClient().send(new DescribeRepositoriesCommand({ repositoryNames: [physicalId] }))).repositories?.[0];
65205
+ return repo?.repositoryName === physicalId ? identityTimestamp(repo.createdAt) : void 0;
65206
+ };
65207
+ try {
65208
+ await assertRecordedIdentity({
65209
+ label: "ECR repository",
65210
+ resourceType,
65211
+ logicalId,
65212
+ physicalId,
65213
+ liveId: await readCreatedAt(),
65214
+ reread: readCreatedAt,
65215
+ context
65216
+ });
65217
+ } catch (readError) {
65218
+ throw deniedIdentityReadRefusal(readError, {
65219
+ label: "ECR repository",
65220
+ permission: "ecr:DescribeRepositories",
65221
+ resourceType,
65222
+ logicalId,
65223
+ physicalId,
65224
+ context
65225
+ }) ?? readError;
65226
+ }
65227
+ }
64723
65228
  if (force) this.logger.debug(`Force-deleting ECR Repository ${logicalId} (empty-on-delete opt-in present)`);
64724
65229
  await this.getClient().send(new DeleteRepositoryCommand({
64725
65230
  repositoryName: physicalId,
@@ -64727,6 +65232,7 @@ var ECRProvider = class {
64727
65232
  }));
64728
65233
  this.logger.debug(`Successfully deleted ECR Repository ${logicalId}`);
64729
65234
  } catch (error) {
65235
+ if (error instanceof RecordedIdentityError) throw error;
64730
65236
  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);
64731
65237
  if (error instanceof RepositoryNotFoundException) {
64732
65238
  const clientRegion = await this.getClient().config.region();
@@ -64756,12 +65262,24 @@ var ECRProvider = class {
64756
65262
  RepositoryPolicyText: parsed
64757
65263
  };
64758
65264
  }
65265
+ async resourceIdentity(physicalId, resourceType, context) {
65266
+ if (resourceType !== "AWS::ECR::Repository" || physicalId === "") return void 0;
65267
+ if (await this.getClient().config.region() !== context.expectedRegion) return void 0;
65268
+ try {
65269
+ const repo = (await this.getClient().send(new DescribeRepositoriesCommand({ repositoryNames: [physicalId] }))).repositories?.[0];
65270
+ return repo?.repositoryName === physicalId ? identityTimestamp(repo.createdAt) : void 0;
65271
+ } catch (error) {
65272
+ if (error instanceof RepositoryNotFoundException) return RESOURCE_NOT_FOUND;
65273
+ throw error;
65274
+ }
65275
+ }
64759
65276
  async import(input) {
64760
65277
  const explicit = resolveExplicitPhysicalId(input, "RepositoryName");
64761
65278
  if (explicit) try {
64762
- return (await this.getClient().send(new DescribeRepositoriesCommand({ repositoryNames: [explicit] }))).repositories?.[0]?.repositoryName ? {
65279
+ const repo = (await this.getClient().send(new DescribeRepositoriesCommand({ repositoryNames: [explicit] }))).repositories?.[0];
65280
+ return repo?.repositoryName ? {
64763
65281
  physicalId: explicit,
64764
- attributes: {}
65282
+ attributes: definedAttributes({ CreatedAt: identityTimestamp(repo.createdAt) })
64765
65283
  } : null;
64766
65284
  } catch (err) {
64767
65285
  if (err instanceof RepositoryNotFoundException) return null;
@@ -65306,10 +65824,15 @@ var WaitConditionProvider = class {
65306
65824
  return 435e5;
65307
65825
  }
65308
65826
  async create(logicalId, _resourceType, properties) {
65827
+ const physicalId = `cdkd-wait-condition-${logicalId}-${randomUUID()}`;
65828
+ if (properties["Handle"] === void 0 || properties["Handle"] === null) return {
65829
+ physicalId,
65830
+ attributes: { Data: "{}" }
65831
+ };
65309
65832
  const spec = this.readSpec(logicalId, properties);
65310
65833
  const data = await this.waitForSignals(logicalId, spec);
65311
65834
  return {
65312
- physicalId: `cdkd-wait-condition-${logicalId}-${randomUUID()}`,
65835
+ physicalId,
65313
65836
  attributes: { Data: JSON.stringify(data) }
65314
65837
  };
65315
65838
  }
@@ -65887,4 +66410,4 @@ var ACMCertificateProvider = class {
65887
66410
  };
65888
66411
 
65889
66412
  export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppConfigEnvironmentProvider, 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, EventBridgeArchiveProvider, 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, LogsDeliveryDestinationProvider, LogsDeliveryProvider, LogsDeliverySourceProvider, 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, WaitConditionProvider };
65890
- //# sourceMappingURL=provider-classes-Bkb_H0Sp.js.map
66413
+ //# sourceMappingURL=provider-classes-CpwN6g8B.js.map