@go-to-k/cdkd 0.299.8 → 0.300.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 (29) hide show
  1. package/dist/{asg-provider-ebjf5E8o.js → asg-provider-COcKVcvZ.js} +3 -3
  2. package/dist/{asg-provider-ebjf5E8o.js.map → asg-provider-COcKVcvZ.js.map} +1 -1
  3. package/dist/{aws-clients-Bj7qH5Ph.js → aws-clients-B_CEQGE1.js} +21 -1
  4. package/dist/aws-clients-B_CEQGE1.js.map +1 -0
  5. package/dist/cli.js +2 -2
  6. package/dist/{deploy-engine-BU3iY59A.js → deploy-engine-C-4ho8TJ.js} +475 -55
  7. package/dist/deploy-engine-C-4ho8TJ.js.map +1 -0
  8. package/dist/{iam-policy-targets-dAY3-gXJ.js → iam-policy-targets-BxP3yqlr.js} +5 -5
  9. package/dist/{iam-policy-targets-dAY3-gXJ.js.map → iam-policy-targets-BxP3yqlr.js.map} +1 -1
  10. package/dist/{iam-role-provider-C8O3q2ua.js → iam-role-provider-a-8z7Dpm.js} +4 -4
  11. package/dist/{iam-role-provider-C8O3q2ua.js.map → iam-role-provider-a-8z7Dpm.js.map} +1 -1
  12. package/dist/index.d.ts +10 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +4 -4
  15. package/dist/{neptune-provider-CuJF3t-Q.js → neptune-provider-Bnr2VC6V.js} +3 -3
  16. package/dist/{neptune-provider-CuJF3t-Q.js.map → neptune-provider-Bnr2VC6V.js.map} +1 -1
  17. package/dist/{program-C87Q8YFK.js → program-BHjdsRtD.js} +668 -512
  18. package/dist/program-BHjdsRtD.js.map +1 -0
  19. package/dist/{provider-classes-DmohfhIq.js → provider-classes-CVC9_-km.js} +1217 -101
  20. package/dist/provider-classes-CVC9_-km.js.map +1 -0
  21. package/dist/{rds-provider-Br3hPyHP.js → rds-provider-QKN-WHF3.js} +3 -3
  22. package/dist/{rds-provider-Br3hPyHP.js.map → rds-provider-QKN-WHF3.js.map} +1 -1
  23. package/dist/{version-BtTEjOpj.js → version-CXGQKplb.js} +2 -2
  24. package/dist/{version-BtTEjOpj.js.map → version-CXGQKplb.js.map} +1 -1
  25. package/package.json +3 -1
  26. package/dist/aws-clients-Bj7qH5Ph.js.map +0 -1
  27. package/dist/deploy-engine-BU3iY59A.js.map +0 -1
  28. package/dist/program-C87Q8YFK.js.map +0 -1
  29. package/dist/provider-classes-DmohfhIq.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { r as getAwsClients } from "./aws-clients-Bj7qH5Ph.js";
1
+ import { r as getAwsClients } from "./aws-clients-B_CEQGE1.js";
2
2
  import { B as safeMsg, F as displaySafe, I as displayStackName, L as isPasteableIdent, O as SECRET_REF_MAX_CODE_POINTS, P as displayIdent, a as getLogger, b as generateResourceNameWithFallback, n as isAwsAuthoredFailure, r as safeStringify, t as describeAwsFailure, y as generateResourceName, z as plainIdentOr } from "./aws-failure-text-BEQfs6za.js";
3
- import { $ as protectedReplacementAdvice, $n as isAmbiguousOutcomeError, $t as credentialFingerprint, A as isQuotableImportValue, B as isTerminalDeleteFailure, Bn as withheldTargetClause, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Gt as injectiveKeyPrefix, H as observeThenDisableProtection, In as plainOrDescribed, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mn as hasClauseBreak, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as isInertUnquoted, O as isPlainImportJson, P as remedyLogicalId, Pn as pasteableCommand, Q as pasteableAwsCommand, Qt as clientDefaultsFor, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, W as rdsFamilyProtectionSite, Wt as injectiveKey, X as WITHHELD_AWS_COMMAND, Xn as markReplayMayCollide, Xt as ambientClientDefaults, Y as UNNAMEABLE_ID_CLAUSE, Yn as markNameCollision, Yt as withPasteableAwsProfile, Z as isAwsCliLiteral, Zt as ambientCredentialConfig, _ as RecentIdSet, _t as createMaskedLogSinks, a as onlySecretDerived, ar as isMarkedNonRetryable, at as startInterruptWatch, b as isInsideWindow, bt as maskDeep, c as recordedPrincipalsRepair, cr as markRedactedCause, ct as canonicalizeRoute53QueryName, dt as compositeIdSkipResult, en as AccountIdUnavailableError, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gn as ProvisioningError, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, ir as THROTTLING_ERROR_NAMES, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jn as commandHole, jt as markAuxiliaryFailure, k as isPlainImportValue, lr as wrapMaskedAwsError, lt as compositeIdFormatMessage, nn as CdkdError, nr as isTransientServerError, o as readPrincipalLists, or as isThrottlingError, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pt as packCompositeId, q as userPoolProtectionSite, r as SECRET_DERIVED_READ_LIVE, sr as markNonRetryable, tr as isRetryableTransientError, u as clearOnUpdateRemoval, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ResourceUpdateNotSupportedError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation, zn as shellQuote } from "./iam-policy-targets-dAY3-gXJ.js";
3
+ import { $ as protectedReplacementAdvice, $n as isAmbiguousOutcomeError, $t as credentialFingerprint, A as isQuotableImportValue, B as isTerminalDeleteFailure, Bn as withheldTargetClause, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Gt as injectiveKeyPrefix, H as observeThenDisableProtection, In as plainOrDescribed, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mn as hasClauseBreak, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as isInertUnquoted, O as isPlainImportJson, P as remedyLogicalId, Pn as pasteableCommand, Q as pasteableAwsCommand, Qt as clientDefaultsFor, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, W as rdsFamilyProtectionSite, Wt as injectiveKey, X as WITHHELD_AWS_COMMAND, Xn as markReplayMayCollide, Xt as ambientClientDefaults, Y as UNNAMEABLE_ID_CLAUSE, Yn as markNameCollision, Yt as withPasteableAwsProfile, Z as isAwsCliLiteral, Zt as ambientCredentialConfig, _ as RecentIdSet, _t as createMaskedLogSinks, a as onlySecretDerived, ar as isMarkedNonRetryable, at as startInterruptWatch, b as isInsideWindow, bt as maskDeep, c as recordedPrincipalsRepair, cr as markRedactedCause, ct as canonicalizeRoute53QueryName, dt as compositeIdSkipResult, en as AccountIdUnavailableError, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gn as ProvisioningError, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, ir as THROTTLING_ERROR_NAMES, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jn as commandHole, jt as markAuxiliaryFailure, k as isPlainImportValue, lr as wrapMaskedAwsError, lt as compositeIdFormatMessage, nn as CdkdError, nr as isTransientServerError, o as readPrincipalLists, or as isThrottlingError, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pt as packCompositeId, q as userPoolProtectionSite, r as SECRET_DERIVED_READ_LIVE, sr as markNonRetryable, tr as isRetryableTransientError, u as clearOnUpdateRemoval, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ResourceUpdateNotSupportedError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation, zn as shellQuote } from "./iam-policy-targets-BxP3yqlr.js";
4
4
  import { s as ambientRegion } from "./aws-client-defaults-DBXBcg0J.js";
5
- import { $ as S3_AUTO_DELETE_OBJECTS_TAG, Ao as sameLambdaFunctionAddress, At as withNestedStackContext, Br as isTerminationProtectionPropagationError, Bt as awaitInFlightSibling, C as withApiLimit, Ci as getAccountInfo, Co as requireConfigString, Do as withRetry, Fr as withIndeterminateGuard, G as deleteBudgetKey, H as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Ho as passedNoEchoParametersOf, Hr as reDisableInstanceApiTermination, Ht as getStackRecords, Ii as passedParameterClassesOf, Ir as isWaitAbandonedError, J as DELETE_INDEX_WAIT_PROCEED_NOTE, K as resolveDynamoDbDeleteBudgetClock, Lr as markWaitAbandoned, Ml as displayAssemblyPath, Ni as parseWebACLArn, Nl as renderAssemblyPathEscape, Oo as canonicalLambdaFunctionName, Or as slowCcOperationTimeoutMs, Pl as resolveAssemblyPath, Pr as deleteSkipReason, Q as ECR_AUTO_DELETE_IMAGES_TAG, Qa as findSilentDropProperties, Ra as refuseMalformedResourcesForDestroy, S as lookupEachName, So as requireConfigObject, Sr as getCurrentResourceSecrets, Ss as recordAttributeIdCopy, St as getNestedRevertRun, Ts as carriesSecretMask, Tt as revertNestedChildFromJournal, U as beginDeleteWait, Ui as accountArgs, Ur as reEnableInstanceApiTermination, V as DynamoDBGlobalTableProvider, Vr as observeThenDisableInstanceApiTermination, W as compensateRemovedDeletionProtection, X as deleteTableWithIndexBusyRetry, Xa as withheldAccountClause, Y as INDEX_SETTLE_POLL_INTERVAL_MS, Yo as hasMaskableValues, Z as waitForIndexesSettled, _l as decodeListingKey, _o as configIntegerRefusal, ar as DBPROXY_TAGS_WHAT, b as chunks, bl as canonicalizeRegion, bo as replayWarn, bs as recoverMaskedOutput, c as isAbsoluteAssetPath, ci as outputReferenceProvenanceOf, cn as redactedDeleteAddressFields, cr as readTagList, cs as snapshotPassProvenance, di as s3BucketArn, do as isWarmThroughputDecrease, dr as tagPlanWarning, eo as withoutSilentDropProperties, er as earliestDefined, et as hasCdkAutoDeleteTag, fi as s3BucketDomainName, fo as toCfnInteger, fr as definedAttributes, fs as withoutPhysicalNameCopies, go as configBooleanRefusal, hc as rewriteTemplateAssetReferences, hi as s3BucketWebsiteUrl, ho as coerceCfnInteger, in as getCurrentProducerRegions, ir as acquireIdempotencyToken, jl as describeFileReadFailure, ko as lambdaFunctionNameForMask, kr as unchangedBehindSecretReference, kt as getCurrentNestedStackContext, l as listNestedTemplateRows, ln as redactedDeleteAddressSkip, lo as WARM_THROUGHPUT_MEMBERS, lr as refuseMalformedDesiredTags, ls as redactSecretsForState, mi as s3BucketRegionalDomainName, mo as coerceCfnBoolean, ms as dynamicReferenceTokens, nr as reserveStackCreateToken, nt as getPriorAttempts, oi as isSettledInstanceState, on as REDACTED_DELETE_ADDRESS_SKIP_REASON, or as DBPROXY_TAG_OPTIONS, os as markSameGenerationBag, pi as s3BucketDualStackDomainName, po as toFiniteNumber, pr as stringifyIfAssigned, q as resolveDynamoDbDeleteBudgetMs, rt as markRefusedBeforeApplying, s as findNestedTemplateTreeDefect, sn as isRedactedRecordedValue, sr as planTagDiff, ss as recordReferenceProvenanceEntry, t as DeployEngine, tt as isTruthyCfnBoolean, u as renderNestedTemplateTreeDefect, uc as stringifyValue, uo as coerceWarmThroughput$1, ur as tagMapAsList, va as refuseMalformedNestedChildOutputs, vo as configStringRefusal, x as isAccessDeniedError, xl as derivePartitionAndUrlSuffix, xo as requireConfigArray, xs as physicalNameCopiesOf, yo as readConfigString, zr as ec2InstanceProtectionSite } from "./deploy-engine-BU3iY59A.js";
6
- import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-C8O3q2ua.js";
7
- import { a as resolveSecretDerivedPrincipals, i as isResolvableSecretPrincipalList, n as runDestroyForStack, o as canonicalizeIpProtocolValue, r as holdsUnprovenSecretPrincipalToken, s as resolvedResourceTimeoutMs, t as canonicalizeIpv4Cidr } from "./program-C87Q8YFK.js";
8
- import { RDSProvider } from "./rds-provider-Br3hPyHP.js";
9
- import { NeptuneProvider } from "./neptune-provider-CuJF3t-Q.js";
10
- import { ASGProvider } from "./asg-provider-ebjf5E8o.js";
5
+ import { $ as S3_AUTO_DELETE_OBJECTS_TAG, $a as findSilentDropProperties, Ao as lambdaFunctionNameForMask, Ar as unchangedBehindSecretReference, At as withNestedStackContext, Br as ec2InstanceProtectionSite, Bt as awaitInFlightSibling, C as withApiLimit, Cl as derivePartitionAndUrlSuffix, Co as requireConfigObject, Cr as getCurrentResourceSecrets, Cs as physicalNameCopiesOf, Ds as carriesSecretMask, Fl as renderAssemblyPathEscape, Fr as deleteSkipReason, G as deleteBudgetKey, Gt as replacedDeleteFailureVerdict, H as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Hr as observeThenDisableInstanceApiTermination, Ht as getStackRecords, Il as resolveAssemblyPath, Ir as withIndeterminateGuard, J as DELETE_INDEX_WAIT_PROCEED_NOTE, K as resolveDynamoDbDeleteBudgetClock, Li as passedParameterClassesOf, Lr as isWaitAbandonedError, Nl as describeFileReadFailure, Oo as withRetry, Pi as parseWebACLArn, Pl as displayAssemblyPath, Q as ECR_AUTO_DELETE_IMAGES_TAG, Rr as markWaitAbandoned, S as lookupEachName, Sl as canonicalizeRegion, So as requireConfigArray, Ss as recoverMaskedOutput, St as getNestedRevertRun, Tt as revertNestedChildFromJournal, U as beginDeleteWait, Uo as passedNoEchoParametersOf, Ur as reDisableInstanceApiTermination, V as DynamoDBGlobalTableProvider, Vr as isTerminationProtectionPropagationError, W as compensateRemovedDeletionProtection, Wi as accountArgs, Wr as reEnableInstanceApiTermination, X as deleteTableWithIndexBusyRetry, Xo as hasMaskableValues, Y as INDEX_SETTLE_POLL_INTERVAL_MS, Z as waitForIndexesSettled, Za as withheldAccountClause, _c as rewriteTemplateAssetReferences, _o as configBooleanRefusal, an as getCurrentProducerRegions, ar as acquireIdempotencyToken, b as chunks, bo as readConfigString, c as isAbsoluteAssetPath, cn as isRedactedRecordedValue, cr as planTagDiff, cs as markSameGenerationBag, do as coerceWarmThroughput$1, dr as tagMapAsList, ds as redactSecretsForState, et as hasCdkAutoDeleteTag, fc as stringifyValue, fi as s3BucketArn, fo as isWarmThroughputDecrease, fr as tagPlanWarning, gi as s3BucketWebsiteUrl, go as coerceCfnInteger, gs as dynamicReferenceTokens, hi as s3BucketRegionalDomainName, ho as coerceCfnBoolean, jo as sameLambdaFunctionAddress, ko as canonicalLambdaFunctionName, kr as slowCcOperationTimeoutMs, kt as getCurrentNestedStackContext, l as listNestedTemplateRows, li as outputReferenceProvenanceOf, ln as redactedDeleteAddressFields, lr as readTagList, ls as recordReferenceProvenanceEntry, mi as s3BucketDualStackDomainName, mo as toFiniteNumber, mr as stringifyIfAssigned, ms as withoutPhysicalNameCopies, nt as getPriorAttempts, or as DBPROXY_TAGS_WHAT, pi as s3BucketDomainName, po as toCfnInteger, pr as definedAttributes, q as resolveDynamoDbDeleteBudgetMs, rr as reserveStackCreateToken, rt as markRefusedBeforeApplying, s as findNestedTemplateTreeDefect, si as isSettledInstanceState, sn as REDACTED_DELETE_ADDRESS_SKIP_REASON, sr as DBPROXY_TAG_OPTIONS, t as DeployEngine, to as withoutSilentDropProperties, tr as earliestDefined, tt as isTruthyCfnBoolean, u as renderNestedTemplateTreeDefect, un as redactedDeleteAddressSkip, uo as WARM_THROUGHPUT_MEMBERS, ur as refuseMalformedDesiredTags, us as snapshotPassProvenance, vo as configIntegerRefusal, wi as getAccountInfo, wo as requireConfigString, ws as recordAttributeIdCopy, x as isAccessDeniedError, xo as replayWarn, ya as refuseMalformedNestedChildOutputs, yl as decodeListingKey, yo as configStringRefusal, za as refuseMalformedResourcesForDestroy } from "./deploy-engine-C-4ho8TJ.js";
6
+ import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-a-8z7Dpm.js";
7
+ import { a as resolveSecretDerivedPrincipals, i as isResolvableSecretPrincipalList, n as runDestroyForStack, o as canonicalizeIpProtocolValue, r as holdsUnprovenSecretPrincipalToken, s as resolvedResourceTimeoutMs, t as canonicalizeIpv4Cidr } from "./program-BHjdsRtD.js";
8
+ import { RDSProvider } from "./rds-provider-QKN-WHF3.js";
9
+ import { NeptuneProvider } from "./neptune-provider-Bnr2VC6V.js";
10
+ import { ASGProvider } from "./asg-provider-COcKVcvZ.js";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client } from "@aws-sdk/client-s3";
13
13
  import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreateAccessKeyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreatePolicyCommand, CreatePolicyVersionCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeletePolicyCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetAccessKeyLastUsedCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetPolicyCommand, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListEntitiesForPolicyCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListPoliciesCommand, ListPolicyTagsCommand, ListPolicyVersionsCommand, ListUserPoliciesCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagPolicyCommand, TagUserCommand, UntagPolicyCommand, UntagUserCommand, UpdateAccessKeyCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
@@ -28,6 +28,8 @@ import { BedrockAgentCoreControlClient, CreateAgentRuntimeCommand, CreateEvaluat
28
28
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$1, CreateCacheClusterCommand, CreateCacheSubnetGroupCommand, DeleteCacheClusterCommand, DeleteCacheSubnetGroupCommand, DescribeCacheClustersCommand, DescribeCacheSubnetGroupsCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$7, ModifyCacheClusterCommand, ModifyCacheSubnetGroupCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$1 } from "@aws-sdk/client-elasticache";
29
29
  import { ACMClient, AddTagsToCertificateCommand, DeleteCertificateCommand, DescribeCertificateCommand, ListTagsForCertificateCommand, RemoveTagsFromCertificateCommand, RequestCertificateCommand, ResourceNotFoundException as ResourceNotFoundException$7, UpdateCertificateOptionsCommand } from "@aws-sdk/client-acm";
30
30
  import { CreateMicrovmImageCommand, DeleteMicrovmImageCommand, GetMicrovmImageCommand, LambdaMicrovmsClient, ListTagsCommand as ListTagsCommand$1, ResourceNotFoundException as ResourceNotFoundException$8, TagResourceCommand as TagResourceCommand$10, UntagResourceCommand as UntagResourceCommand$10, UpdateMicrovmImageCommand } from "@aws-sdk/client-lambda-microvms";
31
+ import { CreateWebFunctionEndpointCommand, CreateWebFunctionRevisionCommand, DeleteWebFunctionEndpointCommand, DeleteWebFunctionRevisionCommand, GetWebFunctionEndpointCommand, GetWebFunctionRevisionCommand, LambdaWebClient, ListWebFunctionRevisionsCommand, ResourceNotFoundException as ResourceNotFoundException$9, UpdateWebFunctionEndpointCommand } from "@aws-sdk/client-lambda-web";
32
+ import { CreateNetworkConnectorCommand, DeleteNetworkConnectorCommand, GetNetworkConnectorCommand, LambdaCoreClient, ResourceNotFoundException as ResourceNotFoundException$10, UpdateNetworkConnectorCommand } from "@aws-sdk/client-lambda-core";
31
33
  import * as fs from "node:fs";
32
34
  import * as path from "node:path";
33
35
  import { AssociateVPCWithHostedZoneCommand, ChangeResourceRecordSetsCommand, ChangeTagsForResourceCommand, CreateHostedZoneCommand, CreateQueryLoggingConfigCommand, DeleteHostedZoneCommand, DeleteQueryLoggingConfigCommand, DisassociateVPCFromHostedZoneCommand, GetHostedZoneCommand, HostedZoneAlreadyExists, ListHostedZonesByNameCommand, ListQueryLoggingConfigsCommand, ListResourceRecordSetsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$8, Route53Client, UpdateHostedZoneCommentCommand, UpdateHostedZoneFeaturesCommand } from "@aws-sdk/client-route-53";
@@ -42,22 +44,22 @@ import { CreateStateMachineCommand, DeleteStateMachineCommand, DescribeStateMach
42
44
  import { CreateClusterCommand, CreateServiceCommand, DeleteClusterCommand, DeleteServiceCommand, DeregisterTaskDefinitionCommand, DescribeClustersCommand, DescribeServicesCommand, DescribeTaskDefinitionCommand, ECSClient, ListTaskDefinitionsCommand, PutClusterCapacityProvidersCommand, RegisterTaskDefinitionCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$14, UpdateClusterCommand, UpdateServiceCommand, waitUntilServicesStable } from "@aws-sdk/client-ecs";
43
45
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBClusterCommand as CreateDBClusterCommand$1, CreateDBInstanceCommand as CreateDBInstanceCommand$1, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$1, DeleteDBClusterCommand as DeleteDBClusterCommand$1, DeleteDBInstanceCommand as DeleteDBInstanceCommand$1, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$1, DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$12, ModifyDBClusterCommand as ModifyDBClusterCommand$1, ModifyDBInstanceCommand as ModifyDBInstanceCommand$1, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$1, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$3 } from "@aws-sdk/client-docdb";
44
46
  import { CreateWebACLCommand, DeleteWebACLCommand, GetWebACLCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$13, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$15, UpdateWebACLCommand, WAFNonexistentItemException, WAFV2Client } from "@aws-sdk/client-wafv2";
45
- import { AddCustomAttributesCommand, CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$9, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
47
+ import { AddCustomAttributesCommand, CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$11, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
46
48
  import { CreateHttpNamespaceCommand, CreatePrivateDnsNamespaceCommand, CreatePublicDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceAttributesCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceAttributesCommand, GetServiceCommand, ListNamespacesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, NamespaceNotFound, ResourceInUse, ServiceDiscoveryClient, ServiceNotFound, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$16, UpdateHttpNamespaceCommand, UpdatePrivateDnsNamespaceCommand, UpdatePublicDnsNamespaceCommand, UpdateServiceAttributesCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
47
49
  import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetGraphqlApiEnvironmentVariablesCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, ListGraphqlApisCommand, NotFoundException as NotFoundException$4, PutGraphqlApiEnvironmentVariablesCommand, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$17, UntagResourceCommand as UntagResourceCommand$17, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
48
50
  import { ConcurrentModificationException, CrawlerRunningException, CreateConnectionCommand, CreateCrawlerCommand, CreateDatabaseCommand, CreateJobCommand, CreateSecurityConfigurationCommand, CreateTableCommand as CreateTableCommand$1, CreateTriggerCommand, CreateWorkflowCommand, DeleteConnectionCommand, DeleteCrawlerCommand, DeleteDatabaseCommand, DeleteJobCommand, DeleteSecurityConfigurationCommand, DeleteTableCommand as DeleteTableCommand$1, DeleteTriggerCommand, DeleteWorkflowCommand, EntityNotFoundException, GetConnectionCommand, GetCrawlerCommand, GetDatabaseCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, TagResourceCommand as TagResourceCommand$18, UntagResourceCommand as UntagResourceCommand$18, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
49
51
  import { BudgetsClient, CreateBudgetCommand, CreateNotificationCommand, CreateSubscriberCommand, DeleteBudgetCommand, DeleteNotificationCommand, DeleteSubscriberCommand, DescribeBudgetCommand, DuplicateRecordException, NotFoundException as NotFoundException$5, TagResourceCommand as TagResourceCommand$19, UntagResourceCommand as UntagResourceCommand$19, UpdateBudgetCommand } from "@aws-sdk/client-budgets";
50
- import { AddTagsToStreamCommand, CreateStreamCommand, DecreaseStreamRetentionPeriodCommand, DeleteStreamCommand, DeregisterStreamConsumerCommand, DescribeStreamCommand, DescribeStreamConsumerCommand, DescribeStreamSummaryCommand, DisableEnhancedMonitoringCommand, EnableEnhancedMonitoringCommand, IncreaseStreamRetentionPeriodCommand, KinesisClient, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ListTagsForStreamCommand, RegisterStreamConsumerCommand, RemoveTagsFromStreamCommand, ResourceNotFoundException as ResourceNotFoundException$10, StartStreamEncryptionCommand, StopStreamEncryptionCommand, TagResourceCommand as TagResourceCommand$20, UntagResourceCommand as UntagResourceCommand$20, UpdateMaxRecordSizeCommand, UpdateShardCountCommand, UpdateStreamModeCommand } from "@aws-sdk/client-kinesis";
51
- import { CreateScheduleCommand, DeleteScheduleCommand, GetScheduleCommand, ListSchedulesCommand, ResourceNotFoundException as ResourceNotFoundException$11, SchedulerClient, UpdateScheduleCommand } from "@aws-sdk/client-scheduler";
52
+ import { AddTagsToStreamCommand, CreateStreamCommand, DecreaseStreamRetentionPeriodCommand, DeleteStreamCommand, DeregisterStreamConsumerCommand, DescribeStreamCommand, DescribeStreamConsumerCommand, DescribeStreamSummaryCommand, DisableEnhancedMonitoringCommand, EnableEnhancedMonitoringCommand, IncreaseStreamRetentionPeriodCommand, KinesisClient, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ListTagsForStreamCommand, RegisterStreamConsumerCommand, RemoveTagsFromStreamCommand, ResourceNotFoundException as ResourceNotFoundException$12, StartStreamEncryptionCommand, StopStreamEncryptionCommand, TagResourceCommand as TagResourceCommand$20, UntagResourceCommand as UntagResourceCommand$20, UpdateMaxRecordSizeCommand, UpdateShardCountCommand, UpdateStreamModeCommand } from "@aws-sdk/client-kinesis";
53
+ import { CreateScheduleCommand, DeleteScheduleCommand, GetScheduleCommand, ListSchedulesCommand, ResourceNotFoundException as ResourceNotFoundException$13, SchedulerClient, UpdateScheduleCommand } from "@aws-sdk/client-scheduler";
52
54
  import { CreatePipeCommand, DeletePipeCommand, DescribePipeCommand, NotFoundException as NotFoundException$6, PipesClient, TagResourceCommand as TagResourceCommand$21, UntagResourceCommand as UntagResourceCommand$21, UpdatePipeCommand } from "@aws-sdk/client-pipes";
53
55
  import { AccessPointAlreadyExists, AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand, CreateMountTargetCommand, DeleteAccessPointCommand, DeleteFileSystemCommand, DeleteMountTargetCommand, DescribeAccessPointsCommand, DescribeBackupPolicyCommand, DescribeFileSystemPolicyCommand, DescribeFileSystemsCommand, DescribeLifecycleConfigurationCommand, DescribeMountTargetSecurityGroupsCommand, DescribeMountTargetsCommand, EFSClient, FileSystemAlreadyExists, FileSystemNotFound, ModifyMountTargetSecurityGroupsCommand, MountTargetNotFound, PutBackupPolicyCommand, PutFileSystemPolicyCommand, PutLifecycleConfigurationCommand, UpdateFileSystemCommand, UpdateFileSystemProtectionCommand } from "@aws-sdk/client-efs";
54
56
  import { CreateFileSystemCommand as CreateFileSystemCommand$1, CreateFileSystemFromBackupCommand, DeleteFileSystemCommand as DeleteFileSystemCommand$1, DescribeFileSystemsCommand as DescribeFileSystemsCommand$1, FSxClient, FileSystemNotFound as FileSystemNotFound$1, TagResourceCommand as TagResourceCommand$22, UntagResourceCommand as UntagResourceCommand$22, UpdateFileSystemCommand as UpdateFileSystemCommand$1 } from "@aws-sdk/client-fsx";
55
57
  import { AddInstanceFleetCommand, AddInstanceGroupsCommand, AddTagsCommand as AddTagsCommand$1, DescribeClusterCommand, EMRClient, InvalidRequestException, ListClustersCommand, ListInstanceFleetsCommand, ListInstanceGroupsCommand, ModifyClusterCommand, ModifyInstanceFleetCommand, ModifyInstanceGroupsCommand, PutAutoScalingPolicyCommand, PutAutoTerminationPolicyCommand, PutManagedScalingPolicyCommand, RemoveAutoScalingPolicyCommand, RemoveAutoTerminationPolicyCommand, RemoveManagedScalingPolicyCommand, RemoveTagsCommand as RemoveTagsCommand$1, RunJobFlowCommand, SetTerminationProtectionCommand, SetVisibleToAllUsersCommand, TerminateJobFlowsCommand } from "@aws-sdk/client-emr";
56
- import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliveryStreamCommand, FirehoseClient, ListTagsForDeliveryStreamCommand, ResourceNotFoundException as ResourceNotFoundException$12, TagDeliveryStreamCommand, UntagDeliveryStreamCommand, UpdateDestinationCommand } from "@aws-sdk/client-firehose";
58
+ import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliveryStreamCommand, FirehoseClient, ListTagsForDeliveryStreamCommand, ResourceNotFoundException as ResourceNotFoundException$14, TagDeliveryStreamCommand, UntagDeliveryStreamCommand, UpdateDestinationCommand } from "@aws-sdk/client-firehose";
57
59
  import { AddTagsCommand as AddTagsCommand$2, CloudTrailClient, CreateTrailCommand, DeleteTrailCommand, GetEventSelectorsCommand, GetInsightSelectorsCommand, GetTrailCommand, GetTrailStatusCommand, ListTagsCommand as ListTagsCommand$2, PutEventSelectorsCommand, PutInsightSelectorsCommand, RemoveTagsCommand as RemoveTagsCommand$2, StartLoggingCommand, StopLoggingCommand, TrailNotFoundException, UpdateTrailCommand } from "@aws-sdk/client-cloudtrail";
58
- import { BatchGetProjectsCommand, CodeBuildClient, CreateProjectCommand, DeleteProjectCommand, ResourceNotFoundException as ResourceNotFoundException$13, UpdateProjectCommand } from "@aws-sdk/client-codebuild";
60
+ import { BatchGetProjectsCommand, CodeBuildClient, CreateProjectCommand, DeleteProjectCommand, ResourceNotFoundException as ResourceNotFoundException$15, UpdateProjectCommand } from "@aws-sdk/client-codebuild";
59
61
  import { CodeCommitClient, CreateCommitCommand, CreateRepositoryCommand as CreateRepositoryCommand$1, DeleteRepositoryCommand as DeleteRepositoryCommand$1, GetRepositoryCommand, GetRepositoryTriggersCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$16, PutRepositoryTriggersCommand, RepositoryDoesNotExistException, TagResourceCommand as TagResourceCommand$23, UntagResourceCommand as UntagResourceCommand$23, UpdateRepositoryDescriptionCommand, UpdateRepositoryEncryptionKeyCommand, UpdateRepositoryNameCommand } from "@aws-sdk/client-codecommit";
60
- import { CreateLifecyclePolicyCommand, DLMClient, DeleteLifecyclePolicyCommand as DeleteLifecyclePolicyCommand$1, GetLifecyclePoliciesCommand, GetLifecyclePolicyCommand as GetLifecyclePolicyCommand$1, ResourceNotFoundException as ResourceNotFoundException$14, TagResourceCommand as TagResourceCommand$24, UntagResourceCommand as UntagResourceCommand$24, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
62
+ import { CreateLifecyclePolicyCommand, DLMClient, DeleteLifecyclePolicyCommand as DeleteLifecyclePolicyCommand$1, GetLifecyclePoliciesCommand, GetLifecyclePolicyCommand as GetLifecyclePolicyCommand$1, ResourceNotFoundException as ResourceNotFoundException$16, TagResourceCommand as TagResourceCommand$24, UntagResourceCommand as UntagResourceCommand$24, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
61
63
  import { CreateVectorBucketCommand, DeleteIndexCommand, DeleteVectorBucketCommand, GetVectorBucketCommand, ListIndexesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$17, S3VectorsClient, TagResourceCommand as TagResourceCommand$25, UntagResourceCommand as UntagResourceCommand$25 } from "@aws-sdk/client-s3vectors";
62
64
  import { ListTagsForResourceCommand as ListTagsForResourceCommand$18, S3ControlClient, TagResourceCommand as TagResourceCommand$26, UntagResourceCommand as UntagResourceCommand$26 } from "@aws-sdk/client-s3-control";
63
65
  import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetNamespaceCommand as GetNamespaceCommand$1, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$7, S3TablesClient, TagResourceCommand as TagResourceCommand$27, UntagResourceCommand as UntagResourceCommand$27 } from "@aws-sdk/client-s3tables";
@@ -1421,6 +1423,7 @@ var IAMInstanceProfileProvider = class {
1421
1423
 
1422
1424
  //#endregion
1423
1425
  //#region src/provisioning/providers/iam-access-key-provider.ts
1426
+ const ACCESS_KEY_ID_PATTERN = /^AKIA[A-Z0-9]{16}$/;
1424
1427
  const CREATE_DATE_SKEW_MARGIN_MS = 5e3;
1425
1428
  var IAMAccessKeyProvider = class {
1426
1429
  iamClient;
@@ -1640,9 +1643,16 @@ var IAMAccessKeyProvider = class {
1640
1643
  throw new ProvisioningError(`Unknown attribute ${attributeName} for ${resourceType} (only 'Id' and 'SecretAccessKey' are defined)`, resourceType, logicalId, physicalId);
1641
1644
  }
1642
1645
  async readCurrentState(physicalId, _logicalId, _resourceType) {
1646
+ const found = await this.findAccessKey(physicalId);
1647
+ if (found === void 0 || found === RESOURCE_NOT_FOUND) return found;
1648
+ const result = { UserName: found.userName };
1649
+ if (found.status !== void 0) result["Status"] = found.status;
1650
+ return result;
1651
+ }
1652
+ async findAccessKey(accessKeyId) {
1643
1653
  let userName;
1644
1654
  try {
1645
- userName = (await this.iamClient.send(new GetAccessKeyLastUsedCommand({ AccessKeyId: physicalId }))).UserName;
1655
+ userName = (await this.iamClient.send(new GetAccessKeyLastUsedCommand({ AccessKeyId: accessKeyId }))).UserName;
1646
1656
  } catch (err) {
1647
1657
  if (err instanceof NoSuchEntityException) return RESOURCE_NOT_FOUND;
1648
1658
  throw err;
@@ -1660,15 +1670,23 @@ var IAMAccessKeyProvider = class {
1660
1670
  if (err instanceof NoSuchEntityException) return RESOURCE_NOT_FOUND;
1661
1671
  throw err;
1662
1672
  }
1663
- for (const key of page.AccessKeyMetadata ?? []) if (key.AccessKeyId === physicalId) {
1664
- const result = { UserName: userName };
1665
- if (key.Status !== void 0) result["Status"] = key.Status;
1666
- return result;
1667
- }
1673
+ for (const key of page.AccessKeyMetadata ?? []) if (key.AccessKeyId === accessKeyId) return {
1674
+ userName,
1675
+ status: key.Status
1676
+ };
1668
1677
  marker = page.IsTruncated ? page.Marker : void 0;
1669
1678
  } while (marker);
1670
1679
  return RESOURCE_NOT_FOUND;
1671
1680
  }
1681
+ async isSameResource(journaledPhysicalId, record, resourceType, context) {
1682
+ if (resourceType !== "AWS::IAM::AccessKey") return "unknown";
1683
+ if (!ACCESS_KEY_ID_PATTERN.test(journaledPhysicalId) || !ACCESS_KEY_ID_PATTERN.test(record.physicalId)) return "unknown";
1684
+ if (journaledPhysicalId === record.physicalId) return "same";
1685
+ if (await this.iamClient.config.region() !== context.expectedRegion) return "unknown";
1686
+ const recordKey = await this.findAccessKey(record.physicalId);
1687
+ if (recordKey === void 0 || recordKey === RESOURCE_NOT_FOUND) return "unknown";
1688
+ return await this.findAccessKey(journaledPhysicalId) === void 0 ? "unknown" : "different";
1689
+ }
1672
1690
  getDriftUnknownPaths(resourceType) {
1673
1691
  if (resourceType === "AWS::IAM::AccessKey") return ["Serial"];
1674
1692
  return [];
@@ -5419,7 +5437,7 @@ var S3BucketPolicyProvider = class {
5419
5437
  const awsClients = getAwsClients();
5420
5438
  this.s3Client = awsClients.s3;
5421
5439
  }
5422
- async create(logicalId, resourceType, properties) {
5440
+ async create(logicalId, resourceType, properties, context) {
5423
5441
  this.logger.debug(`Creating S3 bucket policy ${logicalId}`);
5424
5442
  const bucketName = properties["Bucket"];
5425
5443
  const policyDocument = properties["PolicyDocument"];
@@ -5437,8 +5455,7 @@ var S3BucketPolicyProvider = class {
5437
5455
  attributes: {}
5438
5456
  };
5439
5457
  } catch (error) {
5440
- const cause = error instanceof Error ? error : void 0;
5441
- throw new ProvisioningError(`Failed to create S3 bucket policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, bucketName, cause);
5458
+ throw this.wrapOperationError("create", logicalId, resourceType, bucketName, error, context?.maskSecrets);
5442
5459
  }
5443
5460
  }
5444
5461
  async update(logicalId, physicalId, resourceType, properties, _previousProperties, context) {
@@ -5461,8 +5478,7 @@ var S3BucketPolicyProvider = class {
5461
5478
  attributes: {}
5462
5479
  };
5463
5480
  } catch (error) {
5464
- const cause = error instanceof Error ? error : void 0;
5465
- throw new ProvisioningError(`Failed to update S3 bucket policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
5481
+ throw this.wrapOperationError("update", logicalId, resourceType, physicalId, error, context?.maskSecrets);
5466
5482
  }
5467
5483
  }
5468
5484
  async delete(logicalId, physicalId, resourceType, _properties, context) {
@@ -5487,10 +5503,17 @@ var S3BucketPolicyProvider = class {
5487
5503
  throw error;
5488
5504
  }
5489
5505
  } catch (error) {
5490
- const cause = error instanceof Error ? error : void 0;
5491
- throw new ProvisioningError(`Failed to delete S3 bucket policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
5506
+ throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
5492
5507
  }
5493
5508
  }
5509
+ wrapOperationError(operation, logicalId, resourceType, physicalId, error, maskSecrets) {
5510
+ const mask = maskSecrets ?? ((t) => t);
5511
+ const failure = describeAwsFailure(error);
5512
+ if (failure.redacted) this.logger.debug(mask(`Failed to ${operation} S3 bucket policy ${logicalId}: ${failure.detail}`));
5513
+ const cause = error instanceof Error ? error : void 0;
5514
+ const wrapped = new ProvisioningError(`Failed to ${operation} S3 bucket policy ${logicalId}: ${failure.summary}`, resourceType, logicalId, physicalId, cause);
5515
+ return failure.redacted && cause !== void 0 ? markRedactedCause(wrapped) : wrapped;
5516
+ }
5494
5517
  async readCurrentState(physicalId, _logicalId, _resourceType, properties, context) {
5495
5518
  let policyJson;
5496
5519
  try {
@@ -6049,7 +6072,7 @@ var SQSQueuePolicyProvider = class {
6049
6072
  const awsClients = getAwsClients();
6050
6073
  this.sqsClient = awsClients.sqs;
6051
6074
  }
6052
- async create(logicalId, resourceType, properties) {
6075
+ async create(logicalId, resourceType, properties, context) {
6053
6076
  this.logger.debug(`Creating SQS queue policy ${logicalId}`);
6054
6077
  const queues = properties["Queues"];
6055
6078
  const policyDocument = properties["PolicyDocument"];
@@ -6072,8 +6095,7 @@ var SQSQueuePolicyProvider = class {
6072
6095
  attributes: { [WRITTEN_QUEUES_KEY]: queues.join(",") }
6073
6096
  };
6074
6097
  } catch (error) {
6075
- const cause = error instanceof Error ? error : void 0;
6076
- const thrown = new ProvisioningError(`Failed to create SQS queue policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, queues[0], cause);
6098
+ const thrown = this.wrapOperationError("create", logicalId, resourceType, queues[0], error, context?.maskSecrets);
6077
6099
  if (applied.length > 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, applied.join(","));
6078
6100
  throw thrown;
6079
6101
  }
@@ -6105,8 +6127,7 @@ var SQSQueuePolicyProvider = class {
6105
6127
  };
6106
6128
  } catch (error) {
6107
6129
  if (error instanceof ProvisioningError) throw error;
6108
- const cause = error instanceof Error ? error : void 0;
6109
- throw new ProvisioningError(`Failed to update SQS queue policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
6130
+ throw this.wrapOperationError("update", logicalId, resourceType, physicalId, error, context?.maskSecrets);
6110
6131
  }
6111
6132
  }
6112
6133
  async delete(logicalId, physicalId, resourceType, properties, context) {
@@ -6119,8 +6140,7 @@ var SQSQueuePolicyProvider = class {
6119
6140
  await this.clearQueuePolicy(queueUrl, resourceType, logicalId, context?.expectedRegion);
6120
6141
  } catch (error) {
6121
6142
  if (error instanceof ProvisioningError) throw error;
6122
- const cause = error instanceof Error ? error : void 0;
6123
- throw new ProvisioningError(`Failed to delete SQS queue policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
6143
+ throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
6124
6144
  }
6125
6145
  this.logger.debug(`Successfully deleted SQS queue policy ${logicalId}`);
6126
6146
  }
@@ -6165,7 +6185,7 @@ var SQSQueuePolicyProvider = class {
6165
6185
  await this.clearQueuePolicy(queueUrl, resourceType, logicalId, context.expectedRegion);
6166
6186
  } catch (error) {
6167
6187
  if (error instanceof ProvisioningError) throw error;
6168
- throw new ProvisioningError(`Failed to delete SQS queue policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
6188
+ throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context.maskSecrets);
6169
6189
  }
6170
6190
  else {
6171
6191
  mismatched = true;
@@ -6181,6 +6201,14 @@ var SQSQueuePolicyProvider = class {
6181
6201
  leftInPlace: QUEUE_POLICY_MISMATCH_LEFT_REASON
6182
6202
  };
6183
6203
  }
6204
+ wrapOperationError(operation, logicalId, resourceType, physicalId, error, maskSecrets) {
6205
+ const mask = maskSecrets ?? ((t) => t);
6206
+ const failure = describeAwsFailure(error);
6207
+ if (failure.redacted) this.logger.debug(mask(`Failed to ${operation} SQS queue policy ${logicalId}: ${failure.detail}`));
6208
+ const cause = error instanceof Error ? error : void 0;
6209
+ const wrapped = new ProvisioningError(`Failed to ${operation} SQS queue policy ${logicalId}: ${failure.summary}`, resourceType, logicalId, physicalId, cause);
6210
+ return failure.redacted && cause !== void 0 ? markRedactedCause(wrapped) : wrapped;
6211
+ }
6184
6212
  async clearQueuePolicy(queueUrl, resourceType, logicalId, expectedRegion, phase = "not-found") {
6185
6213
  try {
6186
6214
  await this.sqsClient.send(new SetQueueAttributesCommand({
@@ -7160,7 +7188,7 @@ const TOPIC_POLICY_NOT_COMPARED_LEFT_REASON = "the document it attempted is miss
7160
7188
  var SNSTopicPolicyProvider = class {
7161
7189
  logger = getLogger().child("SNSTopicPolicyProvider");
7162
7190
  handledProperties = /* @__PURE__ */ new Map([["AWS::SNS::TopicPolicy", /* @__PURE__ */ new Set(["Topics", "PolicyDocument"])]]);
7163
- async create(logicalId, resourceType, properties) {
7191
+ async create(logicalId, resourceType, properties, context) {
7164
7192
  this.logger.debug(`Creating SNS topic policy ${logicalId}`);
7165
7193
  const topics = properties["Topics"];
7166
7194
  const policyDocument = properties["PolicyDocument"];
@@ -7179,7 +7207,7 @@ var SNSTopicPolicyProvider = class {
7179
7207
  attributes: {}
7180
7208
  };
7181
7209
  } catch (error) {
7182
- const thrown = new ProvisioningError(`Failed to create SNS topic policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0);
7210
+ const thrown = this.wrapOperationError("create", logicalId, resourceType, void 0, error, context?.maskSecrets);
7183
7211
  if (applied.length > 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, applied.join(","));
7184
7212
  throw thrown;
7185
7213
  }
@@ -7213,8 +7241,7 @@ var SNSTopicPolicyProvider = class {
7213
7241
  };
7214
7242
  } catch (error) {
7215
7243
  if (error instanceof ProvisioningError) throw error;
7216
- const cause = error instanceof Error ? error : void 0;
7217
- throw new ProvisioningError(`Failed to update SNS topic policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
7244
+ throw this.wrapOperationError("update", logicalId, resourceType, physicalId, error, mask);
7218
7245
  }
7219
7246
  }
7220
7247
  async delete(logicalId, physicalId, resourceType, properties, context) {
@@ -7228,8 +7255,7 @@ var SNSTopicPolicyProvider = class {
7228
7255
  await this.resetTopicPolicy(topicArn, resourceType, logicalId, context?.expectedRegion);
7229
7256
  } catch (error) {
7230
7257
  if (error instanceof ProvisioningError) throw error;
7231
- const cause = error instanceof Error ? error : void 0;
7232
- throw new ProvisioningError(`Failed to delete SNS topic policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
7258
+ throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
7233
7259
  }
7234
7260
  this.logger.debug(`Successfully deleted SNS topic policy ${logicalId}`);
7235
7261
  }
@@ -7281,7 +7307,7 @@ var SNSTopicPolicyProvider = class {
7281
7307
  await this.resetTopicPolicy(topicArn, resourceType, logicalId, context.expectedRegion);
7282
7308
  } catch (error) {
7283
7309
  if (error instanceof ProvisioningError) throw error;
7284
- throw new ProvisioningError(`Failed to delete SNS topic policy ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
7310
+ throw this.wrapOperationError("delete", logicalId, resourceType, physicalId, error, context.maskSecrets);
7285
7311
  }
7286
7312
  continue;
7287
7313
  }
@@ -7302,6 +7328,14 @@ var SNSTopicPolicyProvider = class {
7302
7328
  leftInPlace: TOPIC_POLICY_MISMATCH_LEFT_REASON
7303
7329
  };
7304
7330
  }
7331
+ wrapOperationError(operation, logicalId, resourceType, physicalId, error, maskSecrets) {
7332
+ const mask = maskSecrets ?? ((t) => t);
7333
+ const failure = describeAwsFailure(error);
7334
+ if (failure.redacted) this.logger.debug(mask(`Failed to ${operation} SNS topic policy ${logicalId}: ${failure.detail}`));
7335
+ const cause = error instanceof Error ? error : void 0;
7336
+ const wrapped = new ProvisioningError(`Failed to ${operation} SNS topic policy ${logicalId}: ${failure.summary}`, resourceType, logicalId, physicalId, cause);
7337
+ return failure.redacted && cause !== void 0 ? markRedactedCause(wrapped) : wrapped;
7338
+ }
7305
7339
  async resetTopicPolicy(topicArn, resourceType, logicalId, expectedRegion, phase = "not-found", mask = (t) => t) {
7306
7340
  const defaultPolicy = defaultTopicPolicy(topicArn);
7307
7341
  if (defaultPolicy === void 0) throw new ProvisioningError(`Cannot remove SNS topic policy ${logicalId} from ${topicArn}: not an SNS topic ARN`, resourceType, logicalId, topicArn);
@@ -10016,7 +10050,7 @@ var LambdaMicrovmImageProvider = class {
10016
10050
  }
10017
10051
  if (state === "CREATE_FAILED" || state === "UPDATE_FAILED") throw new Error(`MicroVM image ${logicalId} (${imageArn}) entered ${state} during ${operation}. Check the build logs in CloudWatch under /aws/lambda/microvms/ to diagnose.`);
10018
10052
  this.logger.debug(`MicroVM image ${imageArn} state: ${state} (attempt ${attempt}/${this.maxPollAttempts})`);
10019
- await sleep$1(this.pollIntervalMs);
10053
+ await sleep$2(this.pollIntervalMs);
10020
10054
  }
10021
10055
  throw new Error(`MicroVM image ${logicalIdShown(logicalId)} ${isPlainImportValue(imageArn) ? `(${imageArn})` : VALUE_NOT_SHOWN} did not finish ${operation} within ${this.maxPollAttempts * this.pollIntervalMs / 1e3}s. Increase --resource-timeout AWS::Lambda::MicrovmImage=${commandHole("duration")} or set CDKD_NO_WAIT=true.`);
10022
10056
  }
@@ -10031,7 +10065,7 @@ var LambdaMicrovmImageProvider = class {
10031
10065
  }
10032
10066
  if (resp.state === "DELETE_FAILED") throw new Error(`MicroVM image ${logicalId} (${imageArn}) entered DELETE_FAILED. Check the CloudWatch build logs under /aws/lambda/microvms/ to diagnose.`);
10033
10067
  this.logger.debug(`MicroVM image ${imageArn} state: ${resp.state} (delete attempt ${attempt}/${this.maxPollAttempts})`);
10034
- await sleep$1(this.pollIntervalMs);
10068
+ await sleep$2(this.pollIntervalMs);
10035
10069
  }
10036
10070
  throw new Error(`MicroVM image ${logicalId} (${imageArn}) was not fully deleted within ${this.maxPollAttempts * this.pollIntervalMs / 1e3}s.`);
10037
10071
  }
@@ -10075,7 +10109,7 @@ function positiveIntFromEnv(value, dflt) {
10075
10109
  const n = Number(value);
10076
10110
  return Number.isFinite(n) && n > 0 ? n : dflt;
10077
10111
  }
10078
- function sleep$1(ms) {
10112
+ function sleep$2(ms) {
10079
10113
  return new Promise((resolve) => setTimeout(resolve, ms));
10080
10114
  }
10081
10115
  function buildCommonImageInput(properties) {
@@ -10143,6 +10177,947 @@ function isRecord$1(value) {
10143
10177
  return typeof value === "object" && value !== null && !Array.isArray(value);
10144
10178
  }
10145
10179
 
10180
+ //#endregion
10181
+ //#region src/provisioning/providers/lambda-web-function-arns.ts
10182
+ const CHILD_ARN = /^(arn:[^:]+:lambda:[^:]+:\d{12}:web-function\/[^/]+)\/(revision|endpoint)\/([^/]+)$/;
10183
+ function parseWebFunctionChildArn(arn, kind) {
10184
+ const match = CHILD_ARN.exec(arn);
10185
+ if (!match || match[2] !== kind) return void 0;
10186
+ return {
10187
+ functionArn: match[1],
10188
+ childId: match[3]
10189
+ };
10190
+ }
10191
+ function webFunctionNameOfArn(functionArn) {
10192
+ return functionArn.slice(functionArn.lastIndexOf("/") + 1);
10193
+ }
10194
+ function recordedFunctionNameSpelling(recorded, liveFunctionArn) {
10195
+ if (typeof recorded === "string" && (recorded === liveFunctionArn || recorded === webFunctionNameOfArn(liveFunctionArn))) return recorded;
10196
+ return liveFunctionArn;
10197
+ }
10198
+ function projectOntoRecorded(recorded, live) {
10199
+ if (!isPlainRecord$2(recorded) || !isPlainRecord$2(live)) return live;
10200
+ const out = {};
10201
+ for (const key of Object.keys(recorded)) {
10202
+ if (!Object.prototype.hasOwnProperty.call(live, key)) continue;
10203
+ out[key] = projectOntoRecorded(recorded[key], live[key]);
10204
+ }
10205
+ return out;
10206
+ }
10207
+ function isPlainRecord$2(value) {
10208
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10209
+ }
10210
+ const LAMBDA_WEB_MAX_POLL_ATTEMPTS = 1200;
10211
+ function sleep$1(ms) {
10212
+ return new Promise((resolve) => setTimeout(resolve, ms));
10213
+ }
10214
+
10215
+ //#endregion
10216
+ //#region src/provisioning/providers/lambda-web-function-revision-provider.ts
10217
+ const createRevisionLatch = new AmbiguousCreateLatch("lambda-web:CreateWebFunctionRevision");
10218
+ const revisionsCreatedByThisProcess = new RecentIdSet();
10219
+ var LambdaWebFunctionRevisionProvider = class {
10220
+ client;
10221
+ createClient;
10222
+ logger = getLogger().child("LambdaWebFunctionRevisionProvider");
10223
+ constructor() {
10224
+ this.client = getAwsClients().lambdaWeb;
10225
+ }
10226
+ handledProperties = /* @__PURE__ */ new Map([["AWS::Lambda::WebFunctionRevision", /* @__PURE__ */ new Set([
10227
+ "FunctionName",
10228
+ "Description",
10229
+ "KmsKeyArn",
10230
+ "BuildConfig",
10231
+ "ServiceConfig"
10232
+ ])]]);
10233
+ unhandledByDesign = /* @__PURE__ */ new Map([["AWS::Lambda::WebFunctionRevision", /* @__PURE__ */ new Map([
10234
+ ["FunctionArn", "AWS-managed read-only attribute"],
10235
+ ["RevisionId", "AWS-managed read-only attribute"],
10236
+ ["RevisionArn", "AWS-managed read-only attribute (primaryIdentifier / physical id)"],
10237
+ ["State", "AWS-managed read-only attribute"],
10238
+ ["StateReason", "AWS-managed read-only attribute"],
10239
+ ["CreatedAt", "AWS-managed read-only attribute"]
10240
+ ])]]);
10241
+ getMinResourceTimeoutMs() {
10242
+ return LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500;
10243
+ }
10244
+ async create(logicalId, resourceType, properties, context) {
10245
+ this.logger.debug(safeMsg`Creating Lambda web function revision ${logicalId}`);
10246
+ const input = this.buildCreateInput(logicalId, resourceType, properties, context);
10247
+ const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
10248
+ let createdArn;
10249
+ try {
10250
+ const orphanWindow = createRevisionLatch.take(logicalId);
10251
+ if (orphanWindow !== void 0) await this.reportPossibleRevisionOrphans(logicalId, orphanWindow, log, input.functionName);
10252
+ const createClient = await this.getCreateClient();
10253
+ const attemptStartMs = Date.now();
10254
+ let response;
10255
+ try {
10256
+ response = await createClient.send(new CreateWebFunctionRevisionCommand(input));
10257
+ } catch (error) {
10258
+ createRevisionLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
10259
+ throw error;
10260
+ }
10261
+ createdArn = response.revisionArn;
10262
+ if (createdArn) revisionsCreatedByThisProcess.add(createdArn);
10263
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
10264
+ if (replayWindow !== void 0) await this.reportPossibleRevisionOrphans(logicalId, replayWindow, log, input.functionName);
10265
+ if (!createdArn || !response.revisionId) throw new ProvisioningError(`CreateWebFunctionRevision succeeded but returned no revision ARN for ${logicalIdShown(logicalId)}`, resourceType, logicalId);
10266
+ const active = await this.waitForActive(input.functionName, createdArn, logicalId);
10267
+ return {
10268
+ physicalId: createdArn,
10269
+ attributes: buildAttributes$2(active)
10270
+ };
10271
+ } catch (error) {
10272
+ const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10273
+ if (createdArn) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdArn);
10274
+ throw thrown;
10275
+ }
10276
+ }
10277
+ getCreateClient() {
10278
+ this.createClient ??= this.client.config.region().then((region) => withoutServerErrorRetries(new LambdaWebClient({
10279
+ ...ambientClientDefaults(),
10280
+ region
10281
+ })), (error) => {
10282
+ this.createClient = void 0;
10283
+ throw error;
10284
+ });
10285
+ return this.createClient;
10286
+ }
10287
+ async reportPossibleRevisionOrphans(logicalId, window, log, functionName) {
10288
+ const aws = pasteableAwsCommand(log.mask);
10289
+ const regionArg = await orphanCommandRegionArg(this.client, aws);
10290
+ await reportPossibleOrphans(logicalId, window, log, {
10291
+ action: "CreateWebFunctionRevision",
10292
+ service: "Lambda",
10293
+ listAction: "ListWebFunctionRevisions",
10294
+ subject: `a revision of web function ${log.value(functionName)}`,
10295
+ noun: "revision(s)",
10296
+ list: () => collectOrphanIds(async (token) => {
10297
+ const page = await this.client.send(new ListWebFunctionRevisionsCommand({
10298
+ functionName,
10299
+ ...token && { nextToken: token }
10300
+ }));
10301
+ return {
10302
+ items: page.revisions ?? [],
10303
+ next: page.nextToken
10304
+ };
10305
+ }, (item) => item.revisionArn && isInsideWindow(item.createdAt, window) && !revisionsCreatedByThisProcess.has(item.revisionArn) ? item.revisionArn : void 0),
10306
+ inspect: (id) => aws`aws cloudcontrol get-resource --type-name AWS::Lambda::WebFunctionRevision --identifier ${id}${regionArg}`.render(),
10307
+ remove: (id) => aws`aws cloudcontrol delete-resource --type-name AWS::Lambda::WebFunctionRevision --identifier ${id}${regionArg}`.render()
10308
+ });
10309
+ }
10310
+ async update(logicalId, physicalId, resourceType, _properties, _previousProperties, context) {
10311
+ assertRegionMatch(context?.expectedRegion ? await this.client.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
10312
+ return Promise.reject(new ResourceUpdateNotSupportedError(resourceType, logicalId, "A Lambda web function revision is immutable — every property is create-only and there is no update API, so any change creates a new revision. cdkd normally classifies such a change as a replacement, so reaching this path is unexpected; re-run the deploy."));
10313
+ }
10314
+ async delete(logicalId, physicalId, resourceType, _properties, context) {
10315
+ this.logger.debug(safeMsg`Deleting Lambda web function revision ${logicalId}`);
10316
+ const parts = parseWebFunctionChildArn(physicalId, "revision");
10317
+ if (!parts) throw new ProvisioningError(`Cannot delete Lambda web function revision ${logicalIdShown(logicalId)}: its recorded id is not a revision ARN`, resourceType, logicalId, physicalId);
10318
+ try {
10319
+ try {
10320
+ await this.client.send(new DeleteWebFunctionRevisionCommand({
10321
+ functionName: parts.functionArn,
10322
+ revisionId: physicalId
10323
+ }));
10324
+ } catch (error) {
10325
+ if (error instanceof ResourceNotFoundException$9) {
10326
+ assertRegionMatch(await this.client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
10327
+ this.logger.debug(safeMsg`Lambda web function revision ${logicalId} does not exist, skipping deletion`);
10328
+ return;
10329
+ }
10330
+ throw error;
10331
+ }
10332
+ await this.waitForGone(parts.functionArn, physicalId, logicalId);
10333
+ } catch (error) {
10334
+ throw this.wrapError("delete", logicalId, resourceType, physicalId, error);
10335
+ }
10336
+ }
10337
+ async getAttribute(physicalId, _resourceType, attributeName) {
10338
+ const parts = parseWebFunctionChildArn(physicalId, "revision");
10339
+ if (attributeName === "RevisionArn") return physicalId;
10340
+ if (attributeName === "RevisionId" && parts) return parts.childId;
10341
+ if (attributeName === "FunctionArn" && parts) return parts.functionArn;
10342
+ if (!parts) return void 0;
10343
+ return buildAttributes$2(await this.client.send(new GetWebFunctionRevisionCommand({
10344
+ functionName: parts.functionArn,
10345
+ revisionId: physicalId
10346
+ })))[attributeName];
10347
+ }
10348
+ async import(input) {
10349
+ const arn = input.knownPhysicalId;
10350
+ if (!arn) return null;
10351
+ const parts = parseWebFunctionChildArn(arn, "revision");
10352
+ if (!parts) throw new Error(`--resource override for ${logicalIdShown(input.logicalId)} must be a Lambda web function revision ARN (got ${isPlainImportValue(arn) ? `'${arn}'` : VALUE_NOT_SHOWN}); use the arn:...:web-function/<name>/revision/<id> ARN.`);
10353
+ try {
10354
+ return {
10355
+ physicalId: arn,
10356
+ attributes: buildAttributes$2(await this.client.send(new GetWebFunctionRevisionCommand({
10357
+ functionName: parts.functionArn,
10358
+ revisionId: arn
10359
+ })))
10360
+ };
10361
+ } catch (error) {
10362
+ if (error instanceof ResourceNotFoundException$9) return null;
10363
+ throw error;
10364
+ }
10365
+ }
10366
+ async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
10367
+ const parts = parseWebFunctionChildArn(physicalId, "revision");
10368
+ if (!parts) return void 0;
10369
+ let resp;
10370
+ try {
10371
+ resp = await this.client.send(new GetWebFunctionRevisionCommand({
10372
+ functionName: parts.functionArn,
10373
+ revisionId: physicalId
10374
+ }));
10375
+ } catch (error) {
10376
+ if (error instanceof ResourceNotFoundException$9) return RESOURCE_NOT_FOUND;
10377
+ throw error;
10378
+ }
10379
+ const live = { FunctionName: recordedFunctionNameSpelling(properties?.["FunctionName"], resp.functionArn ?? parts.functionArn) };
10380
+ if (resp.description !== void 0) live["Description"] = resp.description;
10381
+ if (resp.kmsKeyArn !== void 0) live["KmsKeyArn"] = resp.kmsKeyArn;
10382
+ if (resp.buildConfig) live["BuildConfig"] = buildConfigToCfn(resp.buildConfig);
10383
+ if (resp.serviceConfig) live["ServiceConfig"] = serviceConfigToCfn(resp.serviceConfig);
10384
+ if (!properties) return live;
10385
+ const out = { FunctionName: live["FunctionName"] };
10386
+ for (const key of [
10387
+ "Description",
10388
+ "KmsKeyArn",
10389
+ "BuildConfig",
10390
+ "ServiceConfig"
10391
+ ]) if (key in live) out[key] = projectOntoRecorded(properties[key], live[key]);
10392
+ return out;
10393
+ }
10394
+ buildCreateInput(logicalId, resourceType, properties, context) {
10395
+ const fail = (message) => {
10396
+ throw new ProvisioningError(`${message} for Lambda web function revision ${logicalIdShown(logicalId)}`, resourceType, logicalId);
10397
+ };
10398
+ const functionName = properties["FunctionName"];
10399
+ if (typeof functionName !== "string" || functionName === "") fail("FunctionName must be a non-empty string");
10400
+ const build = properties["BuildConfig"];
10401
+ if (!isPlainRecord$2(build)) fail("BuildConfig must be an object");
10402
+ const code = build["CodeConfig"];
10403
+ const s3 = isPlainRecord$2(code) ? code["S3Object"] : void 0;
10404
+ if (!isPlainRecord$2(s3) || typeof s3["Bucket"] !== "string" || typeof s3["Key"] !== "string") fail("BuildConfig.CodeConfig.S3Object.Bucket and .Key are required strings");
10405
+ const runtimeConfig = build["RuntimeConfig"];
10406
+ const runtime = isPlainRecord$2(runtimeConfig) ? runtimeConfig["Runtime"] : void 0;
10407
+ if (typeof runtime !== "string") fail("BuildConfig.RuntimeConfig.Runtime is a required string");
10408
+ const service = properties["ServiceConfig"];
10409
+ if (!isPlainRecord$2(service) || typeof service["ExecutionRoleArn"] !== "string") fail("ServiceConfig.ExecutionRoleArn is a required string");
10410
+ const s3Object = s3;
10411
+ const input = {
10412
+ functionName,
10413
+ buildConfig: {
10414
+ codeConfig: { s3Object: {
10415
+ bucket: s3Object["Bucket"],
10416
+ key: s3Object["Key"],
10417
+ ...typeof s3Object["VersionId"] === "string" ? { versionId: s3Object["VersionId"] } : {}
10418
+ } },
10419
+ runtimeConfig: { runtime }
10420
+ },
10421
+ serviceConfig: this.buildServiceConfig(service, fail, context)
10422
+ };
10423
+ if (typeof properties["Description"] === "string") input.description = properties["Description"];
10424
+ if (typeof properties["KmsKeyArn"] === "string") input.kmsKeyArn = properties["KmsKeyArn"];
10425
+ return input;
10426
+ }
10427
+ buildServiceConfig(service, fail, context) {
10428
+ const out = { executionRoleArn: service["ExecutionRoleArn"] };
10429
+ const integer = (key) => {
10430
+ const raw = service[key];
10431
+ if (raw === void 0) return void 0;
10432
+ const n = coerceCfnInteger(raw);
10433
+ if (n !== void 0) return n;
10434
+ const message = `ServiceConfig.${key} must be an integer`;
10435
+ if (context?.replayingState) {
10436
+ this.logger.warn(safeMsg`${message}; omitting it while replaying a state record`);
10437
+ return;
10438
+ }
10439
+ return fail(message);
10440
+ };
10441
+ const timeoutSeconds = integer("TimeoutSeconds");
10442
+ if (timeoutSeconds !== void 0) out.timeoutSeconds = timeoutSeconds;
10443
+ const maxConcurrencyPerEnvironment = integer("MaxConcurrencyPerEnvironment");
10444
+ if (maxConcurrencyPerEnvironment !== void 0) out.maxConcurrencyPerEnvironment = maxConcurrencyPerEnvironment;
10445
+ if (typeof service["EgressNetworkConnectorArn"] === "string") out.egressNetworkConnectorArn = service["EgressNetworkConnectorArn"];
10446
+ const env = service["EnvironmentVariables"];
10447
+ if (env !== void 0) {
10448
+ if (isPlainRecord$2(env) && Object.values(env).every((v) => typeof v === "string")) out.environmentVariables = { ...env };
10449
+ else if (context?.replayingState) this.logger.warn(safeMsg`ServiceConfig.EnvironmentVariables must be an object of string values; omitting it while replaying a state record`);
10450
+ else fail("ServiceConfig.EnvironmentVariables must be an object of string values");
10451
+ }
10452
+ const telemetry = service["TelemetryConfig"];
10453
+ if (isPlainRecord$2(telemetry)) {
10454
+ const telemetryConfig = {};
10455
+ const logging = telemetry["LoggingConfig"];
10456
+ if (isPlainRecord$2(logging)) {
10457
+ const loggingConfig = {};
10458
+ if (typeof logging["LogGroup"] === "string") loggingConfig.logGroup = logging["LogGroup"];
10459
+ if (typeof logging["ApplicationLogLevel"] === "string") loggingConfig.applicationLogLevel = logging["ApplicationLogLevel"];
10460
+ if (typeof logging["SystemLogLevel"] === "string") loggingConfig.systemLogLevel = logging["SystemLogLevel"];
10461
+ telemetryConfig.loggingConfig = loggingConfig;
10462
+ }
10463
+ out.telemetryConfig = telemetryConfig;
10464
+ }
10465
+ return out;
10466
+ }
10467
+ async waitForActive(functionName, revisionArn, logicalId) {
10468
+ for (let attempt = 1; attempt <= LAMBDA_WEB_MAX_POLL_ATTEMPTS; attempt++) {
10469
+ const resp = await this.client.send(new GetWebFunctionRevisionCommand({
10470
+ functionName,
10471
+ revisionId: revisionArn
10472
+ }));
10473
+ if (resp.state === "Active") return resp;
10474
+ if (resp.state === "Failed") {
10475
+ const errors = (resp.errors ?? []).map((e) => `${e.errorCode ?? ""} ${e.errorMessage ?? ""}`.trim());
10476
+ throw new Error(`Lambda web function revision ${logicalIdShown(logicalId)} entered Failed: ${resp.stateReason ?? "no reason given"}` + (errors.length > 0 ? ` (${errors.join("; ")})` : ""));
10477
+ }
10478
+ await sleep$1(500);
10479
+ }
10480
+ throw new Error(`Lambda web function revision ${logicalIdShown(logicalId)} did not become Active within ${LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500 / 1e3}s.`);
10481
+ }
10482
+ async waitForGone(functionName, revisionArn, logicalId) {
10483
+ for (let attempt = 1; attempt <= LAMBDA_WEB_MAX_POLL_ATTEMPTS; attempt++) {
10484
+ try {
10485
+ await this.client.send(new GetWebFunctionRevisionCommand({
10486
+ functionName,
10487
+ revisionId: revisionArn
10488
+ }));
10489
+ } catch (error) {
10490
+ if (error instanceof ResourceNotFoundException$9) return;
10491
+ throw error;
10492
+ }
10493
+ await sleep$1(500);
10494
+ }
10495
+ throw new Error(`Lambda web function revision ${logicalIdShown(logicalId)} was not fully deleted within ${LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500 / 1e3}s.`);
10496
+ }
10497
+ wrapError(operation, logicalId, resourceType, physicalId, error) {
10498
+ if (error instanceof ProvisioningError) return error;
10499
+ const cause = error instanceof Error ? error : void 0;
10500
+ return new ProvisioningError(`Failed to ${operation} Lambda web function revision ${logicalIdShown(logicalId)}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
10501
+ }
10502
+ };
10503
+ function buildAttributes$2(resp) {
10504
+ return definedAttributes({
10505
+ RevisionArn: resp.revisionArn,
10506
+ RevisionId: resp.revisionId,
10507
+ FunctionArn: resp.functionArn,
10508
+ State: resp.state,
10509
+ StateReason: resp.stateReason,
10510
+ CreatedAt: resp.createdAt?.toISOString()
10511
+ });
10512
+ }
10513
+ function buildConfigToCfn(config) {
10514
+ const out = {};
10515
+ const s3 = config.codeConfig && "s3Object" in config.codeConfig ? config.codeConfig.s3Object : void 0;
10516
+ if (s3) {
10517
+ const S3Object = {
10518
+ Bucket: s3.bucket,
10519
+ Key: s3.key
10520
+ };
10521
+ if (s3.versionId !== void 0) S3Object["VersionId"] = s3.versionId;
10522
+ out["CodeConfig"] = { S3Object };
10523
+ }
10524
+ if (config.runtimeConfig) out["RuntimeConfig"] = { Runtime: config.runtimeConfig.runtime };
10525
+ return out;
10526
+ }
10527
+ function serviceConfigToCfn(config) {
10528
+ const out = { ExecutionRoleArn: config.executionRoleArn };
10529
+ if (config.timeoutSeconds !== void 0) out["TimeoutSeconds"] = config.timeoutSeconds;
10530
+ if (config.maxConcurrencyPerEnvironment !== void 0) out["MaxConcurrencyPerEnvironment"] = config.maxConcurrencyPerEnvironment;
10531
+ if (config.egressNetworkConnectorArn !== void 0) out["EgressNetworkConnectorArn"] = config.egressNetworkConnectorArn;
10532
+ if (config.environmentVariables !== void 0) out["EnvironmentVariables"] = { ...config.environmentVariables };
10533
+ const logging = config.telemetryConfig?.loggingConfig;
10534
+ if (logging) {
10535
+ const LoggingConfig = {};
10536
+ if (logging.logGroup !== void 0) LoggingConfig["LogGroup"] = logging.logGroup;
10537
+ if (logging.applicationLogLevel !== void 0) LoggingConfig["ApplicationLogLevel"] = logging.applicationLogLevel;
10538
+ if (logging.systemLogLevel !== void 0) LoggingConfig["SystemLogLevel"] = logging.systemLogLevel;
10539
+ out["TelemetryConfig"] = { LoggingConfig };
10540
+ }
10541
+ return out;
10542
+ }
10543
+
10544
+ //#endregion
10545
+ //#region src/provisioning/providers/lambda-web-function-endpoint-provider.ts
10546
+ var LambdaWebFunctionEndpointProvider = class {
10547
+ client;
10548
+ logger = getLogger().child("LambdaWebFunctionEndpointProvider");
10549
+ constructor() {
10550
+ this.client = getAwsClients().lambdaWeb;
10551
+ }
10552
+ handledProperties = /* @__PURE__ */ new Map([["AWS::Lambda::WebFunctionEndpoint", /* @__PURE__ */ new Set([
10553
+ "FunctionName",
10554
+ "EndpointName",
10555
+ "Description",
10556
+ "EndpointType",
10557
+ "AuthType",
10558
+ "RevisionWeights",
10559
+ "Regions",
10560
+ "ScalingConfig",
10561
+ "ThrottleConfig"
10562
+ ])]]);
10563
+ unhandledByDesign = /* @__PURE__ */ new Map([["AWS::Lambda::WebFunctionEndpoint", /* @__PURE__ */ new Map([
10564
+ ["FunctionArn", "AWS-managed read-only attribute"],
10565
+ ["EndpointArn", "AWS-managed read-only attribute (primaryIdentifier / physical id)"],
10566
+ ["DomainName", "AWS-managed read-only attribute"],
10567
+ ["State", "AWS-managed read-only attribute"],
10568
+ ["StateReason", "AWS-managed read-only attribute"],
10569
+ ["UpdateStatus", "AWS-managed read-only attribute"],
10570
+ ["UpdateStatusReason", "AWS-managed read-only attribute"],
10571
+ ["RegionalEndpoints", "AWS-managed read-only attribute"],
10572
+ ["CreatedAt", "AWS-managed read-only attribute"],
10573
+ ["UpdatedAt", "AWS-managed read-only attribute"]
10574
+ ])]]);
10575
+ getMinResourceTimeoutMs() {
10576
+ return LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500;
10577
+ }
10578
+ async create(logicalId, resourceType, properties, context) {
10579
+ this.logger.debug(safeMsg`Creating Lambda web function endpoint ${logicalId}`);
10580
+ const fail = this.refusal(logicalId, resourceType);
10581
+ const lenient = context?.replayingState === true;
10582
+ const functionName = properties["FunctionName"];
10583
+ const endpointName = properties["EndpointName"];
10584
+ const endpointType = properties["EndpointType"];
10585
+ const authType = properties["AuthType"];
10586
+ for (const [key, value] of [
10587
+ ["FunctionName", functionName],
10588
+ ["EndpointName", endpointName],
10589
+ ["EndpointType", endpointType],
10590
+ ["AuthType", authType]
10591
+ ]) if (typeof value !== "string" || value === "") fail(`${key} must be a non-empty string`);
10592
+ const input = {
10593
+ functionName,
10594
+ endpointName,
10595
+ endpointType,
10596
+ authType
10597
+ };
10598
+ if (typeof properties["Description"] === "string") input.description = properties["Description"];
10599
+ const weights = readRevisionWeights(properties["RevisionWeights"], fail);
10600
+ if (weights !== void 0) input.revisionWeights = weights.map((w) => ({
10601
+ revisionId: w.RevisionId,
10602
+ weight: w.Weight
10603
+ }));
10604
+ if (properties["Regions"] !== void 0) {
10605
+ const regions = properties["Regions"];
10606
+ if (!Array.isArray(regions) || regions.some((r) => typeof r !== "string")) fail("Regions must be a list of strings");
10607
+ input.regions = [...regions];
10608
+ }
10609
+ const scaling = this.readIntegerBlock(properties["ScalingConfig"], "ScalingConfig", "MaxEnvironments", fail, lenient);
10610
+ if (scaling !== void 0) input.scalingConfig = scaling.present ? { maxEnvironments: scaling.n } : {};
10611
+ const throttle = this.readIntegerBlock(properties["ThrottleConfig"], "ThrottleConfig", "RateLimit", fail, lenient);
10612
+ if (throttle !== void 0) input.throttleConfig = throttle.present ? { rateLimit: throttle.n } : {};
10613
+ let createdArn;
10614
+ try {
10615
+ createdArn = (await this.client.send(new CreateWebFunctionEndpointCommand(input))).endpointArn;
10616
+ if (!createdArn) throw new ProvisioningError(`CreateWebFunctionEndpoint succeeded but returned no endpoint ARN for ${logicalIdShown(logicalId)}`, resourceType, logicalId);
10617
+ const settled = await this.waitForSettled(input.functionName, input.endpointName, logicalId, "create");
10618
+ return {
10619
+ physicalId: createdArn,
10620
+ attributes: buildAttributes$1(settled)
10621
+ };
10622
+ } catch (error) {
10623
+ const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10624
+ if (createdArn) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdArn);
10625
+ throw thrown;
10626
+ }
10627
+ }
10628
+ async update(logicalId, physicalId, resourceType, properties, _previousProperties, context) {
10629
+ assertRegionMatch(context?.expectedRegion ? await this.client.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
10630
+ const parts = parseWebFunctionChildArn(physicalId, "endpoint");
10631
+ if (!parts) throw new ProvisioningError(`Cannot update Lambda web function endpoint ${logicalIdShown(logicalId)}: its recorded id is not an endpoint ARN`, resourceType, logicalId, physicalId);
10632
+ const fail = this.refusal(logicalId, resourceType, physicalId);
10633
+ const lenient = context?.replayingState === true || context?.desiredFromAwsReadback === true;
10634
+ const input = {
10635
+ functionName: parts.functionArn,
10636
+ endpointName: parts.childId,
10637
+ description: typeof properties["Description"] === "string" ? properties["Description"] : ""
10638
+ };
10639
+ if (typeof properties["AuthType"] === "string") input.authType = properties["AuthType"];
10640
+ const weights = readRevisionWeights(properties["RevisionWeights"], fail);
10641
+ if (weights !== void 0) input.revisionWeights = weights.map((w) => ({
10642
+ revisionId: w.RevisionId,
10643
+ weight: w.Weight
10644
+ }));
10645
+ else if (!lenient) fail("RevisionWeights is required; AWS keeps routing to the current revisions when it is removed");
10646
+ const scaling = this.readIntegerBlock(properties["ScalingConfig"], "ScalingConfig", "MaxEnvironments", fail, lenient);
10647
+ if (properties["ScalingConfig"] === void 0) input.scalingConfig = {};
10648
+ else if (scaling !== void 0) input.scalingConfig = scaling.present ? { maxEnvironments: scaling.n } : {};
10649
+ const throttle = this.readIntegerBlock(properties["ThrottleConfig"], "ThrottleConfig", "RateLimit", fail, lenient);
10650
+ if (properties["ThrottleConfig"] === void 0) input.throttleConfig = {};
10651
+ else if (throttle !== void 0) input.throttleConfig = throttle.present ? { rateLimit: throttle.n } : {};
10652
+ try {
10653
+ await this.client.send(new UpdateWebFunctionEndpointCommand(input));
10654
+ return {
10655
+ physicalId,
10656
+ wasReplaced: false,
10657
+ attributes: buildAttributes$1(await this.waitForSettled(parts.functionArn, parts.childId, logicalId, "update", input.revisionWeights))
10658
+ };
10659
+ } catch (error) {
10660
+ throw this.wrapError("update", logicalId, resourceType, physicalId, error);
10661
+ }
10662
+ }
10663
+ async delete(logicalId, physicalId, resourceType, _properties, context) {
10664
+ this.logger.debug(safeMsg`Deleting Lambda web function endpoint ${logicalId}`);
10665
+ const parts = parseWebFunctionChildArn(physicalId, "endpoint");
10666
+ if (!parts) throw new ProvisioningError(`Cannot delete Lambda web function endpoint ${logicalIdShown(logicalId)}: its recorded id is not an endpoint ARN`, resourceType, logicalId, physicalId);
10667
+ try {
10668
+ try {
10669
+ await this.client.send(new DeleteWebFunctionEndpointCommand({
10670
+ functionName: parts.functionArn,
10671
+ endpointName: parts.childId
10672
+ }));
10673
+ } catch (error) {
10674
+ if (error instanceof ResourceNotFoundException$9) {
10675
+ assertRegionMatch(await this.client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
10676
+ this.logger.debug(safeMsg`Lambda web function endpoint ${logicalId} does not exist, skipping deletion`);
10677
+ return;
10678
+ }
10679
+ throw error;
10680
+ }
10681
+ await this.waitForGone(parts.functionArn, parts.childId, logicalId);
10682
+ } catch (error) {
10683
+ throw this.wrapError("delete", logicalId, resourceType, physicalId, error);
10684
+ }
10685
+ }
10686
+ async getAttribute(physicalId, _resourceType, attributeName) {
10687
+ if (attributeName === "EndpointArn") return physicalId;
10688
+ const parts = parseWebFunctionChildArn(physicalId, "endpoint");
10689
+ if (!parts) return void 0;
10690
+ if (attributeName === "FunctionArn") return parts.functionArn;
10691
+ return buildAttributes$1(await this.client.send(new GetWebFunctionEndpointCommand({
10692
+ functionName: parts.functionArn,
10693
+ endpointName: parts.childId
10694
+ })))[attributeName];
10695
+ }
10696
+ async import(input) {
10697
+ let functionName;
10698
+ let endpointName;
10699
+ if (input.knownPhysicalId) {
10700
+ const parts = parseWebFunctionChildArn(input.knownPhysicalId, "endpoint");
10701
+ if (!parts) throw new Error(`--resource override for ${logicalIdShown(input.logicalId)} must be a Lambda web function endpoint ARN (got ${isPlainImportValue(input.knownPhysicalId) ? `'${input.knownPhysicalId}'` : VALUE_NOT_SHOWN}); use the arn:...:web-function/<name>/endpoint/<endpoint> ARN.`);
10702
+ functionName = parts.functionArn;
10703
+ endpointName = parts.childId;
10704
+ } else {
10705
+ const props = input.properties ?? {};
10706
+ if (typeof props["FunctionName"] !== "string" || typeof props["EndpointName"] !== "string") return null;
10707
+ functionName = props["FunctionName"];
10708
+ endpointName = props["EndpointName"];
10709
+ }
10710
+ try {
10711
+ const resp = await this.client.send(new GetWebFunctionEndpointCommand({
10712
+ functionName,
10713
+ endpointName
10714
+ }));
10715
+ if (!resp.endpointArn) return null;
10716
+ return {
10717
+ physicalId: resp.endpointArn,
10718
+ attributes: buildAttributes$1(resp)
10719
+ };
10720
+ } catch (error) {
10721
+ if (error instanceof ResourceNotFoundException$9) return null;
10722
+ throw error;
10723
+ }
10724
+ }
10725
+ async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
10726
+ const parts = parseWebFunctionChildArn(physicalId, "endpoint");
10727
+ if (!parts) return void 0;
10728
+ let resp;
10729
+ try {
10730
+ resp = await this.client.send(new GetWebFunctionEndpointCommand({
10731
+ functionName: parts.functionArn,
10732
+ endpointName: parts.childId
10733
+ }));
10734
+ } catch (error) {
10735
+ if (error instanceof ResourceNotFoundException$9) return RESOURCE_NOT_FOUND;
10736
+ throw error;
10737
+ }
10738
+ const live = {
10739
+ FunctionName: recordedFunctionNameSpelling(properties?.["FunctionName"], resp.functionArn ?? parts.functionArn),
10740
+ EndpointName: resp.endpointName ?? parts.childId
10741
+ };
10742
+ if (resp.description !== void 0) live["Description"] = resp.description;
10743
+ if (resp.endpointType !== void 0) live["EndpointType"] = resp.endpointType;
10744
+ if (resp.authType !== void 0) live["AuthType"] = resp.authType;
10745
+ if (resp.revisionWeights !== void 0) live["RevisionWeights"] = resp.revisionWeights.map((w) => ({
10746
+ RevisionId: w.revisionId,
10747
+ Weight: w.weight
10748
+ }));
10749
+ if (resp.regions !== void 0) live["Regions"] = [...resp.regions];
10750
+ if (resp.scalingConfig !== void 0) live["ScalingConfig"] = resp.scalingConfig.maxEnvironments !== void 0 ? { MaxEnvironments: resp.scalingConfig.maxEnvironments } : {};
10751
+ if (resp.throttleConfig !== void 0) live["ThrottleConfig"] = resp.throttleConfig.rateLimit !== void 0 ? { RateLimit: resp.throttleConfig.rateLimit } : {};
10752
+ if (!properties) return live;
10753
+ const out = {};
10754
+ for (const [key, value] of Object.entries(live)) out[key] = key === "ScalingConfig" || key === "ThrottleConfig" ? value : projectOntoRecorded(properties[key], value);
10755
+ return out;
10756
+ }
10757
+ refusal(logicalId, resourceType, physicalId) {
10758
+ return (message) => {
10759
+ throw new ProvisioningError(`${message} for Lambda web function endpoint ${logicalIdShown(logicalId)}`, resourceType, logicalId, physicalId);
10760
+ };
10761
+ }
10762
+ readIntegerBlock(value, blockKey, memberKey, fail, lenient) {
10763
+ if (value === void 0) return void 0;
10764
+ const bad = (message) => {
10765
+ if (lenient) {
10766
+ this.logger.warn(safeMsg`${message}; leaving the live ${blockKey} unchanged`);
10767
+ return;
10768
+ }
10769
+ return fail(message);
10770
+ };
10771
+ if (!isPlainRecord$2(value)) return bad(`${blockKey} must be an object`);
10772
+ if (value[memberKey] === void 0) return { present: false };
10773
+ const n = coerceCfnInteger(value[memberKey]);
10774
+ if (n === void 0) return bad(`${blockKey}.${memberKey} must be an integer`);
10775
+ return {
10776
+ present: true,
10777
+ n
10778
+ };
10779
+ }
10780
+ async waitForSettled(functionName, endpointName, logicalId, operation, sentWeights) {
10781
+ for (let attempt = 1; attempt <= LAMBDA_WEB_MAX_POLL_ATTEMPTS; attempt++) {
10782
+ let resp;
10783
+ try {
10784
+ resp = await this.client.send(new GetWebFunctionEndpointCommand({
10785
+ functionName,
10786
+ endpointName
10787
+ }));
10788
+ } catch (error) {
10789
+ if (operation === "create" && attempt <= 10 && error instanceof ResourceNotFoundException$9) {
10790
+ await sleep$1(500);
10791
+ continue;
10792
+ }
10793
+ throw error;
10794
+ }
10795
+ if (resp.state === "Failed") throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} entered Failed: ${resp.stateReason ?? "no reason given"}`);
10796
+ if (resp.updateStatus === "Failed") throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} ${operation} failed: ${resp.updateStatusReason ?? "no reason given"}`);
10797
+ if (resp.state === "Active" && resp.updateStatus !== "InProgress" && (sentWeights === void 0 || sameWeights(sentWeights, resp.revisionWeights))) return resp;
10798
+ await sleep$1(500);
10799
+ }
10800
+ throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} did not finish ${operation} within ${LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500 / 1e3}s.`);
10801
+ }
10802
+ async waitForGone(functionName, endpointName, logicalId) {
10803
+ for (let attempt = 1; attempt <= LAMBDA_WEB_MAX_POLL_ATTEMPTS; attempt++) {
10804
+ try {
10805
+ await this.client.send(new GetWebFunctionEndpointCommand({
10806
+ functionName,
10807
+ endpointName
10808
+ }));
10809
+ } catch (error) {
10810
+ if (error instanceof ResourceNotFoundException$9) return;
10811
+ throw error;
10812
+ }
10813
+ await sleep$1(500);
10814
+ }
10815
+ throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} was not fully deleted within ${LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500 / 1e3}s.`);
10816
+ }
10817
+ wrapError(operation, logicalId, resourceType, physicalId, error) {
10818
+ if (error instanceof ProvisioningError) return error;
10819
+ const cause = error instanceof Error ? error : void 0;
10820
+ return new ProvisioningError(`Failed to ${operation} Lambda web function endpoint ${logicalIdShown(logicalId)}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
10821
+ }
10822
+ };
10823
+ function readRevisionWeights(value, fail) {
10824
+ if (value === void 0) return void 0;
10825
+ if (!Array.isArray(value)) return fail("RevisionWeights must be a list");
10826
+ return value.map((entry, i) => {
10827
+ if (!isPlainRecord$2(entry) || typeof entry["RevisionId"] !== "string") return fail(`RevisionWeights[${i}].RevisionId must be a string`);
10828
+ const weight = coerceCfnInteger(entry["Weight"]);
10829
+ if (weight === void 0) return fail(`RevisionWeights[${i}].Weight must be an integer`);
10830
+ return {
10831
+ RevisionId: entry["RevisionId"],
10832
+ Weight: weight
10833
+ };
10834
+ });
10835
+ }
10836
+ function sameWeights(a, b) {
10837
+ if (b === void 0 || a.length !== b.length) return false;
10838
+ const key = (w) => `${w.revisionId ?? ""}=${w.weight ?? ""}`;
10839
+ const left = a.map(key).sort();
10840
+ const right = b.map(key).sort();
10841
+ return left.every((k, i) => k === right[i]);
10842
+ }
10843
+ function buildAttributes$1(resp) {
10844
+ return definedAttributes({
10845
+ EndpointArn: resp.endpointArn,
10846
+ FunctionArn: resp.functionArn,
10847
+ DomainName: resp.domainName,
10848
+ State: resp.state,
10849
+ StateReason: resp.stateReason,
10850
+ UpdateStatus: resp.updateStatus,
10851
+ UpdateStatusReason: resp.updateStatusReason,
10852
+ CreatedAt: resp.createdAt?.toISOString(),
10853
+ UpdatedAt: resp.updatedAt?.toISOString()
10854
+ });
10855
+ }
10856
+
10857
+ //#endregion
10858
+ //#region src/provisioning/providers/lambda-network-connector-provider.ts
10859
+ const POLL_INTERVAL_MS$2 = 1e3;
10860
+ const MAX_POLL_ATTEMPTS = 1200;
10861
+ var LambdaNetworkConnectorProvider = class {
10862
+ client;
10863
+ lambda;
10864
+ logger = getLogger().child("LambdaNetworkConnectorProvider");
10865
+ constructor() {
10866
+ const clients = getAwsClients();
10867
+ this.client = clients.lambdaCore;
10868
+ this.lambda = clients.lambda;
10869
+ }
10870
+ handledProperties = /* @__PURE__ */ new Map([["AWS::Lambda::NetworkConnector", /* @__PURE__ */ new Set([
10871
+ "Name",
10872
+ "Configuration",
10873
+ "OperatorRole",
10874
+ "Tags"
10875
+ ])]]);
10876
+ unhandledByDesign = /* @__PURE__ */ new Map([["AWS::Lambda::NetworkConnector", /* @__PURE__ */ new Map([
10877
+ ["Arn", "AWS-managed read-only attribute (primaryIdentifier / physical id)"],
10878
+ ["State", "AWS-managed read-only attribute"],
10879
+ ["LatestVersionArn", "AWS-managed read-only attribute"],
10880
+ ["LatestVersion", "AWS-managed read-only attribute"]
10881
+ ])]]);
10882
+ getMinResourceTimeoutMs() {
10883
+ return MAX_POLL_ATTEMPTS * POLL_INTERVAL_MS$2;
10884
+ }
10885
+ async create(logicalId, resourceType, properties, context) {
10886
+ this.logger.debug(safeMsg`Creating Lambda network connector ${logicalId}`);
10887
+ const tagList = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
10888
+ const name = typeof properties["Name"] === "string" && properties["Name"] !== "" ? properties["Name"] : generateResourceName(logicalId, { maxLength: 64 });
10889
+ const vpc = this.readVpcEgress(properties, logicalId, resourceType, void 0);
10890
+ const createToken = acquireIdempotencyToken({
10891
+ scope: "CreateNetworkConnector",
10892
+ logicalId
10893
+ });
10894
+ const input = {
10895
+ Name: name,
10896
+ Configuration: { VpcEgressConfiguration: {
10897
+ SubnetIds: vpc.SubnetIds,
10898
+ SecurityGroupIds: vpc.SecurityGroupIds,
10899
+ NetworkProtocol: vpc.NetworkProtocol,
10900
+ AssociatedComputeResourceTypes: vpc.AssociatedComputeResourceTypes
10901
+ } },
10902
+ ClientToken: createToken.value
10903
+ };
10904
+ const operatorRole = this.readOperatorRole(properties, logicalId, resourceType, void 0, context);
10905
+ if (operatorRole !== void 0) input.OperatorRole = operatorRole;
10906
+ if (tagList.length > 0) input.Tags = Object.fromEntries(tagList.map((t) => [t.Key, t.Value]));
10907
+ let createdArn;
10908
+ try {
10909
+ createdArn = (await this.client.send(new CreateNetworkConnectorCommand(input))).Arn;
10910
+ if (!createdArn) throw new ProvisioningError(`CreateNetworkConnector succeeded but returned no ARN for ${logicalIdShown(logicalId)}`, resourceType, logicalId);
10911
+ const settled = await this.waitForSettled(createdArn, logicalId, "create");
10912
+ createToken.release();
10913
+ return {
10914
+ physicalId: createdArn,
10915
+ attributes: buildAttributes(settled)
10916
+ };
10917
+ } catch (error) {
10918
+ const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10919
+ if (error instanceof TerminalConnectorStateError) markNonRetryable(thrown);
10920
+ if (createdArn) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdArn);
10921
+ throw thrown;
10922
+ }
10923
+ }
10924
+ async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
10925
+ assertRegionMatch(context?.expectedRegion ? await this.client.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
10926
+ refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
10927
+ const vpc = this.readVpcEgress(properties, logicalId, resourceType, physicalId);
10928
+ const updateRole = this.readOperatorRole(properties, logicalId, resourceType, physicalId, context);
10929
+ if (typeof previousProperties["OperatorRole"] === "string" && properties["OperatorRole"] === void 0 && context?.replayingState !== true && context?.desiredFromAwsReadback !== true) throw new ProvisioningError(`OperatorRole cannot be removed in place for Lambda network connector ${logicalIdShown(logicalId)}: cdkd sends no role when the template declares none, so the current one would stay attached. Set it to another role, or replace the connector (change its Name).`, resourceType, logicalId, physicalId);
10930
+ try {
10931
+ const configChanged = JSON.stringify(properties["Configuration"]) !== JSON.stringify(previousProperties["Configuration"]) || properties["OperatorRole"] !== previousProperties["OperatorRole"];
10932
+ await this.reconcileTags(physicalId, resourceType, logicalId, properties["Tags"], previousProperties["Tags"]);
10933
+ if (configChanged) await this.client.send(new UpdateNetworkConnectorCommand({
10934
+ Identifier: physicalId,
10935
+ Configuration: { VpcEgressConfiguration: {
10936
+ SubnetIds: vpc.SubnetIds,
10937
+ SecurityGroupIds: vpc.SecurityGroupIds,
10938
+ NetworkProtocol: vpc.NetworkProtocol,
10939
+ AssociatedComputeResourceTypes: vpc.AssociatedComputeResourceTypes
10940
+ } },
10941
+ ...updateRole !== void 0 ? { OperatorRole: updateRole } : {},
10942
+ ClientToken: randomUUID()
10943
+ }));
10944
+ return {
10945
+ physicalId,
10946
+ wasReplaced: false,
10947
+ attributes: buildAttributes(configChanged ? await this.waitForSettled(physicalId, logicalId, "update") : await this.client.send(new GetNetworkConnectorCommand({ Identifier: physicalId })))
10948
+ };
10949
+ } catch (error) {
10950
+ throw this.wrapError("update", logicalId, resourceType, physicalId, error);
10951
+ }
10952
+ }
10953
+ async delete(logicalId, physicalId, resourceType, _properties, context) {
10954
+ this.logger.debug(safeMsg`Deleting Lambda network connector ${logicalId}`);
10955
+ try {
10956
+ try {
10957
+ await this.client.send(new DeleteNetworkConnectorCommand({ Identifier: physicalId }));
10958
+ } catch (error) {
10959
+ if (error instanceof ResourceNotFoundException$10) {
10960
+ assertRegionMatch(await this.client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
10961
+ this.logger.debug(safeMsg`Lambda network connector ${logicalId} does not exist, skipping deletion`);
10962
+ return;
10963
+ }
10964
+ throw error;
10965
+ }
10966
+ await this.waitForGone(physicalId, logicalId);
10967
+ } catch (error) {
10968
+ throw this.wrapError("delete", logicalId, resourceType, physicalId, error);
10969
+ }
10970
+ }
10971
+ async getAttribute(physicalId, _resourceType, attributeName) {
10972
+ if (attributeName === "Arn") return physicalId;
10973
+ return buildAttributes(await this.client.send(new GetNetworkConnectorCommand({ Identifier: physicalId })))[attributeName];
10974
+ }
10975
+ async import(input) {
10976
+ const props = input.properties ?? {};
10977
+ const identifier = input.knownPhysicalId ?? (typeof props["Name"] === "string" ? props["Name"] : void 0);
10978
+ if (!identifier) return null;
10979
+ try {
10980
+ const resp = await this.client.send(new GetNetworkConnectorCommand({ Identifier: identifier }));
10981
+ if (!resp.Arn) return null;
10982
+ return {
10983
+ physicalId: resp.Arn,
10984
+ attributes: buildAttributes(resp)
10985
+ };
10986
+ } catch (error) {
10987
+ if (error instanceof ResourceNotFoundException$10) return null;
10988
+ throw error;
10989
+ }
10990
+ }
10991
+ async readCurrentState(physicalId, _logicalId, _resourceType) {
10992
+ let resp;
10993
+ try {
10994
+ resp = await this.client.send(new GetNetworkConnectorCommand({ Identifier: physicalId }));
10995
+ } catch (error) {
10996
+ if (error instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
10997
+ throw error;
10998
+ }
10999
+ const result = {};
11000
+ if (resp.Name !== void 0) result["Name"] = resp.Name;
11001
+ if (resp.OperatorRole !== void 0) result["OperatorRole"] = resp.OperatorRole;
11002
+ const vpc = resp.Configuration && "VpcEgressConfiguration" in resp.Configuration ? resp.Configuration.VpcEgressConfiguration : void 0;
11003
+ if (vpc) {
11004
+ const VpcEgressConfiguration = {};
11005
+ if (vpc.SubnetIds !== void 0) VpcEgressConfiguration["SubnetIds"] = [...vpc.SubnetIds];
11006
+ if (vpc.SecurityGroupIds !== void 0) VpcEgressConfiguration["SecurityGroupIds"] = [...vpc.SecurityGroupIds];
11007
+ if (vpc.NetworkProtocol !== void 0) VpcEgressConfiguration["NetworkProtocol"] = vpc.NetworkProtocol;
11008
+ if (vpc.AssociatedComputeResourceTypes !== void 0) VpcEgressConfiguration["AssociatedComputeResourceTypes"] = [...vpc.AssociatedComputeResourceTypes];
11009
+ result["Configuration"] = { VpcEgressConfiguration };
11010
+ }
11011
+ let tags;
11012
+ try {
11013
+ tags = await this.lambda.send(new ListTagsCommand({ Resource: physicalId }));
11014
+ } catch (error) {
11015
+ if (error instanceof ResourceNotFoundException) return RESOURCE_NOT_FOUND;
11016
+ throw error;
11017
+ }
11018
+ result["Tags"] = normalizeAwsTagsToCfn(tags.Tags);
11019
+ return result;
11020
+ }
11021
+ getDriftUnorderedPaths() {
11022
+ return [
11023
+ "Configuration.VpcEgressConfiguration.SubnetIds",
11024
+ "Configuration.VpcEgressConfiguration.SecurityGroupIds",
11025
+ "Configuration.VpcEgressConfiguration.AssociatedComputeResourceTypes"
11026
+ ];
11027
+ }
11028
+ readVpcEgress(properties, logicalId, resourceType, physicalId) {
11029
+ const fail = (message) => {
11030
+ throw new ProvisioningError(`${message} for Lambda network connector ${logicalIdShown(logicalId)}`, resourceType, logicalId, physicalId);
11031
+ };
11032
+ const config = properties["Configuration"];
11033
+ const vpc = isPlainRecord$2(config) ? config["VpcEgressConfiguration"] : void 0;
11034
+ if (!isPlainRecord$2(vpc)) return fail("Configuration.VpcEgressConfiguration must be an object");
11035
+ const strings = (key) => {
11036
+ const value = vpc[key];
11037
+ if (value === void 0) return void 0;
11038
+ if (!Array.isArray(value) || value.some((v) => typeof v !== "string")) return fail(`Configuration.VpcEgressConfiguration.${key} must be a list of strings`);
11039
+ return [...value];
11040
+ };
11041
+ const subnetIds = strings("SubnetIds");
11042
+ const securityGroupIds = strings("SecurityGroupIds");
11043
+ const types = strings("AssociatedComputeResourceTypes");
11044
+ const protocol = vpc["NetworkProtocol"];
11045
+ if (protocol !== void 0 && typeof protocol !== "string") fail("Configuration.VpcEgressConfiguration.NetworkProtocol must be a string");
11046
+ return {
11047
+ SubnetIds: subnetIds,
11048
+ SecurityGroupIds: securityGroupIds,
11049
+ NetworkProtocol: typeof protocol === "string" ? protocol : void 0,
11050
+ AssociatedComputeResourceTypes: types
11051
+ };
11052
+ }
11053
+ readOperatorRole(properties, logicalId, resourceType, physicalId, context) {
11054
+ const role = properties["OperatorRole"];
11055
+ if (role === void 0 || typeof role === "string") return role;
11056
+ const message = `OperatorRole must be a string for Lambda network connector ${logicalIdShown(logicalId)}`;
11057
+ if (context?.replayingState === true || context !== void 0 && "desiredFromAwsReadback" in context && context.desiredFromAwsReadback === true) {
11058
+ this.logger.warn(safeMsg`${message}; omitting it while applying a state-borne bag`);
11059
+ return;
11060
+ }
11061
+ throw new ProvisioningError(message, resourceType, logicalId, physicalId);
11062
+ }
11063
+ async reconcileTags(physicalId, resourceType, logicalId, newTags, oldTags) {
11064
+ const plan = planTagDiff(oldTags, newTags);
11065
+ const tagWarning = tagPlanWarning(plan, resourceType, logicalId);
11066
+ if (tagWarning !== void 0) this.logger.warn(tagWarning);
11067
+ if (plan.remove.length > 0) await this.lambda.send(new UntagResourceCommand$1({
11068
+ Resource: physicalId,
11069
+ TagKeys: plan.remove
11070
+ }));
11071
+ const toAdd = Object.fromEntries(plan.set);
11072
+ if (Object.keys(toAdd).length > 0) await this.lambda.send(new TagResourceCommand$1({
11073
+ Resource: physicalId,
11074
+ Tags: toAdd
11075
+ }));
11076
+ }
11077
+ async waitForSettled(arn, logicalId, operation) {
11078
+ for (let attempt = 1; attempt <= MAX_POLL_ATTEMPTS; attempt++) {
11079
+ const resp = await this.client.send(new GetNetworkConnectorCommand({ Identifier: arn }));
11080
+ if (resp.State === "FAILED" || resp.State === "DELETING" || resp.State === "DELETE_FAILED" || resp.State === "INACTIVE") throw new TerminalConnectorStateError(`Lambda network connector ${logicalIdShown(logicalId)} entered ${resp.State}: ${resp.StateReason ?? resp.StateReasonCode ?? "no reason given"}`);
11081
+ if (operation === "update" && resp.LastUpdateStatus === "Failed") throw new Error(`Lambda network connector ${logicalIdShown(logicalId)} update failed: ${resp.LastUpdateStatusReason ?? resp.LastUpdateStatusReasonCode ?? "no reason given"}`);
11082
+ if (resp.State === "ACTIVE" && resp.LastUpdateStatus !== "InProgress") return resp;
11083
+ await sleep$1(POLL_INTERVAL_MS$2);
11084
+ }
11085
+ throw new Error(`Lambda network connector ${logicalIdShown(logicalId)} did not finish ${operation} within ${MAX_POLL_ATTEMPTS * POLL_INTERVAL_MS$2 / 1e3}s.`);
11086
+ }
11087
+ async waitForGone(arn, logicalId) {
11088
+ for (let attempt = 1; attempt <= MAX_POLL_ATTEMPTS; attempt++) {
11089
+ let resp;
11090
+ try {
11091
+ resp = await this.client.send(new GetNetworkConnectorCommand({ Identifier: arn }));
11092
+ } catch (error) {
11093
+ if (error instanceof ResourceNotFoundException$10) return;
11094
+ throw error;
11095
+ }
11096
+ if (resp.State === "DELETE_FAILED") throw new Error(`Lambda network connector ${logicalIdShown(logicalId)} entered DELETE_FAILED: ${resp.StateReason ?? resp.StateReasonCode ?? "no reason given"}`);
11097
+ await sleep$1(POLL_INTERVAL_MS$2);
11098
+ }
11099
+ throw new Error(`Lambda network connector ${logicalIdShown(logicalId)} was not fully deleted within ${MAX_POLL_ATTEMPTS * POLL_INTERVAL_MS$2 / 1e3}s.`);
11100
+ }
11101
+ wrapError(operation, logicalId, resourceType, physicalId, error) {
11102
+ if (error instanceof ProvisioningError) return error;
11103
+ const cause = error instanceof Error ? error : void 0;
11104
+ return new ProvisioningError(`Failed to ${operation} Lambda network connector ${logicalIdShown(logicalId)}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
11105
+ }
11106
+ };
11107
+ var TerminalConnectorStateError = class extends Error {};
11108
+ function buildAttributes(resp) {
11109
+ return definedAttributes({
11110
+ Arn: resp.Arn,
11111
+ State: resp.State,
11112
+ LatestVersionArn: resp.LatestVersionArn,
11113
+ LatestVersion: resp.LatestVersion ?? versionOfArn(resp.LatestVersionArn)
11114
+ });
11115
+ }
11116
+ function versionOfArn(arn) {
11117
+ const match = arn === void 0 ? null : /:network-connector:[^:]+:(\d+)$/.exec(arn);
11118
+ return match ? Number(match[1]) : void 0;
11119
+ }
11120
+
10146
11121
  //#endregion
10147
11122
  //#region src/provisioning/dynamodb-contributor-insights.ts
10148
11123
  const CONTRIBUTOR_INSIGHTS_KEY = "ContributorInsightsSpecification";
@@ -18475,12 +19450,15 @@ var ApiGatewayProvider = class ApiGatewayProvider {
18475
19450
  log.debug(`PathPart changed from "${log.value(oldPathPart)}" to "${log.value(newPathPart)}", replacing resource`);
18476
19451
  const createResult = await this.createResource(logicalId, resourceType, properties, log);
18477
19452
  let orphanReason;
19453
+ let oldResourceSurvivor = "unconfirmed";
18478
19454
  try {
18479
19455
  if (redactedDeleteAddressFields({ RestApiId: previousProperties["RestApiId"] }).length > 0) {
18480
19456
  orphanReason = `old API Gateway Resource ${physicalId} was not deleted: its recorded RestApiId is redacted`;
19457
+ oldResourceSurvivor = "kept";
18481
19458
  log.warn(safeMsg`Old API Gateway Resource ${physicalId} was not deleted during replacement: its ` + "recorded RestApiId is redacted in state, which names no API. The old resource may be orphaned and require manual cleanup.");
18482
19459
  } else await this.deleteResource(logicalId, physicalId, resourceType, previousProperties);
18483
19460
  } catch (error) {
19461
+ oldResourceSurvivor = replacedDeleteFailureVerdict(error);
18484
19462
  orphanReason = log.mask(`old API Gateway Resource ${physicalId} could not be deleted: ${safeStringify(error)}`);
18485
19463
  log.warn(`Failed to delete old API Gateway Resource ${physicalId} during replacement: ${safeStringify(error)}. The old resource may be orphaned and require manual cleanup.`);
18486
19464
  }
@@ -18492,7 +19470,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
18492
19470
  return orphanReason !== void 0 ? {
18493
19471
  ...base,
18494
19472
  outcome: "partial",
18495
- reason: orphanReason
19473
+ reason: orphanReason,
19474
+ ...oldResourceSurvivor === "kept" && { oldResourceSurvivor }
18496
19475
  } : base;
18497
19476
  }
18498
19477
  return {
@@ -20802,8 +21781,9 @@ var CloudFrontOAIProvider = class {
20802
21781
  throw new ProvisioningError(`Failed to create CloudFront OAI ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
20803
21782
  }
20804
21783
  }
20805
- async update(logicalId, physicalId, resourceType, properties, _previousProperties) {
21784
+ async update(logicalId, physicalId, resourceType, properties, _previousProperties, context) {
20806
21785
  this.logger.debug(`Updating CloudFront OAI ${logicalId}: ${physicalId}`);
21786
+ assertRegionMatch(context?.expectedRegion ? await this.cloudFrontClient.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update", "global");
20807
21787
  const config = properties["CloudFrontOriginAccessIdentityConfig"];
20808
21788
  try {
20809
21789
  const comment = readConfigString(config, "Comment", "", "AWS::CloudFront::CloudFrontOriginAccessIdentity CloudFrontOriginAccessIdentityConfig");
@@ -20946,8 +21926,9 @@ var CloudFrontOACProvider = class {
20946
21926
  throw new ProvisioningError(`Failed to create CloudFront Origin Access Control ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
20947
21927
  }
20948
21928
  }
20949
- async update(logicalId, physicalId, resourceType, properties, _previousProperties) {
21929
+ async update(logicalId, physicalId, resourceType, properties, _previousProperties, context) {
20950
21930
  this.logger.debug(`Updating CloudFront Origin Access Control ${logicalId}: ${physicalId}`);
21931
+ assertRegionMatch(context?.expectedRegion ? await this.cloudFrontClient.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update", "global");
20951
21932
  try {
20952
21933
  const etag = (await this.cloudFrontClient.send(new GetOriginAccessControlCommand({ Id: physicalId }))).ETag;
20953
21934
  if (!etag) throw new Error("GetOriginAccessControl did not return ETag");
@@ -21185,8 +22166,9 @@ var CloudFrontDistributionProvider = class {
21185
22166
  if (comment !== "") parts.push(`comment ${JSON.stringify(comment)}`);
21186
22167
  return parts.length > 0 ? parts.join(" and ") : "its creation time (the orphan is the newest distribution in this account)";
21187
22168
  }
21188
- async update(logicalId, physicalId, resourceType, properties, previousProperties) {
22169
+ async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
21189
22170
  this.logger.debug(`Updating CloudFront Distribution ${logicalId}: ${physicalId}`);
22171
+ assertRegionMatch(context?.expectedRegion ? await this.cloudFrontClient.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update", "global");
21190
22172
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
21191
22173
  try {
21192
22174
  const getConfigResponse = await this.cloudFrontClient.send(new GetDistributionConfigCommand({ Id: physicalId }));
@@ -28528,8 +29510,9 @@ var WAFv2WebACLProvider = class {
28528
29510
  throw new ProvisioningError(`Failed to create WAFv2 WebACL ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
28529
29511
  }
28530
29512
  }
28531
- async update(logicalId, physicalId, resourceType, properties, previousProperties) {
29513
+ async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
28532
29514
  this.logger.debug(`Updating WAFv2 WebACL ${logicalId}: ${physicalId}`);
29515
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
28533
29516
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
28534
29517
  this.warnOnSdkUnsupportedRuleKeys(logicalId, properties["Rules"]);
28535
29518
  try {
@@ -28575,6 +29558,7 @@ var WAFv2WebACLProvider = class {
28575
29558
  }
28576
29559
  async delete(logicalId, physicalId, resourceType, _properties, context) {
28577
29560
  this.logger.debug(`Deleting WAFv2 WebACL ${logicalId}: ${physicalId}`);
29561
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
28578
29562
  try {
28579
29563
  const { id, name, scope } = parseWebACLArn(physicalId);
28580
29564
  const lockToken = (await this.getClient().send(new GetWebACLCommand({
@@ -29414,7 +30398,7 @@ var CognitoUserPoolProvider = class {
29414
30398
  } catch (bareError) {
29415
30399
  failure = bareError;
29416
30400
  }
29417
- if (readOn && !(failure instanceof ResourceNotFoundException$9)) {
30401
+ if (readOn && !(failure instanceof ResourceNotFoundException$11)) {
29418
30402
  this.logger.debug(safeMsg`Writing DeletionProtection back on ${physicalId} failed: ${describeAwsFailure(failure).detail}`);
29419
30403
  return "read-on-write-failed";
29420
30404
  }
@@ -29471,7 +30455,7 @@ var CognitoUserPoolProvider = class {
29471
30455
  return;
29472
30456
  }
29473
30457
  if (!observedPool) {
29474
- if (observeError instanceof ResourceNotFoundException$9) return;
30458
+ if (observeError instanceof ResourceNotFoundException$11) return;
29475
30459
  if (observeError !== void 0 && isTransientCognitoFailure(observeError)) {
29476
30460
  transientReadError = observeError;
29477
30461
  return;
@@ -29494,7 +30478,7 @@ var CognitoUserPoolProvider = class {
29494
30478
  flip.deleteAccepted = true;
29495
30479
  this.logger.debug(`Successfully deleted Cognito User Pool ${logicalId}`);
29496
30480
  } catch (error) {
29497
- if (error instanceof ResourceNotFoundException$9) {
30481
+ if (error instanceof ResourceNotFoundException$11) {
29498
30482
  const clientRegion = await this.getClient().config.region();
29499
30483
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
29500
30484
  this.logger.debug(`Cognito User Pool ${physicalId} does not exist, skipping deletion`);
@@ -29528,7 +30512,7 @@ var CognitoUserPoolProvider = class {
29528
30512
  if (earlier) earlier.echoedSince = true;
29529
30513
  return;
29530
30514
  } catch (echoError) {
29531
- if (echoError instanceof ResourceNotFoundException$9) throw echoError;
30515
+ if (echoError instanceof ResourceNotFoundException$11) throw echoError;
29532
30516
  if (observedOn && isAmbiguousWriteFailure(echoError)) flip.flippedOffByThisRun = true;
29533
30517
  if (isTransientCognitoFailure(echoError)) throw echoError;
29534
30518
  if (!isRefusedEcho(echoError)) {
@@ -29541,7 +30525,7 @@ var CognitoUserPoolProvider = class {
29541
30525
  DeletionProtection: "INACTIVE"
29542
30526
  }));
29543
30527
  } catch (bareError) {
29544
- if (bareError instanceof ResourceNotFoundException$9) throw bareError;
30528
+ if (bareError instanceof ResourceNotFoundException$11) throw bareError;
29545
30529
  if (isAmbiguousWriteFailure(bareError)) {
29546
30530
  if (observedOn) flip.flippedOffByThisRun = true;
29547
30531
  if (!this.preFlipPools.has(flip)) this.preFlipPools.set(flip, {
@@ -29583,7 +30567,7 @@ var CognitoUserPoolProvider = class {
29583
30567
  try {
29584
30568
  resp = await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: physicalId }));
29585
30569
  } catch (err) {
29586
- if (err instanceof ResourceNotFoundException$9) return RESOURCE_NOT_FOUND;
30570
+ if (err instanceof ResourceNotFoundException$11) return RESOURCE_NOT_FOUND;
29587
30571
  throw err;
29588
30572
  }
29589
30573
  const pool = resp.UserPool;
@@ -29652,7 +30636,7 @@ var CognitoUserPoolProvider = class {
29652
30636
  attributes: await this.userPoolAttributes(input.knownPhysicalId, resp.UserPool?.Arn)
29653
30637
  };
29654
30638
  } catch (err) {
29655
- if (err instanceof ResourceNotFoundException$9) return null;
30639
+ if (err instanceof ResourceNotFoundException$11) return null;
29656
30640
  throw err;
29657
30641
  }
29658
30642
  const desiredName = typeof input.properties?.["UserPoolName"] === "string" ? input.properties["UserPoolName"] : void 0;
@@ -29668,7 +30652,7 @@ var CognitoUserPoolProvider = class {
29668
30652
  try {
29669
30653
  resp = await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: pool.Id }));
29670
30654
  } catch (err) {
29671
- if (err instanceof ResourceNotFoundException$9) return null;
30655
+ if (err instanceof ResourceNotFoundException$11) return null;
29672
30656
  throw err;
29673
30657
  }
29674
30658
  return {
@@ -30178,6 +31162,13 @@ const NAMESPACE_TYPES = [
30178
31162
  "AWS::ServiceDiscovery::HttpNamespace",
30179
31163
  "AWS::ServiceDiscovery::PublicDnsNamespace"
30180
31164
  ];
31165
+ const NAMESPACE_KIND_BY_TYPE = /* @__PURE__ */ new Map([
31166
+ ["AWS::ServiceDiscovery::PrivateDnsNamespace", "DNS_PRIVATE"],
31167
+ ["AWS::ServiceDiscovery::PublicDnsNamespace", "DNS_PUBLIC"],
31168
+ ["AWS::ServiceDiscovery::HttpNamespace", "HTTP"]
31169
+ ]);
31170
+ const NAMESPACE_ID_PATTERN = /^ns-[a-z0-9]{16}$/;
31171
+ const SERVICE_ID_PATTERN = /^srv-[a-z0-9]{16}$/;
30181
31172
  var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
30182
31173
  client;
30183
31174
  stsClient;
@@ -30783,6 +31774,47 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
30783
31774
  default: return;
30784
31775
  }
30785
31776
  }
31777
+ async isSameResource(journaledPhysicalId, record, resourceType, context) {
31778
+ let pattern;
31779
+ let read;
31780
+ const namespaceKind = NAMESPACE_KIND_BY_TYPE.get(resourceType);
31781
+ if (namespaceKind !== void 0) {
31782
+ pattern = NAMESPACE_ID_PATTERN;
31783
+ read = (id) => this.readNamespaceIdForIdentity(id, namespaceKind);
31784
+ } else if (resourceType === "AWS::ServiceDiscovery::Service") {
31785
+ pattern = SERVICE_ID_PATTERN;
31786
+ read = (id) => this.readServiceIdForIdentity(id);
31787
+ } else return "unknown";
31788
+ if (!pattern.test(journaledPhysicalId) || !pattern.test(record.physicalId)) return "unknown";
31789
+ if (journaledPhysicalId === record.physicalId) return "same";
31790
+ if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
31791
+ if (await read(record.physicalId) !== record.physicalId) return "unknown";
31792
+ const journaledRead = await read(journaledPhysicalId);
31793
+ return journaledRead === void 0 || journaledRead === journaledPhysicalId ? "different" : "unknown";
31794
+ }
31795
+ async readNamespaceIdForIdentity(namespaceId, kind) {
31796
+ let response;
31797
+ try {
31798
+ response = await this.getClient().send(new GetNamespaceCommand({ Id: namespaceId }));
31799
+ } catch (error) {
31800
+ if (error instanceof NamespaceNotFound) return void 0;
31801
+ throw error;
31802
+ }
31803
+ const namespace = response.Namespace;
31804
+ if (typeof namespace?.Id !== "string" || namespace.Type !== kind) throw new Error("GetNamespace did not return a namespace of the kind asked for");
31805
+ return namespace.Id;
31806
+ }
31807
+ async readServiceIdForIdentity(serviceId) {
31808
+ let response;
31809
+ try {
31810
+ response = await this.getClient().send(new GetServiceCommand({ Id: serviceId }));
31811
+ } catch (error) {
31812
+ if (error instanceof ServiceNotFound) return void 0;
31813
+ throw error;
31814
+ }
31815
+ if (typeof response.Service?.Id !== "string") throw new Error("GetService did not return the service asked for");
31816
+ return response.Service.Id;
31817
+ }
30786
31818
  async readCurrentState(physicalId, _logicalId, resourceType) {
30787
31819
  switch (resourceType) {
30788
31820
  case "AWS::ServiceDiscovery::PrivateDnsNamespace":
@@ -32817,6 +33849,7 @@ var GlueProvider = class {
32817
33849
  }
32818
33850
  }
32819
33851
  async delete(logicalId, physicalId, resourceType, properties, context) {
33852
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
32820
33853
  switch (resourceType) {
32821
33854
  case "AWS::Glue::Database": return this.deleteDatabase(logicalId, physicalId, resourceType, properties, context);
32822
33855
  case "AWS::Glue::Table": return this.deleteTable(logicalId, physicalId, resourceType, properties, context);
@@ -33522,6 +34555,7 @@ var GlueWorkflowProvider = class {
33522
34555
  }
33523
34556
  async delete(logicalId, physicalId, resourceType, _properties, context) {
33524
34557
  this.logger.debug(`Deleting Glue Workflow ${logicalId}: ${physicalId}`);
34558
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
33525
34559
  try {
33526
34560
  await this.getClient().send(new DeleteWorkflowCommand({ Name: physicalId }));
33527
34561
  this.logger.debug(`Successfully deleted Glue Workflow ${logicalId}`);
@@ -33643,11 +34677,13 @@ var GlueSecurityConfigurationProvider = class {
33643
34677
  throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create Glue SecurityConfiguration ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
33644
34678
  }
33645
34679
  }
33646
- async update(logicalId, _physicalId, resourceType, _properties, _previousProperties) {
34680
+ async update(logicalId, physicalId, resourceType, _properties, _previousProperties, context) {
34681
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
33647
34682
  throw new ResourceUpdateNotSupportedError(resourceType, logicalId, "AWS Glue SecurityConfiguration is immutable on AWS — there is no UpdateSecurityConfiguration API; every change requires DeleteSecurityConfiguration + CreateSecurityConfiguration. Use cdkd deploy --replace, or destroy + redeploy with the new EncryptionConfiguration.");
33648
34683
  }
33649
34684
  async delete(logicalId, physicalId, resourceType, _properties, context) {
33650
34685
  this.logger.debug(`Deleting Glue SecurityConfiguration ${logicalId}: ${physicalId}`);
34686
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
33651
34687
  try {
33652
34688
  await this.getClient().send(new DeleteSecurityConfigurationCommand({ Name: physicalId }));
33653
34689
  this.logger.debug(`Successfully deleted Glue SecurityConfiguration ${logicalId}`);
@@ -33899,6 +34935,7 @@ var GlueJobProvider = class {
33899
34935
  }
33900
34936
  async delete(logicalId, physicalId, resourceType, _properties, context) {
33901
34937
  this.logger.debug(`Deleting Glue Job ${logicalId}: ${physicalId}`);
34938
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
33902
34939
  try {
33903
34940
  await this.getClient().send(new DeleteJobCommand({ JobName: physicalId }));
33904
34941
  } catch (error) {
@@ -34190,6 +35227,7 @@ var GlueCrawlerProvider = class {
34190
35227
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
34191
35228
  const { value: v } = log;
34192
35229
  log.debug(`Deleting Glue Crawler ${logicalId}: ${v(physicalId)}`);
35230
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
34193
35231
  try {
34194
35232
  await this.getClient().send(new DeleteCrawlerCommand({ Name: physicalId }));
34195
35233
  } catch (error) {
@@ -34437,6 +35475,7 @@ var GlueConnectionProvider = class {
34437
35475
  async delete(logicalId, physicalId, resourceType, properties, context) {
34438
35476
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
34439
35477
  log.debug(`Deleting Glue Connection ${logicalId}: ${log.value(physicalId)}`);
35478
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
34440
35479
  const redactedSkip = redactedDeleteAddressSkip(this.logger, logicalId, resourceType, redactedDeleteAddressFields({ CatalogId: properties?.["CatalogId"] }));
34441
35480
  if (redactedSkip) return redactedSkip;
34442
35481
  const target = deleteCatalogId(properties);
@@ -34653,6 +35692,7 @@ var GlueTriggerProvider = class {
34653
35692
  }
34654
35693
  async delete(logicalId, physicalId, resourceType, _properties, context) {
34655
35694
  this.logger.debug(`Deleting Glue Trigger ${logicalId}: ${physicalId}`);
35695
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
34656
35696
  try {
34657
35697
  try {
34658
35698
  if ((await this.getClient().send(new GetTriggerCommand({ Name: physicalId }))).Trigger?.State === "ACTIVATED") {
@@ -36118,7 +37158,7 @@ var KinesisStreamProvider = class {
36118
37158
  EnforceConsumerDeletion: true
36119
37159
  }));
36120
37160
  } catch (error) {
36121
- if (error instanceof ResourceNotFoundException$10) {
37161
+ if (error instanceof ResourceNotFoundException$12) {
36122
37162
  const clientRegion = await this.getClient().config.region();
36123
37163
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
36124
37164
  if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Kinesis stream ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
@@ -36155,7 +37195,7 @@ var KinesisStreamProvider = class {
36155
37195
  try {
36156
37196
  response = await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: physicalId }));
36157
37197
  } catch (error) {
36158
- if (error instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
37198
+ if (error instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
36159
37199
  throw error;
36160
37200
  }
36161
37201
  const arn = response.StreamDescriptionSummary?.StreamARN;
@@ -36169,7 +37209,7 @@ var KinesisStreamProvider = class {
36169
37209
  try {
36170
37210
  response = await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: streamName }));
36171
37211
  } catch (error) {
36172
- if (error instanceof ResourceNotFoundException$10) return void 0;
37212
+ if (error instanceof ResourceNotFoundException$12) return void 0;
36173
37213
  throw error;
36174
37214
  }
36175
37215
  const arn = response.StreamDescriptionSummary?.StreamARN;
@@ -36180,7 +37220,7 @@ var KinesisStreamProvider = class {
36180
37220
  try {
36181
37221
  return (await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: streamName }))).StreamDescriptionSummary?.StreamStatus ?? "UNKNOWN";
36182
37222
  } catch (error) {
36183
- if (error instanceof ResourceNotFoundException$10) return void 0;
37223
+ if (error instanceof ResourceNotFoundException$12) return void 0;
36184
37224
  throw error;
36185
37225
  }
36186
37226
  }
@@ -36233,7 +37273,7 @@ var KinesisStreamProvider = class {
36233
37273
  try {
36234
37274
  stream = (await this.getClient().send(new DescribeStreamCommand({ StreamName: physicalId }))).StreamDescription;
36235
37275
  } catch (err) {
36236
- if (err instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
37276
+ if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
36237
37277
  throw err;
36238
37278
  }
36239
37279
  if (!stream) return void 0;
@@ -36253,14 +37293,14 @@ var KinesisStreamProvider = class {
36253
37293
  const maxRecordSize = (await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: physicalId }))).StreamDescriptionSummary?.MaxRecordSizeInKiB;
36254
37294
  if (maxRecordSize !== void 0) result["MaxRecordSizeInKiB"] = maxRecordSize;
36255
37295
  } catch (err) {
36256
- if (err instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
37296
+ if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
36257
37297
  throw err;
36258
37298
  }
36259
37299
  try {
36260
37300
  const tagsResp = await this.getClient().send(new ListTagsForStreamCommand({ StreamName: physicalId }));
36261
37301
  result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
36262
37302
  } catch (err) {
36263
- if (err instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
37303
+ if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
36264
37304
  this.logger.debug(`Kinesis ListTagsForStream(${physicalId}) failed: ${describeAwsFailure(err).detail}`);
36265
37305
  }
36266
37306
  return result;
@@ -36274,7 +37314,7 @@ var KinesisStreamProvider = class {
36274
37314
  attributes: {}
36275
37315
  };
36276
37316
  } catch (err) {
36277
- if (err instanceof ResourceNotFoundException$10) return null;
37317
+ if (err instanceof ResourceNotFoundException$12) return null;
36278
37318
  throw err;
36279
37319
  }
36280
37320
  return null;
@@ -36434,7 +37474,7 @@ var KinesisStreamConsumerProvider = class {
36434
37474
  await this.getClient().send(new DeregisterStreamConsumerCommand({ ConsumerARN: physicalId }));
36435
37475
  this.logger.debug(`Successfully deregistered Kinesis stream consumer ${logicalId}`);
36436
37476
  } catch (error) {
36437
- if (error instanceof ResourceNotFoundException$10) {
37477
+ if (error instanceof ResourceNotFoundException$12) {
36438
37478
  const clientRegion = await this.getClient().config.region();
36439
37479
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
36440
37480
  this.logger.debug(`Kinesis stream consumer ${physicalId} not found, skipping`);
@@ -36462,7 +37502,7 @@ var KinesisStreamConsumerProvider = class {
36462
37502
  try {
36463
37503
  desc = (await this.getClient().send(new DescribeStreamConsumerCommand({ ConsumerARN: physicalId }))).ConsumerDescription;
36464
37504
  } catch (err) {
36465
- if (err instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
37505
+ if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
36466
37506
  throw err;
36467
37507
  }
36468
37508
  if (!desc) return void 0;
@@ -36473,7 +37513,7 @@ var KinesisStreamConsumerProvider = class {
36473
37513
  const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$15({ ResourceARN: physicalId }));
36474
37514
  result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
36475
37515
  } catch (err) {
36476
- if (err instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
37516
+ if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
36477
37517
  this.logger.debug(`ListTagsForResource(${physicalId}) failed: ${describeAwsFailure(err).detail}`);
36478
37518
  result["Tags"] = [];
36479
37519
  }
@@ -36692,7 +37732,7 @@ var SchedulerScheduleProvider = class {
36692
37732
  for (let attempt = 0;; attempt++) try {
36693
37733
  return (await this.readIdentity(name, groupName)).creation;
36694
37734
  } catch (error) {
36695
- const transient = error instanceof ResourceNotFoundException$11 || isThrottlingError(error);
37735
+ const transient = error instanceof ResourceNotFoundException$13 || isThrottlingError(error);
36696
37736
  const delay = this.readBackDelaysMs[attempt];
36697
37737
  if (transient && delay !== void 0) {
36698
37738
  await this.sleep(delay);
@@ -36716,7 +37756,7 @@ var SchedulerScheduleProvider = class {
36716
37756
  try {
36717
37757
  live = await this.readIdentity(physicalId, groupName);
36718
37758
  } catch (error) {
36719
- if (error instanceof ResourceNotFoundException$11) return "absent";
37759
+ if (error instanceof ResourceNotFoundException$13) return "absent";
36720
37760
  throw this.wrapUnconfirmedGroupError(logicalId, physicalId, resourceType, error, mask);
36721
37761
  }
36722
37762
  if (sameRecordedDate(live, recorded) && !sameRecordedIdentity(live, recorded)) this.refuseUnconfirmed(logicalId, physicalId, resourceType, "holds a schedule of this name that carries the recorded creation date but not the recorded target or role (edited outside cdkd?)", false, "restore them, or drop the record with `cdkd orphan <construct path>` and deploy again");
@@ -36807,7 +37847,7 @@ var SchedulerScheduleProvider = class {
36807
37847
  try {
36808
37848
  live = await this.readIdentity(physicalId, group);
36809
37849
  } catch (error) {
36810
- if (error instanceof ResourceNotFoundException$11) continue;
37850
+ if (error instanceof ResourceNotFoundException$13) continue;
36811
37851
  throw wrapDeleteError("reading a schedule of its name", error);
36812
37852
  }
36813
37853
  if (sameRecordedIdentity(live, recorded)) matches.push(group);
@@ -36843,7 +37883,7 @@ var SchedulerScheduleProvider = class {
36843
37883
  }));
36844
37884
  this.logger.debug(safeMsg`Deleted Schedule ${logicalId} (found by its recorded creation date)`);
36845
37885
  } catch (error) {
36846
- if (error instanceof ResourceNotFoundException$11) return;
37886
+ if (error instanceof ResourceNotFoundException$13) return;
36847
37887
  throw wrapDeleteError("the delete", error);
36848
37888
  }
36849
37889
  }
@@ -36873,7 +37913,7 @@ var SchedulerScheduleProvider = class {
36873
37913
  }));
36874
37914
  this.logger.debug(`Deleted Schedule ${logicalId}`);
36875
37915
  } catch (error) {
36876
- if (error instanceof ResourceNotFoundException$11) {
37916
+ if (error instanceof ResourceNotFoundException$13) {
36877
37917
  const clientRegion = await this.getClient().config.region();
36878
37918
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
36879
37919
  this.logger.debug(`Schedule ${logicalId} already deleted (not found), treating as success`);
@@ -36889,7 +37929,7 @@ var SchedulerScheduleProvider = class {
36889
37929
  return (await this.getClient().send(new GetScheduleCommand({ Name: physicalId }))).Arn;
36890
37930
  } catch (error) {
36891
37931
  const cause = error instanceof Error ? error : void 0;
36892
- const customGroupHint = error instanceof ResourceNotFoundException$11 ? " Schedules in a custom group cannot be looked up by bare name; the Arn is normally served from cdkd state attributes." : "";
37932
+ const customGroupHint = error instanceof ResourceNotFoundException$13 ? " Schedules in a custom group cannot be looked up by bare name; the Arn is normally served from cdkd state attributes." : "";
36893
37933
  throw new ProvisioningError(`Failed to resolve Arn for Schedule ${physicalId}: ${cause?.message ?? String(error)}.${customGroupHint}`, resourceType, logicalId, physicalId, cause);
36894
37934
  }
36895
37935
  }
@@ -36915,7 +37955,7 @@ var SchedulerScheduleProvider = class {
36915
37955
  ...response.Target !== void 0 && { Target: this.toCfnTarget(response.Target) }
36916
37956
  };
36917
37957
  } catch (error) {
36918
- if (error instanceof ResourceNotFoundException$11) return RESOURCE_NOT_FOUND;
37958
+ if (error instanceof ResourceNotFoundException$13) return RESOURCE_NOT_FOUND;
36919
37959
  throw error;
36920
37960
  }
36921
37961
  }
@@ -36936,7 +37976,7 @@ var SchedulerScheduleProvider = class {
36936
37976
  }
36937
37977
  };
36938
37978
  } catch (error) {
36939
- if (error instanceof ResourceNotFoundException$11) return null;
37979
+ if (error instanceof ResourceNotFoundException$13) return null;
36940
37980
  throw error;
36941
37981
  }
36942
37982
  }
@@ -36945,6 +37985,32 @@ var SchedulerScheduleProvider = class {
36945
37985
  //#endregion
36946
37986
  //#region src/provisioning/providers/pipes-provider.ts
36947
37987
  const PIPE_TYPE = "AWS::Pipes::Pipe";
37988
+ function isPipeName(id) {
37989
+ return /^[.\-_A-Za-z0-9]{1,64}$/.test(id);
37990
+ }
37991
+ const IDENTITY_STATES = /* @__PURE__ */ new Set([
37992
+ "CREATING",
37993
+ "CREATE_FAILED",
37994
+ "CREATE_ROLLBACK_FAILED",
37995
+ "RUNNING",
37996
+ "STARTING",
37997
+ "START_FAILED",
37998
+ "STOPPED",
37999
+ "STOPPING",
38000
+ "STOP_FAILED",
38001
+ "UPDATING",
38002
+ "UPDATE_FAILED",
38003
+ "UPDATE_ROLLBACK_FAILED",
38004
+ "DELETE_FAILED",
38005
+ "DELETE_ROLLBACK_FAILED"
38006
+ ]);
38007
+ function pipeIdentityToken(name, arn, creationTime) {
38008
+ if (typeof arn !== "string" || !arn.startsWith("arn:") || !arn.endsWith(`:pipe/${name}`)) return;
38009
+ if (!(creationTime instanceof Date)) return void 0;
38010
+ const ms = creationTime.getTime();
38011
+ if (!Number.isFinite(ms) || ms <= 0) return void 0;
38012
+ return `${arn}@${Math.floor(ms / 1e3)}`;
38013
+ }
36948
38014
  const SETTLED_STATES = /* @__PURE__ */ new Set(["RUNNING", "STOPPED"]);
36949
38015
  const PIPE_POLL_INTERVAL_MS = 5e3;
36950
38016
  const PIPE_SETTLE_MAX_WAIT_MS = 9e5;
@@ -37163,8 +38229,9 @@ var PipesPipeProvider = class {
37163
38229
  const name = properties["Name"] ?? generateResourceName(logicalId, { maxLength: 64 });
37164
38230
  const tags = desiredTagMap(properties["Tags"], logicalId);
37165
38231
  this.logger.debug(mask(`Creating Pipe ${logicalId}: ${name}`));
38232
+ let createdIdentity;
37166
38233
  try {
37167
- await this.getCreateClient().send(new CreatePipeCommand({
38234
+ const created = await this.getCreateClient().send(new CreatePipeCommand({
37168
38235
  Name: name,
37169
38236
  RoleArn: properties["RoleArn"],
37170
38237
  Source: properties["Source"],
@@ -37179,6 +38246,7 @@ var PipesPipeProvider = class {
37179
38246
  ...properties["KmsKeyIdentifier"] !== void 0 && { KmsKeyIdentifier: properties["KmsKeyIdentifier"] },
37180
38247
  ...Object.keys(tags).length > 0 && { Tags: tags }
37181
38248
  }));
38249
+ createdIdentity = pipeIdentityToken(name, created?.Arn, created?.CreationTime);
37182
38250
  } catch (error) {
37183
38251
  const cause = error instanceof Error ? error : void 0;
37184
38252
  throw new ProvisioningError(`Failed to create Pipe ${logicalId}: ${mask(cause?.message ?? String(error))}`, resourceType, logicalId, void 0, cause);
@@ -37187,7 +38255,7 @@ var PipesPipeProvider = class {
37187
38255
  try {
37188
38256
  settled = await this.waitForSettled(name, logicalId, resourceType, "create", mask);
37189
38257
  } catch (error) {
37190
- throw await this.retireFailedCreate(name, logicalId, resourceType, error, mask);
38258
+ throw await this.retireFailedCreate(name, logicalId, resourceType, error, mask, createdIdentity);
37191
38259
  }
37192
38260
  return {
37193
38261
  physicalId: name,
@@ -37270,7 +38338,7 @@ var PipesPipeProvider = class {
37270
38338
  } catch (error) {
37271
38339
  if (error instanceof NotFoundException$6) {
37272
38340
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
37273
- this.logger.debug(safeMsg`Pipe ${logicalId} already deleted (not found), treating as success`);
38341
+ this.logGoneOnDelete(logicalId, physicalId, context);
37274
38342
  return;
37275
38343
  }
37276
38344
  const cause = error instanceof Error ? error : void 0;
@@ -37288,6 +38356,43 @@ var PipesPipeProvider = class {
37288
38356
  now: this.now
37289
38357
  });
37290
38358
  }
38359
+ logGoneOnDelete(logicalId, physicalId, context) {
38360
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Pipe ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
38361
+ else this.logger.debug(safeMsg`Pipe ${logicalId} already deleted (not found), treating as success`);
38362
+ }
38363
+ async isSameResource(journaledPhysicalId, record, resourceType, context) {
38364
+ if (resourceType !== PIPE_TYPE) return "unknown";
38365
+ if (!isPipeName(journaledPhysicalId) || !isPipeName(record.physicalId)) return "unknown";
38366
+ if (journaledPhysicalId === record.physicalId) return "same";
38367
+ if (journaledPhysicalId.toLowerCase() === record.physicalId.toLowerCase()) return "unknown";
38368
+ if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
38369
+ const recordPipe = await this.describeIfExists(record.physicalId);
38370
+ if (recordPipe === void 0) return "unknown";
38371
+ const recordArn = recordPipe.Arn;
38372
+ if (typeof recordArn !== "string" || recordArn === "") return "unknown";
38373
+ const journaledPipe = await this.describeIfExists(journaledPhysicalId);
38374
+ if (journaledPipe === void 0) return "different";
38375
+ const journaledArn = journaledPipe.Arn;
38376
+ if (typeof journaledArn !== "string" || journaledArn === "") return "unknown";
38377
+ return journaledArn === recordArn ? "same" : "different";
38378
+ }
38379
+ async resourceIdentity(physicalId, resourceType, context) {
38380
+ if (resourceType !== PIPE_TYPE || !isPipeName(physicalId)) return void 0;
38381
+ if (await this.getClient().config.region() !== context.expectedRegion) return void 0;
38382
+ const pipe = await this.describeIfExists(physicalId);
38383
+ if (pipe === void 0) return RESOURCE_NOT_FOUND;
38384
+ if (pipe.Name !== physicalId) return void 0;
38385
+ if (pipe.CurrentState === void 0 || !IDENTITY_STATES.has(pipe.CurrentState)) return;
38386
+ return pipeIdentityToken(physicalId, pipe.Arn, pipe.CreationTime);
38387
+ }
38388
+ async describeIfExists(name) {
38389
+ try {
38390
+ return await this.describe(name);
38391
+ } catch (error) {
38392
+ if (error instanceof NotFoundException$6) return void 0;
38393
+ throw error;
38394
+ }
38395
+ }
37291
38396
  async getAttribute(physicalId, _resourceType, attributeName, _logicalId) {
37292
38397
  let response;
37293
38398
  try {
@@ -37407,9 +38512,9 @@ var PipesPipeProvider = class {
37407
38512
  watch.dispose();
37408
38513
  }
37409
38514
  }
37410
- async retireFailedCreate(name, logicalId, resourceType, error, mask) {
38515
+ async retireFailedCreate(name, logicalId, resourceType, error, mask, createdIdentity) {
37411
38516
  const original = error instanceof Error ? error : new Error(String(error));
37412
- const leftBehind = () => markCreatedBeforeFailure(original, logicalId, resourceType, name);
38517
+ const leftBehind = () => markNonRetryable(markCreatedBeforeFailure(original, logicalId, resourceType, name, createdIdentity));
37413
38518
  const orphaned = async (why) => {
37414
38519
  const aws = pasteableAwsCommand(mask);
37415
38520
  const command = aws`aws pipes delete-pipe --name ${name}${await orphanCommandRegionArg(this.getClient(), aws)}`;
@@ -40999,7 +42104,7 @@ var FirehoseProvider = class {
40999
42104
  try {
41000
42105
  await this.getClient().send(new DeleteDeliveryStreamCommand({ DeliveryStreamName: physicalId }));
41001
42106
  } catch (error) {
41002
- if (error instanceof ResourceNotFoundException$12) {
42107
+ if (error instanceof ResourceNotFoundException$14) {
41003
42108
  const clientRegion = await this.getClient().config.region();
41004
42109
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
41005
42110
  this.logger.debug(`Firehose delivery stream ${physicalId} does not exist, skipping deletion`);
@@ -41023,7 +42128,7 @@ var FirehoseProvider = class {
41023
42128
  try {
41024
42129
  return (await this.getClient().send(new DescribeDeliveryStreamCommand({ DeliveryStreamName: streamName }))).DeliveryStreamDescription?.DeliveryStreamStatus ?? "UNKNOWN";
41025
42130
  } catch (error) {
41026
- if (error instanceof ResourceNotFoundException$12) return void 0;
42131
+ if (error instanceof ResourceNotFoundException$14) return void 0;
41027
42132
  throw error;
41028
42133
  }
41029
42134
  }
@@ -41355,7 +42460,7 @@ var FirehoseProvider = class {
41355
42460
  try {
41356
42461
  desc = (await this.getClient().send(new DescribeDeliveryStreamCommand({ DeliveryStreamName: physicalId }))).DeliveryStreamDescription;
41357
42462
  } catch (err) {
41358
- if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
42463
+ if (err instanceof ResourceNotFoundException$14) return RESOURCE_NOT_FOUND;
41359
42464
  throw err;
41360
42465
  }
41361
42466
  if (!desc) return void 0;
@@ -41387,7 +42492,7 @@ var FirehoseProvider = class {
41387
42492
  const tagsResp = await this.getClient().send(new ListTagsForDeliveryStreamCommand({ DeliveryStreamName: physicalId }));
41388
42493
  result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
41389
42494
  } catch (err) {
41390
- if (err instanceof ResourceNotFoundException$12) return RESOURCE_NOT_FOUND;
42495
+ if (err instanceof ResourceNotFoundException$14) return RESOURCE_NOT_FOUND;
41391
42496
  this.logger.debug(`Firehose ListTagsForDeliveryStream(${physicalId}) failed: ${describeAwsFailure(err).detail}`);
41392
42497
  result["Tags"] = [];
41393
42498
  }
@@ -41405,7 +42510,7 @@ var FirehoseProvider = class {
41405
42510
  attributes: {}
41406
42511
  };
41407
42512
  } catch (err) {
41408
- if (err instanceof ResourceNotFoundException$12) return null;
42513
+ if (err instanceof ResourceNotFoundException$14) return null;
41409
42514
  throw err;
41410
42515
  }
41411
42516
  return null;
@@ -42122,7 +43227,7 @@ var CodeBuildProvider = class {
42122
43227
  await this.getClient().send(new DeleteProjectCommand({ name: physicalId }));
42123
43228
  this.logger.debug(`Successfully deleted CodeBuild Project ${logicalId}`);
42124
43229
  } catch (error) {
42125
- if (error instanceof ResourceNotFoundException$13) {
43230
+ if (error instanceof ResourceNotFoundException$15) {
42126
43231
  const clientRegion = await this.getClient().config.region();
42127
43232
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
42128
43233
  this.logger.debug(`CodeBuild Project ${physicalId} does not exist, skipping deletion`);
@@ -42140,7 +43245,7 @@ var CodeBuildProvider = class {
42140
43245
  try {
42141
43246
  project = (await this.getClient().send(new BatchGetProjectsCommand({ names: [physicalId] }))).projects?.[0];
42142
43247
  } catch (err) {
42143
- if (err instanceof ResourceNotFoundException$13) return RESOURCE_NOT_FOUND;
43248
+ if (err instanceof ResourceNotFoundException$15) return RESOURCE_NOT_FOUND;
42144
43249
  throw err;
42145
43250
  }
42146
43251
  if (!project) return RESOURCE_NOT_FOUND;
@@ -42316,7 +43421,7 @@ var CodeBuildProvider = class {
42316
43421
  attributes: {}
42317
43422
  } : null;
42318
43423
  } catch (err) {
42319
- if (err instanceof ResourceNotFoundException$13) return null;
43424
+ if (err instanceof ResourceNotFoundException$15) return null;
42320
43425
  throw err;
42321
43426
  }
42322
43427
  return null;
@@ -42901,7 +44006,7 @@ var DLMLifecyclePolicyProvider = class {
42901
44006
  created = detail.Policy?.DateCreated;
42902
44007
  defaultType = detail.Policy?.PolicyDetails?.ResourceType;
42903
44008
  } catch (error) {
42904
- if (error instanceof ResourceNotFoundException$14) continue;
44009
+ if (error instanceof ResourceNotFoundException$16) continue;
42905
44010
  throw error;
42906
44011
  }
42907
44012
  if (isDefault && defaultType !== void 0 && defaultType !== input.DefaultPolicy) continue;
@@ -43050,7 +44155,7 @@ var DLMLifecyclePolicyProvider = class {
43050
44155
  await this.getClient().send(new DeleteLifecyclePolicyCommand$1({ PolicyId: physicalId }));
43051
44156
  this.logger.debug(`Successfully deleted DLM Lifecycle Policy ${logicalId}`);
43052
44157
  } catch (error) {
43053
- if (error instanceof ResourceNotFoundException$14) {
44158
+ if (error instanceof ResourceNotFoundException$16) {
43054
44159
  const clientRegion = await this.getClient().config.region();
43055
44160
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
43056
44161
  this.logger.debug(`DLM Lifecycle Policy ${physicalId} does not exist, skipping deletion`);
@@ -43081,7 +44186,7 @@ var DLMLifecyclePolicyProvider = class {
43081
44186
  Tags: normalizeAwsTagsToCfn(policy.Tags)
43082
44187
  };
43083
44188
  } catch (error) {
43084
- if (error instanceof ResourceNotFoundException$14) return RESOURCE_NOT_FOUND;
44189
+ if (error instanceof ResourceNotFoundException$16) return RESOURCE_NOT_FOUND;
43085
44190
  throw error;
43086
44191
  }
43087
44192
  }
@@ -43105,7 +44210,7 @@ var DLMLifecyclePolicyProvider = class {
43105
44210
  attributes: response.Policy.PolicyArn ? { Arn: response.Policy.PolicyArn } : {}
43106
44211
  } : null;
43107
44212
  } catch (err) {
43108
- if (err instanceof ResourceNotFoundException$14) return null;
44213
+ if (err instanceof ResourceNotFoundException$16) return null;
43109
44214
  throw err;
43110
44215
  }
43111
44216
  return null;
@@ -43453,7 +44558,8 @@ var S3DirectoryBucketProvider = class {
43453
44558
  throw new ProvisioningError(`Failed to create S3 Express Directory Bucket ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, bucketName, cause);
43454
44559
  }
43455
44560
  }
43456
- async update(logicalId, physicalId, resourceType, properties, previousProperties) {
44561
+ async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
44562
+ if (context?.expectedRegion) for (const clientRegion of [await this.s3Client.config.region(), await this.getS3ControlClient().config.region()]) assertRegionMatch(clientRegion, context.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
43457
44563
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
43458
44564
  try {
43459
44565
  const plan = planTagDiff(previousProperties["Tags"], properties["Tags"]);
@@ -43491,6 +44597,7 @@ var S3DirectoryBucketProvider = class {
43491
44597
  async delete(logicalId, physicalId, resourceType, properties, context) {
43492
44598
  const mask = maskerOrIdentity(context?.maskSecrets);
43493
44599
  this.logger.debug(mask(`Deleting S3 Express Directory Bucket ${logicalId}: ${mask(physicalId)}`));
44600
+ assertRegionMatch(context?.expectedRegion ? await this.s3Client.config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
43494
44601
  const allowAutoEmpty = context?.forceDataDelete === true || hasCdkAutoDeleteTag(properties, "aws-cdk:auto-delete-objects");
43495
44602
  try {
43496
44603
  await this.deleteBucketWithEmptyRetry(logicalId, physicalId, allowAutoEmpty, context?.maskSecrets);
@@ -43682,7 +44789,8 @@ var S3TablesProvider = class {
43682
44789
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId);
43683
44790
  }
43684
44791
  }
43685
- async update(logicalId, physicalId, resourceType, properties, previousProperties) {
44792
+ async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
44793
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
43686
44794
  if (resourceType === "AWS::S3Tables::Table" || resourceType === "AWS::S3Tables::TableBucket") refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
43687
44795
  try {
43688
44796
  return await this.applyUpdate(logicalId, physicalId, resourceType, properties, previousProperties);
@@ -43702,6 +44810,7 @@ var S3TablesProvider = class {
43702
44810
  };
43703
44811
  }
43704
44812
  async delete(logicalId, physicalId, resourceType, _properties, context) {
44813
+ assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-delete");
43705
44814
  switch (resourceType) {
43706
44815
  case "AWS::S3Tables::TableBucket": return this.deleteTableBucket(logicalId, physicalId, resourceType, context);
43707
44816
  case "AWS::S3Tables::Namespace": return this.deleteNamespace(logicalId, physicalId, resourceType, context);
@@ -44979,12 +46088,16 @@ var WaitConditionHandleProvider = class {
44979
46088
 
44980
46089
  //#endregion
44981
46090
  //#region src/provisioning/providers/acm-certificate-provider.ts
44982
- function isCertificateInUseError(error) {
46091
+ function certificateInUseByName(error) {
44983
46092
  let current = error;
44984
46093
  for (let depth = 0; depth < 5 && current instanceof Error; depth++) {
44985
46094
  if (current.name === "ResourceInUseException") return true;
44986
46095
  current = current.cause;
44987
46096
  }
46097
+ return false;
46098
+ }
46099
+ function isCertificateInUseError(error) {
46100
+ if (certificateInUseByName(error)) return true;
44988
46101
  const message = error instanceof Error ? error.message : String(error);
44989
46102
  return /ResourceInUseException|in use/i.test(message);
44990
46103
  }
@@ -45131,6 +46244,7 @@ var ACMCertificateProvider = class {
45131
46244
  this.logger.debug(`${changedImmutable} changed, replacing ACM certificate: ${physicalId}`);
45132
46245
  const createResult = await this.create(logicalId, resourceType, properties);
45133
46246
  let orphanReason;
46247
+ let oldResourceSurvivor = "unconfirmed";
45134
46248
  try {
45135
46249
  const deleteResult = await this.delete(logicalId, physicalId, resourceType, previousProperties, context?.maskSecrets ? { maskSecrets: context.maskSecrets } : void 0);
45136
46250
  if (deleteResult?.outcome === "skipped") {
@@ -45139,6 +46253,7 @@ var ACMCertificateProvider = class {
45139
46253
  }
45140
46254
  } catch (error) {
45141
46255
  const inUse = isCertificateInUseError(error);
46256
+ oldResourceSurvivor = certificateInUseByName(error) ? "kept" : replacedDeleteFailureVerdict(error);
45142
46257
  orphanReason = inUse ? `old certificate ${physicalId} is still in use by another resource and was not deleted` : `old certificate ${physicalId} could not be deleted: ${safeStringify(error)}`;
45143
46258
  this.logger.warn(`Failed to delete old ACM certificate ${physicalId} during replacement: ${safeStringify(error)}. ` + (inUse ? "This usually means a consumer (e.g. a CloudFront distribution) still references it; it can be deleted once DescribeCertificate.InUseBy is empty. " : "") + `The old certificate may be orphaned and require manual cleanup.`);
45144
46259
  }
@@ -45150,7 +46265,8 @@ var ACMCertificateProvider = class {
45150
46265
  return orphanReason !== void 0 ? {
45151
46266
  ...base,
45152
46267
  outcome: "partial",
45153
- reason: orphanReason
46268
+ reason: orphanReason,
46269
+ ...oldResourceSurvivor === "kept" && { oldResourceSurvivor }
45154
46270
  } : base;
45155
46271
  }
45156
46272
  try {
@@ -45316,5 +46432,5 @@ var ACMCertificateProvider = class {
45316
46432
  };
45317
46433
 
45318
46434
  //#endregion
45319
- export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppSyncProvider, BudgetsBudgetProvider, CloudFrontDistributionProvider, CloudFrontOACProvider, CloudFrontOAIProvider, CloudTrailProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, CodeBuildProvider, CodeCommitRepositoryProvider, CognitoUserPoolProvider, DLMLifecyclePolicyProvider, DocDBProvider, DocDBSubnetGroupProvider, DynamoDBGlobalTableProvider, DynamoDBTableProvider, EC2Provider, ECRProvider, ECSProvider, EFSProvider, ELBv2Provider, EMRClusterProvider, EMRInstanceFleetConfigProvider, EMRInstanceGroupConfigProvider, ElastiCacheProvider, EventBridgeBusProvider, EventBridgeRuleProvider, FSxFileSystemProvider, FirehoseProvider, GlueConnectionProvider, GlueCrawlerProvider, GlueJobProvider, GlueProvider, GlueSecurityConfigurationProvider, GlueTriggerProvider, GlueWorkflowProvider, IAMAccessKeyProvider, IAMInstanceProfileProvider, IAMManagedPolicyProvider, IAMPolicyProvider, IAMRoleProvider, IAMUserGroupProvider, KMSProvider, KinesisStreamConsumerProvider, KinesisStreamProvider, LambdaEventInvokeConfigProvider, LambdaEventSourceMappingProvider, LambdaFunctionProvider, LambdaLayerVersionProvider, LambdaMicrovmImageProvider, LambdaPermissionProvider, LambdaUrlProvider, 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 };
45320
- //# sourceMappingURL=provider-classes-DmohfhIq.js.map
46435
+ export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppSyncProvider, BudgetsBudgetProvider, CloudFrontDistributionProvider, CloudFrontOACProvider, CloudFrontOAIProvider, CloudTrailProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, CodeBuildProvider, CodeCommitRepositoryProvider, CognitoUserPoolProvider, DLMLifecyclePolicyProvider, DocDBProvider, DocDBSubnetGroupProvider, DynamoDBGlobalTableProvider, DynamoDBTableProvider, EC2Provider, ECRProvider, ECSProvider, EFSProvider, ELBv2Provider, EMRClusterProvider, EMRInstanceFleetConfigProvider, EMRInstanceGroupConfigProvider, ElastiCacheProvider, EventBridgeBusProvider, EventBridgeRuleProvider, FSxFileSystemProvider, FirehoseProvider, GlueConnectionProvider, GlueCrawlerProvider, GlueJobProvider, GlueProvider, GlueSecurityConfigurationProvider, GlueTriggerProvider, GlueWorkflowProvider, IAMAccessKeyProvider, IAMInstanceProfileProvider, IAMManagedPolicyProvider, IAMPolicyProvider, IAMRoleProvider, IAMUserGroupProvider, KMSProvider, KinesisStreamConsumerProvider, KinesisStreamProvider, LambdaEventInvokeConfigProvider, LambdaEventSourceMappingProvider, LambdaFunctionProvider, LambdaLayerVersionProvider, LambdaMicrovmImageProvider, LambdaNetworkConnectorProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaWebFunctionEndpointProvider, LambdaWebFunctionRevisionProvider, LogsLogGroupProvider, NeptuneProvider, NestedStackProvider, PipesPipeProvider, RDSDBProxyEndpointProvider, RDSDBProxyProvider, RDSDBProxyTargetGroupProvider, RDSProvider, Route53Provider, S3BucketPolicyProvider, S3BucketProvider, S3DirectoryBucketProvider, S3TablesProvider, S3VectorsProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, SNSTopicProvider, SQSQueuePolicyProvider, SQSQueueProvider, SSMParameterProvider, SchedulerScheduleProvider, SecretsManagerSecretProvider, ServiceDiscoveryProvider, StepFunctionsProvider, WAFv2WebACLProvider, WaitConditionHandleProvider };
46436
+ //# sourceMappingURL=provider-classes-CVC9_-km.js.map