@go-to-k/cdkd 0.301.13 → 0.301.15

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 (27) hide show
  1. package/dist/{asg-provider-CTocGE6p.js → asg-provider-ClDYCUia.js} +4 -4
  2. package/dist/{asg-provider-CTocGE6p.js.map → asg-provider-ClDYCUia.js.map} +1 -1
  3. package/dist/{aws-failure-text-YMKku1DS.js → aws-failure-text-CdgZn80O.js} +16 -2
  4. package/dist/{aws-failure-text-YMKku1DS.js.map → aws-failure-text-CdgZn80O.js.map} +1 -1
  5. package/dist/cli.js +2 -2
  6. package/dist/{deploy-engine-DnImYUXS.js → deploy-engine-Dy7N7-Il.js} +102 -41
  7. package/dist/deploy-engine-Dy7N7-Il.js.map +1 -0
  8. package/dist/{iam-policy-targets-Df2XcLrn.js → iam-policy-targets-Dap4bLyq.js} +2 -2
  9. package/dist/{iam-policy-targets-Df2XcLrn.js.map → iam-policy-targets-Dap4bLyq.js.map} +1 -1
  10. package/dist/{iam-role-provider-kw3QPlJV.js → iam-role-provider-C8Icvrf7.js} +4 -4
  11. package/dist/{iam-role-provider-kw3QPlJV.js.map → iam-role-provider-C8Icvrf7.js.map} +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +4 -4
  14. package/dist/{neptune-provider-I_6jHlEU.js → neptune-provider-CtnwSAGM.js} +4 -4
  15. package/dist/{neptune-provider-I_6jHlEU.js.map → neptune-provider-CtnwSAGM.js.map} +1 -1
  16. package/dist/{program-DJGAVTCe.js → program-CXvao3wc.js} +17 -15
  17. package/dist/program-CXvao3wc.js.map +1 -0
  18. package/dist/{provider-classes-BUvql6rX.js → provider-classes-CBbWGsK0.js} +485 -186
  19. package/dist/provider-classes-CBbWGsK0.js.map +1 -0
  20. package/dist/{rds-provider-CybUrptt.js → rds-provider-BMQvQTTS.js} +4 -4
  21. package/dist/{rds-provider-CybUrptt.js.map → rds-provider-BMQvQTTS.js.map} +1 -1
  22. package/dist/{version-CsCqmOl6.js → version-DadUoJjK.js} +2 -2
  23. package/dist/{version-CsCqmOl6.js.map → version-DadUoJjK.js.map} +1 -1
  24. package/package.json +1 -1
  25. package/dist/deploy-engine-DnImYUXS.js.map +0 -1
  26. package/dist/program-DJGAVTCe.js.map +0 -1
  27. package/dist/provider-classes-BUvql6rX.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { r as getAwsClients } from "./aws-clients-B_CEQGE1.js";
2
- import { B as plainIdentOr, F as displayIdent, I as displaySafe, L as displayStackName, R as isPasteableIdent, V as safeMsg, b as generateResourceName, i as safeStringify, k as SECRET_REF_MAX_CODE_POINTS, n as describeAwsFailure, o as getLogger, r as isAwsAuthoredFailure, x as generateResourceNameWithFallback } from "./aws-failure-text-YMKku1DS.js";
3
- import { $ as protectedReplacementAdvice, $n as markReplayMayCollide, $t as ambientCredentialConfig, A as isQuotableImportValue, B as isTerminalDeleteFailure, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Fn as isInertUnquoted, H as observeThenDisableProtection, Hn as withheldTargetClause, In as pasteableCommand, Kt as injectiveKey, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as commandHole, Nt as markSupersedesEarlierCreate, O as isPlainImportJson, P as remedyLogicalId, Pn as hasClauseBreak, Q as pasteableAwsCommand, Qn as markNameCollision, Qt as ambientClientDefaults, Rn as plainOrDescribed, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, Vn as shellQuote, W as rdsFamilyProtectionSite, X as WITHHELD_AWS_COMMAND, Y as UNNAMEABLE_ID_CLAUSE, Z as isAwsCliLiteral, Zt as withPasteableAwsProfile, _ as RecentIdSet, _r as markRedactedCause, _t as createMaskedLogSinks, a as onlySecretDerived, at as startInterruptWatch, b as isInsideWindow, bn as ResourceUpdateNotSupportedError, bt as maskDeep, c as recordedPrincipalsRepair, cr as isExplicitDenyError, ct as canonicalizeRoute53QueryName, dr as isTransientServerError, dt as compositeIdSkipResult, en as clientDefaultsFor, er as relayedNameCollision, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gr as markNonRetryable, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, hr as isThrottlingError, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, in as CdkdError, ir as explicitDenyPolicyKind, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jt as markAuxiliaryFailure, k as isPlainImportValue, lt as compositeIdFormatMessage, mr as isMarkedNonRetryable, nn as AccountIdUnavailableError, o as readPrincipalLists, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pr as THROTTLING_ERROR_NAMES, pt as packCompositeId, q as userPoolProtectionSite, qn as isNameCollisionError, qt as injectiveKeyPrefix, r as SECRET_DERIVED_READ_LIVE, sr as isAmbiguousOutcomeError, tn as credentialFingerprint, u as clearOnUpdateRemoval, ur as isRetryableTransientError, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ProvisioningError, vr as wrapMaskedAwsError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation } from "./iam-policy-targets-Df2XcLrn.js";
2
+ import { A as SECRET_REF_MAX_CODE_POINTS, H as safeMsg, I as displayIdent, L as displaySafe, R as displayStackName, S as generateResourceNameWithFallback, V as plainIdentOr, a as safeStringify, i as isAwsAuthoredFailure, n as describeAwsFailure, r as describeAwsStatusReason, s as getLogger, x as generateResourceName, z as isPasteableIdent } from "./aws-failure-text-CdgZn80O.js";
3
+ import { $ as protectedReplacementAdvice, $n as markReplayMayCollide, $t as ambientCredentialConfig, A as isQuotableImportValue, B as isTerminalDeleteFailure, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Fn as isInertUnquoted, H as observeThenDisableProtection, Hn as withheldTargetClause, In as pasteableCommand, Kt as injectiveKey, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as commandHole, Nt as markSupersedesEarlierCreate, O as isPlainImportJson, P as remedyLogicalId, Pn as hasClauseBreak, Q as pasteableAwsCommand, Qn as markNameCollision, Qt as ambientClientDefaults, Rn as plainOrDescribed, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, Vn as shellQuote, W as rdsFamilyProtectionSite, X as WITHHELD_AWS_COMMAND, Y as UNNAMEABLE_ID_CLAUSE, Z as isAwsCliLiteral, Zt as withPasteableAwsProfile, _ as RecentIdSet, _r as markRedactedCause, _t as createMaskedLogSinks, a as onlySecretDerived, at as startInterruptWatch, b as isInsideWindow, bn as ResourceUpdateNotSupportedError, bt as maskDeep, c as recordedPrincipalsRepair, cr as isExplicitDenyError, ct as canonicalizeRoute53QueryName, dr as isTransientServerError, dt as compositeIdSkipResult, en as clientDefaultsFor, er as relayedNameCollision, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gr as markNonRetryable, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, hr as isThrottlingError, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, in as CdkdError, ir as explicitDenyPolicyKind, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jt as markAuxiliaryFailure, k as isPlainImportValue, lt as compositeIdFormatMessage, mr as isMarkedNonRetryable, nn as AccountIdUnavailableError, o as readPrincipalLists, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pr as THROTTLING_ERROR_NAMES, pt as packCompositeId, q as userPoolProtectionSite, qn as isNameCollisionError, qt as injectiveKeyPrefix, r as SECRET_DERIVED_READ_LIVE, sr as isAmbiguousOutcomeError, tn as credentialFingerprint, u as clearOnUpdateRemoval, ur as isRetryableTransientError, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ProvisioningError, vr as wrapMaskedAwsError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation } from "./iam-policy-targets-Dap4bLyq.js";
4
4
  import { s as ambientRegion } from "./aws-client-defaults-DBXBcg0J.js";
5
- import { $r as reDisableInstanceApiTermination, Aa as refuseMalformedNestedChildOutputs, Ao as configStringRefusal, Bl as renderAssemblyPathEscape, Bo as canonicalLambdaFunctionName, Br as unchangedBehindSecretReference, C as hasCdkAutoDeleteTag, Co as isWarmThroughputDecrease, Cr as stringifyIfAssigned, Dl as canonicalizeRegion, Dn as getStackRecords, Do as coerceCfnInteger, Dt as isAccessDeniedError, E as markRefusedBeforeApplying, Eo as coerceCfnBoolean, Es as withoutPhysicalNameCopies, Et as chunks, F as findNestedTemplateTreeDefect, Fi as getAccountInfo, Fo as requireConfigString, Fs as physicalNameCopiesOf, Gi as parseWebACLArn, Gr as deleteSkipReason, Ho as sameLambdaFunctionAddress, I as isAbsoluteAssetPath, Is as recordAttributeIdCopy, Ji as passedParameterClassesOf, Jn as secretNamedAttributeNamesOf, Jr as markWaitAbandoned, Jt as REDACTED_DELETE_ADDRESS_SKIP_REASON, Kr as withIndeterminateGuard, Kt as getCurrentProducerRegions, L as listNestedTemplateRows, Mo as replayWarn, No as requireConfigArray, Nr as getCurrentResourceSecrets, Ol as derivePartitionAndUrlSuffix, Oo as configBooleanRefusal, Os as dynamicReferenceTokens, Ot as lookupEachName, Po as requireConfigObject, Ps as recoverMaskedOutput, Qr as observeThenDisableInstanceApiTermination, R as renderNestedTemplateTreeDefect, Rl as describeFileReadFailure, S as S3_AUTO_DELETE_OBJECTS_TAG, So as coerceWarmThroughput$1, Sr as definedAttributes, T as getPriorAttempts, Tc as rewriteTemplateAssetReferences, Tn as awaitInFlightSibling, To as toFiniteNumber, Vl as resolveAssemblyPath, Vo as lambdaFunctionNameForMask, Xa as refuseMalformedResourcesForDestroy, Xr as ec2InstanceProtectionSite, Xt as redactedDeleteAddressFields, Yt as isRedactedRecordedValue, Zr as isTerminationProtectionPropagationError, Zt as redactedDeleteAddressSkip, _ as deleteTableWithIndexBusyRetry, _r as planTagDiff, ai as isSettledInstanceState, b as waitForIndexesSettled, bc as stringifyValue, br as tagMapAsList, c as DynamoDBGlobalTableProvider, ci as s3BucketDualStackDomainName, co as withheldAccountClause, cr as earliestDefined, cs as recordReferenceProvenanceEntry, ct as getNestedRevertRun, d as compensateRemovedDeletionProtection, dt as revertNestedChildFromJournal, ei as reEnableInstanceApiTermination, es as passedNoEchoParametersOf, f as deleteBudgetKey, fo as withoutSilentDropProperties, fr as acquireIdempotencyToken, fs as hasMaskableValues, g as INDEX_SETTLE_POLL_INTERVAL_MS, gr as DBPROXY_TAG_OPTIONS, gt as withNestedStackContext, h as DELETE_INDEX_WAIT_PROCEED_NOTE, hi as outputReferenceProvenanceOf, hr as DBPROXY_TAGS_WHAT, ht as getCurrentNestedStackContext, jo as readConfigString, kn as replacedDeleteFailureVerdict, ko as configIntegerRefusal, kr as waitForLambdaFunctionActive, kt as withApiLimit, l as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, li as s3BucketRegionalDomainName, ls as snapshotPassProvenance, m as resolveDynamoDbDeleteBudgetMs, mr as markDeleteStarted, oi as s3BucketArn, os as markSameGenerationBag, p as resolveDynamoDbDeleteBudgetClock, pr as isRefusedByName, qr as isWaitAbandonedError, si as s3BucketDomainName, ss as redactForState, t as DeployEngine, ta as accountArgs, u as beginDeleteWait, ui as s3BucketWebsiteUrl, uo as findSilentDropProperties, ur as reserveStackCreateToken, v as maskedLogger, vr as readTagList, w as isTruthyCfnBoolean, wl as decodeListingKey, wo as toCfnInteger, x as ECR_AUTO_DELETE_IMAGES_TAG, xo as WARM_THROUGHPUT_MEMBERS, xr as tagPlanWarning, y as relayedIndexBusyDelete, yr as refuseMalformedDesiredTags, zl as displayAssemblyPath, zo as withRetry, zr as slowCcOperationTimeoutMs, zs as carriesSecretMask } from "./deploy-engine-DnImYUXS.js";
6
- import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-kw3QPlJV.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-DJGAVTCe.js";
8
- import { RDSProvider } from "./rds-provider-CybUrptt.js";
9
- import { NeptuneProvider } from "./neptune-provider-I_6jHlEU.js";
10
- import { ASGProvider } from "./asg-provider-CTocGE6p.js";
5
+ import { $r as reDisableInstanceApiTermination, Aa as refuseMalformedNestedChildOutputs, Ao as configStringRefusal, Bl as renderAssemblyPathEscape, Bo as canonicalLambdaFunctionName, Br as unchangedBehindSecretReference, C as hasCdkAutoDeleteTag, Co as isWarmThroughputDecrease, Cr as stringifyIfAssigned, Dl as canonicalizeRegion, Dn as getStackRecords, Do as coerceCfnInteger, Dt as isAccessDeniedError, E as markRefusedBeforeApplying, Eo as coerceCfnBoolean, Es as withoutPhysicalNameCopies, Et as chunks, F as findNestedTemplateTreeDefect, Fi as getAccountInfo, Fo as requireConfigString, Fs as physicalNameCopiesOf, Gi as parseWebACLArn, Gr as deleteSkipReason, Ho as sameLambdaFunctionAddress, I as isAbsoluteAssetPath, Is as recordAttributeIdCopy, Ji as passedParameterClassesOf, Jn as secretNamedAttributeNamesOf, Jr as markWaitAbandoned, Jt as REDACTED_DELETE_ADDRESS_SKIP_REASON, Kr as withIndeterminateGuard, Kt as getCurrentProducerRegions, L as listNestedTemplateRows, Mo as replayWarn, No as requireConfigArray, Nr as getCurrentResourceSecrets, Ol as derivePartitionAndUrlSuffix, Oo as configBooleanRefusal, Os as dynamicReferenceTokens, Ot as lookupEachName, Po as requireConfigObject, Ps as recoverMaskedOutput, Qr as observeThenDisableInstanceApiTermination, R as renderNestedTemplateTreeDefect, Rl as describeFileReadFailure, S as S3_AUTO_DELETE_OBJECTS_TAG, So as coerceWarmThroughput$1, Sr as definedAttributes, T as getPriorAttempts, Tc as rewriteTemplateAssetReferences, Tn as awaitInFlightSibling, To as toFiniteNumber, Vl as resolveAssemblyPath, Vo as lambdaFunctionNameForMask, Xa as refuseMalformedResourcesForDestroy, Xr as ec2InstanceProtectionSite, Xt as redactedDeleteAddressFields, Yt as isRedactedRecordedValue, Zr as isTerminationProtectionPropagationError, Zt as redactedDeleteAddressSkip, _ as deleteTableWithIndexBusyRetry, _r as planTagDiff, ai as isSettledInstanceState, b as waitForIndexesSettled, bc as stringifyValue, br as tagMapAsList, c as DynamoDBGlobalTableProvider, ci as s3BucketDualStackDomainName, co as withheldAccountClause, cr as earliestDefined, cs as recordReferenceProvenanceEntry, ct as getNestedRevertRun, d as compensateRemovedDeletionProtection, dt as revertNestedChildFromJournal, ei as reEnableInstanceApiTermination, es as passedNoEchoParametersOf, f as deleteBudgetKey, fo as withoutSilentDropProperties, fr as acquireIdempotencyToken, fs as hasMaskableValues, g as INDEX_SETTLE_POLL_INTERVAL_MS, gr as DBPROXY_TAG_OPTIONS, gt as withNestedStackContext, h as DELETE_INDEX_WAIT_PROCEED_NOTE, hi as outputReferenceProvenanceOf, hr as DBPROXY_TAGS_WHAT, ht as getCurrentNestedStackContext, jo as readConfigString, kn as replacedDeleteFailureVerdict, ko as configIntegerRefusal, kr as waitForLambdaFunctionActive, kt as withApiLimit, l as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, li as s3BucketRegionalDomainName, ls as snapshotPassProvenance, m as resolveDynamoDbDeleteBudgetMs, mr as markDeleteStarted, oi as s3BucketArn, os as markSameGenerationBag, p as resolveDynamoDbDeleteBudgetClock, pr as isRefusedByName, qr as isWaitAbandonedError, si as s3BucketDomainName, ss as redactForState, t as DeployEngine, ta as accountArgs, u as beginDeleteWait, ui as s3BucketWebsiteUrl, uo as findSilentDropProperties, ur as reserveStackCreateToken, v as maskedLogger, vr as readTagList, w as isTruthyCfnBoolean, wl as decodeListingKey, wo as toCfnInteger, x as ECR_AUTO_DELETE_IMAGES_TAG, xo as WARM_THROUGHPUT_MEMBERS, xr as tagPlanWarning, y as relayedIndexBusyDelete, yr as refuseMalformedDesiredTags, zl as displayAssemblyPath, zo as withRetry, zr as slowCcOperationTimeoutMs, zs as carriesSecretMask } from "./deploy-engine-Dy7N7-Il.js";
6
+ import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-C8Icvrf7.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-CXvao3wc.js";
8
+ import { RDSProvider } from "./rds-provider-BMQvQTTS.js";
9
+ import { NeptuneProvider } from "./neptune-provider-CtnwSAGM.js";
10
+ import { ASGProvider } from "./asg-provider-ClDYCUia.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";
@@ -34,7 +34,7 @@ import * as fs from "node:fs";
34
34
  import * as path from "node:path";
35
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";
36
36
  import { AddTagsCommand, CreateListenerCommand, CreateLoadBalancerCommand, CreateTargetGroupCommand, DeleteListenerCommand, DeleteLoadBalancerCommand, DeleteTargetGroupCommand, DeregisterTargetsCommand, DescribeCapacityReservationCommand, DescribeListenerAttributesCommand, DescribeListenersCommand, DescribeLoadBalancerAttributesCommand, DescribeLoadBalancersCommand, DescribeTagsCommand, DescribeTargetGroupAttributesCommand, DescribeTargetGroupsCommand, DescribeTargetHealthCommand, ElasticLoadBalancingV2Client, ModifyCapacityReservationCommand, ModifyIpPoolsCommand, ModifyListenerAttributesCommand, ModifyListenerCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupAttributesCommand, ModifyTargetGroupCommand, RegisterTargetsCommand, RemoveTagsCommand, SetIpAddressTypeCommand, SetSecurityGroupsCommand, SetSubnetsCommand, waitUntilLoadBalancerAvailable } from "@aws-sdk/client-elastic-load-balancing-v2";
37
- import { CreateAliasCommand, CreateKeyCommand, DeleteAliasCommand, DescribeKeyCommand, DisableKeyCommand, DisableKeyRotationCommand, EnableKeyCommand, EnableKeyRotationCommand, GetKeyPolicyCommand, GetKeyRotationStatusCommand, KMSClient, ListAliasesCommand, ListKeysCommand, ListResourceTagsCommand, NotFoundException as NotFoundException$2, PutKeyPolicyCommand, ScheduleKeyDeletionCommand, TagResourceCommand as TagResourceCommand$11, UntagResourceCommand as UntagResourceCommand$11, UpdateAliasCommand, UpdateKeyDescriptionCommand } from "@aws-sdk/client-kms";
37
+ import { CreateAliasCommand, CreateKeyCommand, DeleteAliasCommand, DescribeKeyCommand, DisableKeyCommand, DisableKeyRotationCommand, DisabledException, EnableKeyCommand, EnableKeyRotationCommand, GetKeyPolicyCommand, GetKeyRotationStatusCommand, KMSClient, ListAliasesCommand, ListKeysCommand, ListResourceTagsCommand, NotFoundException as NotFoundException$2, PutKeyPolicyCommand, ScheduleKeyDeletionCommand, TagResourceCommand as TagResourceCommand$11, UntagResourceCommand as UntagResourceCommand$11, UpdateAliasCommand, UpdateKeyDescriptionCommand } from "@aws-sdk/client-kms";
38
38
  import { CreateRepositoryCommand, DeleteLifecyclePolicyCommand, DeleteRepositoryCommand, DeleteRepositoryPolicyCommand, DescribeRepositoriesCommand, ECRClient, GetLifecyclePolicyCommand, LifecyclePolicyNotFoundException, ListTagsForResourceCommand as ListTagsForResourceCommand$9, PutImageScanningConfigurationCommand, PutImageTagMutabilityCommand, PutLifecyclePolicyCommand, RepositoryNotEmptyException, RepositoryNotFoundException, SetRepositoryPolicyCommand, TagResourceCommand as TagResourceCommand$12, UntagResourceCommand as UntagResourceCommand$12 } from "@aws-sdk/client-ecr";
39
39
  import { isDeepStrictEqual } from "node:util";
40
40
  import { AddTagsToResourceCommand as AddTagsToResourceCommand$2, CreateDBProxyCommand, CreateDBProxyEndpointCommand, DBProxyEndpointNotFoundFault, DBProxyNotFoundFault, DBProxyTargetGroupNotFoundFault, DBProxyTargetNotFoundFault, DeleteDBProxyCommand, DeleteDBProxyEndpointCommand, DeregisterDBProxyTargetsCommand, DescribeDBProxiesCommand, DescribeDBProxyEndpointsCommand, DescribeDBProxyTargetGroupsCommand, DescribeDBProxyTargetsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$10, ModifyDBProxyCommand, ModifyDBProxyEndpointCommand, ModifyDBProxyTargetGroupCommand, RDSClient, RegisterDBProxyTargetsCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$2 } from "@aws-sdk/client-rds";
@@ -8789,8 +8789,12 @@ var LambdaUrlProvider = class {
8789
8789
  operationSinks(maskSecrets, pairs) {
8790
8790
  return withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, maskSecrets), pairs);
8791
8791
  }
8792
- wrapMaskedError(mask, error, build) {
8793
- return wrapMaskedAwsError(mask, error, build);
8792
+ wrapMaskedError(log, error, build) {
8793
+ const failure = describeAwsFailure(error);
8794
+ if (!(error instanceof Error)) return build(log.mask(failure.detail));
8795
+ if (!failure.redacted) return wrapMaskedAwsError(log.mask, error, build);
8796
+ log.debug(build(log.mask(failure.detail)).message);
8797
+ return markRedactedCause(build(`${log.mask(failure.summary)}${relayedNameCollision(failure.detail)}`));
8794
8798
  }
8795
8799
  async create(logicalId, resourceType, properties, context) {
8796
8800
  const targetFunctionArn = properties["TargetFunctionArn"];
@@ -8821,7 +8825,7 @@ var LambdaUrlProvider = class {
8821
8825
  };
8822
8826
  } catch (error) {
8823
8827
  const cause = error instanceof Error ? error : void 0;
8824
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create Lambda URL ${logicalId}: ${text}`, resourceType, logicalId, targetFunctionArn, cause));
8828
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to create Lambda URL ${logicalId}: ${text}`, resourceType, logicalId, targetFunctionArn, cause));
8825
8829
  }
8826
8830
  }
8827
8831
  async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
@@ -8887,23 +8891,24 @@ var LambdaUrlProvider = class {
8887
8891
  };
8888
8892
  } catch (error) {
8889
8893
  const cause = error instanceof Error ? error : void 0;
8890
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to update Lambda URL ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
8894
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update Lambda URL ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
8891
8895
  }
8892
8896
  }
8893
- async delete(logicalId, physicalId, resourceType, _properties, context) {
8894
- this.logger.debug(`Deleting Lambda URL ${logicalId}: ${physicalId}`);
8897
+ async delete(logicalId, physicalId, resourceType, properties, context) {
8898
+ const log = this.operationSinks(context?.maskSecrets, [[properties?.["TargetFunctionArn"], physicalId], [properties?.["TargetFunctionArn"], lambdaFunctionNameForMask(physicalId)]]);
8899
+ log.debug(`Deleting Lambda URL ${logicalId}: ${physicalId}`);
8895
8900
  try {
8896
8901
  await this.lambdaClient.send(new DeleteFunctionUrlConfigCommand({ FunctionName: physicalId }));
8897
- this.logger.debug(`Successfully deleted Lambda URL ${logicalId}`);
8902
+ log.debug(`Successfully deleted Lambda URL ${logicalId}`);
8898
8903
  } catch (error) {
8899
8904
  if (error instanceof ResourceNotFoundException) {
8900
8905
  const clientRegion = await this.lambdaClient.config.region();
8901
8906
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
8902
- this.logger.debug(`Lambda URL ${physicalId} does not exist, skipping deletion`);
8907
+ log.debug(`Lambda URL ${physicalId} does not exist, skipping deletion`);
8903
8908
  return;
8904
8909
  }
8905
8910
  const cause = error instanceof Error ? error : void 0;
8906
- throw new ProvisioningError(`Failed to delete Lambda URL ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
8911
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to delete Lambda URL ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
8907
8912
  }
8908
8913
  }
8909
8914
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -9129,6 +9134,14 @@ const KINDS_WITH_ZERO_BATCHING_WINDOW_DEFAULT = /* @__PURE__ */ new Set([
9129
9134
  "dynamodb"
9130
9135
  ]);
9131
9136
  const KINDS_WITH_STREAM_NUMERICS = /* @__PURE__ */ new Set(["kinesis", "dynamodb"]);
9137
+ const DEFAULT_BATCH_SIZE_BY_KIND = /* @__PURE__ */ new Map([
9138
+ ["sqs", 10],
9139
+ ["kinesis", 100],
9140
+ ["dynamodb", 100],
9141
+ ["kafka", 100],
9142
+ ["mq", 100],
9143
+ ["documentdb", 100]
9144
+ ]);
9132
9145
  var LambdaEventSourceMappingProvider = class {
9133
9146
  lambdaClient;
9134
9147
  createClient;
@@ -9185,8 +9198,12 @@ var LambdaEventSourceMappingProvider = class {
9185
9198
  }
9186
9199
  return withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, maskSecrets), pairs);
9187
9200
  }
9188
- wrapMaskedError(mask, error, build) {
9189
- return wrapMaskedAwsError(mask, error, build);
9201
+ wrapMaskedError(log, error, build) {
9202
+ const failure = describeAwsFailure(error);
9203
+ if (!(error instanceof Error)) return build(log.mask(failure.detail));
9204
+ if (!failure.redacted) return wrapMaskedAwsError(log.mask, error, build);
9205
+ log.debug(build(log.mask(failure.detail)).message);
9206
+ return markRedactedCause(build(`${log.mask(failure.summary)}${relayedNameCollision(failure.detail)}`));
9190
9207
  }
9191
9208
  async create(logicalId, resourceType, properties, context) {
9192
9209
  const log = this.operationSinks(context?.maskSecrets, properties);
@@ -9257,7 +9274,7 @@ var LambdaEventSourceMappingProvider = class {
9257
9274
  };
9258
9275
  } catch (error) {
9259
9276
  const cause = error instanceof Error ? error : void 0;
9260
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create event source mapping ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
9277
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to create event source mapping ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
9261
9278
  }
9262
9279
  }
9263
9280
  async reportPossibleMappingOrphans(logicalId, window, log, functionName, sourceArn) {
@@ -9297,7 +9314,7 @@ var LambdaEventSourceMappingProvider = class {
9297
9314
  } catch (error) {
9298
9315
  if (error instanceof CdkdError) throw error;
9299
9316
  const cause = error instanceof Error ? error : void 0;
9300
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to update event source mapping ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
9317
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update event source mapping ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
9301
9318
  }
9302
9319
  }
9303
9320
  async applyUpdate(logicalId, physicalId, resourceType, properties, previousProperties, log, context) {
@@ -9344,6 +9361,14 @@ var LambdaEventSourceMappingProvider = class {
9344
9361
  if (wasSet("TumblingWindowInSeconds")) updateParams.TumblingWindowInSeconds = 0;
9345
9362
  }
9346
9363
  if (wasSet("MaximumBatchingWindowInSeconds") && KINDS_WITH_ZERO_BATCHING_WINDOW_DEFAULT.has(prevKind)) updateParams.MaximumBatchingWindowInSeconds = 0;
9364
+ if (wasSet("BatchSize")) {
9365
+ const defaultBatchSize = DEFAULT_BATCH_SIZE_BY_KIND.get(prevKind);
9366
+ if (defaultBatchSize !== void 0) updateParams.BatchSize = defaultBatchSize;
9367
+ }
9368
+ if (prevKind === "kafka") {
9369
+ if (wasSet("LoggingConfig")) updateParams.LoggingConfig = {};
9370
+ if (wasSet("ProvisionedPollerConfig")) updateParams.ProvisionedPollerConfig = {};
9371
+ }
9347
9372
  const updateResp = await this.lambdaClient.send(new UpdateEventSourceMappingCommand(updateParams));
9348
9373
  const eventSourceMappingArn = updateResp.EventSourceMappingArn;
9349
9374
  if (eventSourceMappingArn) await this.applyTagDiff(eventSourceMappingArn, resourceType, logicalId, previousProperties["Tags"], properties["Tags"], log);
@@ -9378,7 +9403,7 @@ var LambdaEventSourceMappingProvider = class {
9378
9403
  log.debug(`Added/updated ${Object.keys(tagsToAdd).length} tag(s) on EventSourceMapping ${arn}`);
9379
9404
  }
9380
9405
  }
9381
- async delete(logicalId, physicalId, resourceType, _properties, context) {
9406
+ async delete(logicalId, physicalId, resourceType, properties, context) {
9382
9407
  this.logger.debug(`Deleting event source mapping ${logicalId}: ${physicalId}`);
9383
9408
  try {
9384
9409
  try {
@@ -9402,7 +9427,7 @@ var LambdaEventSourceMappingProvider = class {
9402
9427
  return;
9403
9428
  }
9404
9429
  const cause = error instanceof Error ? error : void 0;
9405
- throw new ProvisioningError(`Failed to delete event source mapping ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
9430
+ throw this.wrapMaskedError(this.operationSinks(context?.maskSecrets, properties ?? {}), error, (text) => new ProvisioningError(`Failed to delete event source mapping ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
9406
9431
  }
9407
9432
  }
9408
9433
  async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
@@ -9939,7 +9964,7 @@ var LambdaMicrovmImageProvider = class {
9939
9964
  getMinResourceTimeoutMs() {
9940
9965
  return this.maxPollAttempts * this.pollIntervalMs;
9941
9966
  }
9942
- async create(logicalId, resourceType, properties) {
9967
+ async create(logicalId, resourceType, properties, context) {
9943
9968
  const tagList = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
9944
9969
  this.logger.debug(`Creating MicroVM image ${logicalId}`);
9945
9970
  const name = properties["Name"];
@@ -9988,7 +10013,7 @@ var LambdaMicrovmImageProvider = class {
9988
10013
  })
9989
10014
  };
9990
10015
  } catch (error) {
9991
- const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10016
+ const thrown = this.wrapError("create", logicalId, resourceType, void 0, error, context?.maskSecrets);
9992
10017
  if (createdArn) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdArn);
9993
10018
  throw thrown;
9994
10019
  }
@@ -10046,7 +10071,7 @@ var LambdaMicrovmImageProvider = class {
10046
10071
  })
10047
10072
  };
10048
10073
  } catch (error) {
10049
- throw this.wrapError("update", logicalId, resourceType, physicalId, error);
10074
+ throw this.wrapError("update", logicalId, resourceType, physicalId, error, context?.maskSecrets);
10050
10075
  }
10051
10076
  }
10052
10077
  async delete(logicalId, physicalId, resourceType, _properties, context) {
@@ -10066,7 +10091,7 @@ var LambdaMicrovmImageProvider = class {
10066
10091
  await this.waitForDeleted(physicalId, logicalId);
10067
10092
  this.logger.debug(`Successfully deleted MicroVM image ${logicalId}`);
10068
10093
  } catch (error) {
10069
- throw this.wrapError("delete", logicalId, resourceType, physicalId, error);
10094
+ throw this.wrapError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
10070
10095
  }
10071
10096
  }
10072
10097
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -10173,10 +10198,15 @@ var LambdaMicrovmImageProvider = class {
10173
10198
  Tags: tagsToAdd
10174
10199
  }));
10175
10200
  }
10176
- wrapError(operation, logicalId, resourceType, physicalId, error) {
10201
+ wrapError(operation, logicalId, resourceType, physicalId, error, mask) {
10177
10202
  if (error instanceof ProvisioningError) return error;
10178
10203
  const cause = error instanceof Error ? error : void 0;
10179
- return new ProvisioningError(`Failed to ${operation} MicroVM image ${logicalIdShown(logicalId)}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
10204
+ const build = (text) => new ProvisioningError(`Failed to ${operation} MicroVM image ${logicalIdShown(logicalId)}: ${text}`, resourceType, logicalId, physicalId, cause);
10205
+ const failure = describeAwsFailure(error);
10206
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
10207
+ const m = mask ?? ((text) => text);
10208
+ this.logger.debug(m(build(m(failure.detail)).message));
10209
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
10180
10210
  }
10181
10211
  };
10182
10212
  const BUILD_AFFECTING_CFN_KEYS = [
@@ -10352,16 +10382,16 @@ var LambdaWebFunctionRevisionProvider = class {
10352
10382
  const replayWindow = replayedSendWindow(response, attemptStartMs);
10353
10383
  if (replayWindow !== void 0) await this.reportPossibleRevisionOrphans(logicalId, replayWindow, log, input.functionName);
10354
10384
  if (!createdArn || !response.revisionId) throw new ProvisioningError(`CreateWebFunctionRevision succeeded but returned no revision ARN for ${logicalIdShown(logicalId)}`, resourceType, logicalId);
10355
- const active = await this.waitForActive(input.functionName, createdArn, logicalId);
10385
+ const active = await this.waitForActive(input.functionName, createdArn, logicalId, resourceType, log.mask);
10356
10386
  return {
10357
10387
  physicalId: createdArn,
10358
10388
  attributes: buildAttributes$2(active)
10359
10389
  };
10360
10390
  } catch (error) {
10361
- const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10391
+ const thrown = this.wrapError("create", logicalId, resourceType, void 0, error, log.mask);
10362
10392
  let leftBehindArn = createdArn;
10363
10393
  if (leftBehindArn) try {
10364
- await this.delete(logicalId, leftBehindArn, resourceType);
10394
+ await this.delete(logicalId, leftBehindArn, resourceType, void 0, context?.maskSecrets ? { maskSecrets: context.maskSecrets } : void 0);
10365
10395
  leftBehindArn = void 0;
10366
10396
  } catch (cleanupError) {
10367
10397
  log.warn(safeMsg`Failed to delete partially-created Lambda web function revision ${logicalId}: ${describeAwsFailure(cleanupError).detail}. The failed deploy records it for \`cdkd rollback --revert-failed\`, or delete it by hand`);
@@ -10430,7 +10460,7 @@ var LambdaWebFunctionRevisionProvider = class {
10430
10460
  }
10431
10461
  await this.waitForGone(parts.functionArn, physicalId, logicalId);
10432
10462
  } catch (error) {
10433
- throw this.wrapError("delete", logicalId, resourceType, physicalId, error);
10463
+ throw this.wrapError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
10434
10464
  }
10435
10465
  }
10436
10466
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -10563,7 +10593,7 @@ var LambdaWebFunctionRevisionProvider = class {
10563
10593
  }
10564
10594
  return out;
10565
10595
  }
10566
- async waitForActive(functionName, revisionArn, logicalId) {
10596
+ async waitForActive(functionName, revisionArn, logicalId, resourceType, mask) {
10567
10597
  for (let attempt = 1; attempt <= LAMBDA_WEB_MAX_POLL_ATTEMPTS; attempt++) {
10568
10598
  const resp = await this.client.send(new GetWebFunctionRevisionCommand({
10569
10599
  functionName,
@@ -10571,8 +10601,12 @@ var LambdaWebFunctionRevisionProvider = class {
10571
10601
  }));
10572
10602
  if (resp.state === "Active") return resp;
10573
10603
  if (resp.state === "Failed") {
10574
- const errors = (resp.errors ?? []).map((e) => `${e.errorCode ?? ""} ${e.errorMessage ?? ""}`.trim());
10575
- throw new Error(`Lambda web function revision ${logicalIdShown(logicalId)} entered Failed: ${resp.stateReason ?? "no reason given"}` + (errors.length > 0 ? ` (${errors.join("; ")})` : ""));
10604
+ const errors = (resp.errors ?? []).map((e) => `${e.errorCode ?? ""} ${e.errorMessage ?? ""}`.trim()).filter((e) => e !== "");
10605
+ const reasonText = resp.stateReason || errors.length > 0 ? `${resp.stateReason || "no reason given"}` + (errors.length > 0 ? ` (${errors.join("; ")})` : "") : void 0;
10606
+ throw this.wrapStatusReasonError(mask, {
10607
+ code: resp.errors?.find((e) => e.errorCode)?.errorCode,
10608
+ message: reasonText
10609
+ }, (text, cause) => new ProvisioningError(`Lambda web function revision ${logicalIdShown(logicalId)} entered Failed: ${text}`, resourceType, logicalId, revisionArn, cause));
10576
10610
  }
10577
10611
  await sleep$1(500);
10578
10612
  }
@@ -10593,10 +10627,23 @@ var LambdaWebFunctionRevisionProvider = class {
10593
10627
  }
10594
10628
  throw new Error(`Lambda web function revision ${logicalIdShown(logicalId)} was not fully deleted within ${LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500 / 1e3}s.`);
10595
10629
  }
10596
- wrapError(operation, logicalId, resourceType, physicalId, error) {
10630
+ wrapStatusReasonError(mask, reason, build) {
10631
+ const text = describeAwsStatusReason(reason, "no reason given");
10632
+ if (!text.redacted) return build(text.detail, void 0);
10633
+ const m = mask ?? ((value) => value);
10634
+ const cause = new Error(text.detail);
10635
+ this.logger.debug(m(build(m(text.detail), cause).message));
10636
+ return markRedactedCause(build(m(text.summary), cause));
10637
+ }
10638
+ wrapError(operation, logicalId, resourceType, physicalId, error, mask) {
10597
10639
  if (error instanceof ProvisioningError) return error;
10598
10640
  const cause = error instanceof Error ? error : void 0;
10599
- return new ProvisioningError(`Failed to ${operation} Lambda web function revision ${logicalIdShown(logicalId)}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
10641
+ const build = (text) => new ProvisioningError(`Failed to ${operation} Lambda web function revision ${logicalIdShown(logicalId)}: ${text}`, resourceType, logicalId, physicalId, cause);
10642
+ const failure = describeAwsFailure(error);
10643
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
10644
+ const m = mask ?? ((text) => text);
10645
+ this.logger.debug(m(build(m(failure.detail)).message));
10646
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
10600
10647
  }
10601
10648
  };
10602
10649
  function buildAttributes$2(resp) {
@@ -10713,13 +10760,13 @@ var LambdaWebFunctionEndpointProvider = class {
10713
10760
  try {
10714
10761
  createdArn = (await this.client.send(new CreateWebFunctionEndpointCommand(input))).endpointArn;
10715
10762
  if (!createdArn) throw new ProvisioningError(`CreateWebFunctionEndpoint succeeded but returned no endpoint ARN for ${logicalIdShown(logicalId)}`, resourceType, logicalId);
10716
- const settled = await this.waitForSettled(input.functionName, input.endpointName, logicalId, "create");
10763
+ const settled = await this.waitForSettled(input.functionName, input.endpointName, logicalId, resourceType, "create", void 0, context?.maskSecrets);
10717
10764
  return {
10718
10765
  physicalId: createdArn,
10719
10766
  attributes: buildAttributes$1(settled)
10720
10767
  };
10721
10768
  } catch (error) {
10722
- const thrown = this.wrapError("create", logicalId, resourceType, void 0, error);
10769
+ const thrown = this.wrapError("create", logicalId, resourceType, void 0, error, context?.maskSecrets);
10723
10770
  if (createdArn) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdArn);
10724
10771
  throw thrown;
10725
10772
  }
@@ -10753,10 +10800,10 @@ var LambdaWebFunctionEndpointProvider = class {
10753
10800
  return {
10754
10801
  physicalId,
10755
10802
  wasReplaced: false,
10756
- attributes: buildAttributes$1(await this.waitForSettled(parts.functionArn, parts.childId, logicalId, "update", input.revisionWeights))
10803
+ attributes: buildAttributes$1(await this.waitForSettled(parts.functionArn, parts.childId, logicalId, resourceType, "update", input.revisionWeights, context?.maskSecrets, physicalId))
10757
10804
  };
10758
10805
  } catch (error) {
10759
- throw this.wrapError("update", logicalId, resourceType, physicalId, error);
10806
+ throw this.wrapError("update", logicalId, resourceType, physicalId, error, context?.maskSecrets);
10760
10807
  }
10761
10808
  }
10762
10809
  async delete(logicalId, physicalId, resourceType, _properties, context) {
@@ -10779,7 +10826,7 @@ var LambdaWebFunctionEndpointProvider = class {
10779
10826
  }
10780
10827
  await this.waitForGone(parts.functionArn, parts.childId, logicalId);
10781
10828
  } catch (error) {
10782
- throw this.wrapError("delete", logicalId, resourceType, physicalId, error);
10829
+ throw this.wrapError("delete", logicalId, resourceType, physicalId, error, context?.maskSecrets);
10783
10830
  }
10784
10831
  }
10785
10832
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -10876,7 +10923,7 @@ var LambdaWebFunctionEndpointProvider = class {
10876
10923
  n
10877
10924
  };
10878
10925
  }
10879
- async waitForSettled(functionName, endpointName, logicalId, operation, sentWeights) {
10926
+ async waitForSettled(functionName, endpointName, logicalId, resourceType, operation, sentWeights, mask, physicalId) {
10880
10927
  for (let attempt = 1; attempt <= LAMBDA_WEB_MAX_POLL_ATTEMPTS; attempt++) {
10881
10928
  let resp;
10882
10929
  try {
@@ -10891,8 +10938,8 @@ var LambdaWebFunctionEndpointProvider = class {
10891
10938
  }
10892
10939
  throw error;
10893
10940
  }
10894
- if (resp.state === "Failed") throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} entered Failed: ${resp.stateReason ?? "no reason given"}`);
10895
- if (resp.updateStatus === "Failed") throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} ${operation} failed: ${resp.updateStatusReason ?? "no reason given"}`);
10941
+ if (resp.state === "Failed") throw this.wrapStatusReasonError(mask, { message: resp.stateReason }, (text, cause) => new ProvisioningError(`Lambda web function endpoint ${logicalIdShown(logicalId)} entered Failed: ${text}`, resourceType, logicalId, physicalId, cause));
10942
+ if (resp.updateStatus === "Failed") throw this.wrapStatusReasonError(mask, { message: resp.updateStatusReason }, (text, cause) => new ProvisioningError(`Lambda web function endpoint ${logicalIdShown(logicalId)} ${operation} failed: ${text}`, resourceType, logicalId, physicalId, cause));
10896
10943
  if (resp.state === "Active" && resp.updateStatus !== "InProgress" && (sentWeights === void 0 || sameWeights(sentWeights, resp.revisionWeights))) return resp;
10897
10944
  await sleep$1(500);
10898
10945
  }
@@ -10913,10 +10960,23 @@ var LambdaWebFunctionEndpointProvider = class {
10913
10960
  }
10914
10961
  throw new Error(`Lambda web function endpoint ${logicalIdShown(logicalId)} was not fully deleted within ${LAMBDA_WEB_MAX_POLL_ATTEMPTS * 500 / 1e3}s.`);
10915
10962
  }
10916
- wrapError(operation, logicalId, resourceType, physicalId, error) {
10963
+ wrapStatusReasonError(mask, reason, build) {
10964
+ const text = describeAwsStatusReason(reason, "no reason given");
10965
+ if (!text.redacted) return build(text.detail, void 0);
10966
+ const m = mask ?? ((value) => value);
10967
+ const cause = new Error(text.detail);
10968
+ this.logger.debug(m(build(m(text.detail), cause).message));
10969
+ return markRedactedCause(build(m(text.summary), cause));
10970
+ }
10971
+ wrapError(operation, logicalId, resourceType, physicalId, error, mask) {
10917
10972
  if (error instanceof ProvisioningError) return error;
10918
10973
  const cause = error instanceof Error ? error : void 0;
10919
- return new ProvisioningError(`Failed to ${operation} Lambda web function endpoint ${logicalIdShown(logicalId)}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
10974
+ const build = (text) => new ProvisioningError(`Failed to ${operation} Lambda web function endpoint ${logicalIdShown(logicalId)}: ${text}`, resourceType, logicalId, physicalId, cause);
10975
+ const failure = describeAwsFailure(error);
10976
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
10977
+ const m = mask ?? ((text) => text);
10978
+ this.logger.debug(m(build(m(failure.detail)).message));
10979
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
10920
10980
  }
10921
10981
  };
10922
10982
  function readRevisionWeights(value, fail) {
@@ -15969,7 +16029,7 @@ var EC2Provider = class {
15969
16029
  ])],
15970
16030
  ["AWS::EC2::SubnetNetworkAclAssociation", /* @__PURE__ */ new Set(["SubnetId", "NetworkAclId"])]
15971
16031
  ]);
15972
- removalDefaults = /* @__PURE__ */ new Map([["AWS::EC2::VPC", /* @__PURE__ */ new Map([["EnableDnsHostnames", false], ["EnableDnsSupport", true]])]]);
16032
+ removalDefaults = /* @__PURE__ */ new Map([["AWS::EC2::VPC", /* @__PURE__ */ new Map([["EnableDnsHostnames", false], ["EnableDnsSupport", true]])], ["AWS::EC2::Instance", /* @__PURE__ */ new Map([["Monitoring", false]])]]);
15973
16033
  unhandledByDesign = /* @__PURE__ */ new Map([
15974
16034
  ["AWS::EC2::Instance", /* @__PURE__ */ new Map([["ElasticGpuSpecifications", "AWS Elastic GPU end-of-life (announced 2023-11); no replacement API"], ["ElasticInferenceAccelerators", "AWS Elastic Inference end-of-life 2024-04; use AWS Inferentia / Trainium accelerator instance families instead"]])],
15975
16035
  ["AWS::EC2::SecurityGroupIngress", /* @__PURE__ */ new Map([["GroupName", "EC2-Classic-only — use GroupId for VPC security groups (EC2-Classic retired 2022-08-15)"], ["SourceSecurityGroupName", "EC2-Classic-only — use SourceSecurityGroupId for VPC peer security groups (EC2-Classic retired 2022-08-15)"]])],
@@ -16145,7 +16205,7 @@ var EC2Provider = class {
16145
16205
  case "AWS::EC2::SubnetRouteTableAssociation": return this.updateSubnetRouteTableAssociation(logicalId, physicalId);
16146
16206
  case "AWS::EC2::SecurityGroup": return this.updateSecurityGroup(logicalId, physicalId, resourceType, properties, previousProperties);
16147
16207
  case "AWS::EC2::SecurityGroupIngress": return this.updateSecurityGroupIngress(logicalId, physicalId, resourceType, properties, previousProperties, context?.maskSecrets, context?.replayingState === true, context?.recordedAttributes);
16148
- case "AWS::EC2::Instance": return this.updateInstance(logicalId, physicalId, resourceType, properties, previousProperties);
16208
+ case "AWS::EC2::Instance": return this.updateInstance(logicalId, physicalId, resourceType, properties, previousProperties, context);
16149
16209
  case "AWS::EC2::NetworkAclEntry": return this.updateNetworkAclEntry(logicalId, physicalId, resourceType, properties, previousProperties, context);
16150
16210
  case "AWS::EC2::NetworkAcl":
16151
16211
  case "AWS::EC2::SubnetNetworkAclAssociation": throw new ResourceUpdateNotSupportedError(resourceType, logicalId, "AWS provides no in-place Update API for this EC2 sub-resource type; every property change requires Delete + Create. Re-deploy with cdkd deploy --replace, or destroy + redeploy.");
@@ -17914,9 +17974,10 @@ var EC2Provider = class {
17914
17974
  isInstanceProfilePropagationError(msg) {
17915
17975
  return msg.includes("Invalid IAM Instance Profile") || msg.includes("NoSuchEntity") || msg.includes("not authorized") || msg.includes("InvalidParameterValue") && msg.includes("instance profile");
17916
17976
  }
17917
- async updateInstance(logicalId, physicalId, resourceType, properties, previousProperties) {
17977
+ async updateInstance(logicalId, physicalId, resourceType, properties, previousProperties, context) {
17918
17978
  this.logger.debug(`Updating EC2 Instance ${logicalId}: ${physicalId}`);
17919
17979
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
17980
+ this.guardTerminationProtectionRemoval(logicalId, physicalId, resourceType, properties, previousProperties, context);
17920
17981
  try {
17921
17982
  await this.applyTagDiff(physicalId, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
17922
17983
  await this.updateInstanceSecurityProps(physicalId, properties, previousProperties);
@@ -17931,6 +17992,14 @@ var EC2Provider = class {
17931
17992
  throw this.wrapCaughtError(error, (text) => new ProvisioningError(`Failed to update EC2 Instance ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
17932
17993
  }
17933
17994
  }
17995
+ guardTerminationProtectionRemoval(logicalId, physicalId, resourceType, properties, previousProperties, context) {
17996
+ if (!(context?.removedProperties !== void 0 ? context.removedProperties.has("DisableApiTermination") : previousProperties["DisableApiTermination"] !== void 0 && properties["DisableApiTermination"] === void 0)) return;
17997
+ if (context?.replayingState === true) {
17998
+ if (this.coerceBool(previousProperties["DisableApiTermination"]) === true) this.logger.warn(safeMsg`${logicalId} (${resourceType}): the state being restored does not declare DisableApiTermination; the rollback leaves termination protection at its current AWS value. Set DisableApiTermination to false to turn termination protection off.`);
17999
+ return;
18000
+ }
18001
+ throw markNonRetryable(new ProvisioningError(safeMsg`${logicalId} (${resourceType}): DisableApiTermination was removed from the template, and CloudFormation fails that update for an existing instance. Keep it declared, and set it to false to turn termination protection off. The instance was not updated.`, resourceType, logicalId, physicalId));
18002
+ }
17934
18003
  async updateInstanceSecurityProps(physicalId, properties, previousProperties) {
17935
18004
  const newDisableApiTermination = this.coerceBool(properties["DisableApiTermination"]);
17936
18005
  const oldDisableApiTermination = this.coerceBool(previousProperties["DisableApiTermination"]);
@@ -19480,6 +19549,7 @@ var ApiGatewayProvider = class ApiGatewayProvider {
19480
19549
  ])]
19481
19550
  ]);
19482
19551
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::ApiGateway::Deployment", /* @__PURE__ */ new Map([["StageName", "CFn-only convenience for inline-creating a Stage from a Deployment; declare AWS::ApiGateway::Stage explicitly to attach to this Deployment"], ["StageDescription", "CFn-only convenience for inline-creating a Stage; declare AWS::ApiGateway::Stage with the Description property instead"]])]]);
19552
+ removalDefaults = /* @__PURE__ */ new Map([["AWS::ApiGateway::Account", /* @__PURE__ */ new Map([["CloudWatchRoleArn", ""]])]]);
19483
19553
  static MAX_IAM_RETRIES = 3;
19484
19554
  static IAM_RETRY_DELAY_MS = 1e4;
19485
19555
  constructor() {
@@ -19528,7 +19598,9 @@ var ApiGatewayProvider = class ApiGatewayProvider {
19528
19598
  async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
19529
19599
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
19530
19600
  switch (resourceType) {
19531
- case "AWS::ApiGateway::Account": return this.updateAccount(logicalId, physicalId, resourceType, properties, log);
19601
+ case "AWS::ApiGateway::Account":
19602
+ properties = withRemovalDefaults(this.removalDefaults, resourceType, properties, previousProperties, context);
19603
+ return this.updateAccount(logicalId, physicalId, resourceType, properties, log);
19532
19604
  case "AWS::ApiGateway::Authorizer": return this.updateAuthorizer(logicalId, physicalId, resourceType, properties, previousProperties, log);
19533
19605
  case "AWS::ApiGateway::Resource": return this.updateResource(logicalId, physicalId, resourceType, properties, previousProperties, log);
19534
19606
  case "AWS::ApiGateway::Deployment": return this.updateDeployment(logicalId, physicalId, resourceType);
@@ -20849,6 +20921,7 @@ var ApiGatewayV2Provider = class {
20849
20921
  "IdentityValidationExpression"
20850
20922
  ])]
20851
20923
  ]);
20924
+ removalDefaults = /* @__PURE__ */ new Map([["AWS::ApiGatewayV2::Authorizer", /* @__PURE__ */ new Map([["IdentitySource", []]])]]);
20852
20925
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::ApiGatewayV2::Api", /* @__PURE__ */ new Map([
20853
20926
  ["Body", "OpenAPI/Swagger inline spec; routed through ImportApi, not the field-by-field CreateApi path."],
20854
20927
  ["BodyS3Location", "OpenAPI/Swagger spec on S3; routed through ImportApi, not the field-by-field CreateApi path."],
@@ -20905,9 +20978,9 @@ var ApiGatewayV2Provider = class {
20905
20978
  switch (resourceType) {
20906
20979
  case "AWS::ApiGatewayV2::Api": return this.updateApi(logicalId, physicalId, resourceType, properties, previousProperties, log);
20907
20980
  case "AWS::ApiGatewayV2::Stage": return this.updateStage(logicalId, physicalId, resourceType, properties, previousProperties, log, context?.desiredFromAwsReadback === true);
20908
- case "AWS::ApiGatewayV2::Integration": return this.updateIntegration(logicalId, physicalId, resourceType, properties, previousProperties, log, context?.desiredFromAwsReadback === true);
20981
+ case "AWS::ApiGatewayV2::Integration": return this.updateIntegration(logicalId, physicalId, resourceType, properties, previousProperties, log, context?.desiredFromAwsReadback === true, context);
20909
20982
  case "AWS::ApiGatewayV2::Route": return this.updateRoute(logicalId, physicalId, resourceType, properties, previousProperties, log, context?.desiredFromAwsReadback === true);
20910
- case "AWS::ApiGatewayV2::Authorizer": return this.updateAuthorizer(logicalId, physicalId, resourceType, properties, previousProperties, log);
20983
+ case "AWS::ApiGatewayV2::Authorizer": return this.updateAuthorizer(logicalId, physicalId, resourceType, properties, previousProperties, log, context);
20911
20984
  default: throw new ResourceUpdateNotSupportedError(resourceType, logicalId, "Unsupported API Gateway V2 resource type for in-place update in cdkd; re-deploy with cdkd deploy --replace, or destroy + redeploy the stack.");
20912
20985
  }
20913
20986
  }
@@ -21669,7 +21742,7 @@ var ApiGatewayV2Provider = class {
21669
21742
  throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update API Gateway V2 Stage ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
21670
21743
  }
21671
21744
  }
21672
- async updateIntegration(logicalId, physicalId, resourceType, properties, previousProperties, log, restoreFromAws = false) {
21745
+ async updateIntegration(logicalId, physicalId, resourceType, properties, previousProperties, log, restoreFromAws = false, context) {
21673
21746
  const apiId = properties["ApiId"] ?? previousProperties["ApiId"];
21674
21747
  if (!apiId) throw new ProvisioningError(`ApiId is required to update Integration ${logicalId}`, resourceType, logicalId, physicalId);
21675
21748
  if (properties["ApiId"] !== void 0 && previousProperties["ApiId"] !== void 0 && properties["ApiId"] !== previousProperties["ApiId"]) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, "ApiId is immutable on AWS::ApiGatewayV2::Integration; re-deploy with cdkd deploy --replace");
@@ -21732,7 +21805,32 @@ var ApiGatewayV2Provider = class {
21732
21805
  input.IntegrationSubtype = properties["IntegrationSubtype"];
21733
21806
  changed = true;
21734
21807
  }
21735
- if (input.IntegrationSubtype === void 0) {
21808
+ const subtypeRemoved = context?.removedProperties !== void 0 ? context.removedProperties.has("IntegrationSubtype") : previousProperties["IntegrationSubtype"] != null && properties["IntegrationSubtype"] == null;
21809
+ let effectiveProperties;
21810
+ if (subtypeRemoved && (context?.replayingState !== true || properties["IntegrationUri"] != null)) {
21811
+ if (properties["IntegrationUri"] == null) throw markNonRetryable(new ProvisioningError(safeMsg`${logicalId} (${resourceType}): the previous deploy recorded IntegrationSubtype and this template does not declare it. CloudFormation fails that update (AWS refuses a service integration without its subtype: Invalid integration URI specified). Keep IntegrationSubtype declared, or declare an IntegrationUri to turn this into a URI-based integration. The integration was not updated.`, resourceType, logicalId, physicalId));
21812
+ input.IntegrationUri = properties["IntegrationUri"];
21813
+ changed = true;
21814
+ } else if (subtypeRemoved) {
21815
+ let liveSubtype;
21816
+ try {
21817
+ liveSubtype = (await this.getClient().send(new GetIntegrationCommand({
21818
+ ApiId: apiId,
21819
+ IntegrationId: physicalId
21820
+ }))).IntegrationSubtype;
21821
+ } catch (error) {
21822
+ const cause = error instanceof Error ? error : void 0;
21823
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to read API Gateway V2 Integration ${logicalId} before restoring it: ${text}`, resourceType, logicalId, physicalId, cause));
21824
+ }
21825
+ if (liveSubtype) {
21826
+ input.IntegrationSubtype = liveSubtype;
21827
+ effectiveProperties = {
21828
+ ...properties,
21829
+ IntegrationSubtype: liveSubtype
21830
+ };
21831
+ log.warn(safeMsg`${logicalId} (${resourceType}): the state being restored does not declare IntegrationSubtype; the rollback keeps the integration's current subtype, because AWS refuses a service integration without it.`);
21832
+ }
21833
+ } else if (input.IntegrationSubtype === void 0) {
21736
21834
  const liveSubtype = properties["IntegrationSubtype"] ?? previousProperties["IntegrationSubtype"];
21737
21835
  if (liveSubtype !== void 0) input.IntegrationSubtype = liveSubtype;
21738
21836
  }
@@ -21757,11 +21855,13 @@ var ApiGatewayV2Provider = class {
21757
21855
  input.TlsConfig = properties["TlsConfig"];
21758
21856
  changed = true;
21759
21857
  }
21858
+ if (changed && input.IntegrationSubtype !== void 0) input.RequestParameters = this.serviceIntegrationParameters(logicalId, physicalId, resourceType, input.RequestParameters ?? properties["RequestParameters"]);
21760
21859
  if (!changed) {
21761
21860
  log.debug(`No mutable Integration fields changed for ${logicalId}; skipping UpdateIntegration`);
21762
21861
  return {
21763
21862
  physicalId,
21764
- wasReplaced: false
21863
+ wasReplaced: false,
21864
+ ...effectiveProperties && { effectiveProperties }
21765
21865
  };
21766
21866
  }
21767
21867
  log.debug(`Updating API Gateway V2 Integration ${logicalId}: ${physicalId}`);
@@ -21769,7 +21869,8 @@ var ApiGatewayV2Provider = class {
21769
21869
  await this.getClient().send(new UpdateIntegrationCommand(input));
21770
21870
  return {
21771
21871
  physicalId,
21772
- wasReplaced: false
21872
+ wasReplaced: false,
21873
+ ...effectiveProperties && { effectiveProperties }
21773
21874
  };
21774
21875
  } catch (error) {
21775
21876
  const cause = error instanceof Error ? error : void 0;
@@ -21874,7 +21975,8 @@ var ApiGatewayV2Provider = class {
21874
21975
  throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update API Gateway V2 Route ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
21875
21976
  }
21876
21977
  }
21877
- async updateAuthorizer(logicalId, physicalId, resourceType, properties, previousProperties, log) {
21978
+ async updateAuthorizer(logicalId, physicalId, resourceType, properties, previousProperties, log, context) {
21979
+ properties = withRemovalDefaults(this.removalDefaults, resourceType, properties, previousProperties, context);
21878
21980
  const apiId = properties["ApiId"] ?? previousProperties["ApiId"];
21879
21981
  if (!apiId) throw new ProvisioningError(`ApiId is required to update Authorizer ${logicalId}`, resourceType, logicalId, physicalId);
21880
21982
  if (properties["ApiId"] !== void 0 && previousProperties["ApiId"] !== void 0 && properties["ApiId"] !== previousProperties["ApiId"]) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, "ApiId is immutable on AWS::ApiGatewayV2::Authorizer; re-deploy with cdkd deploy --replace");
@@ -21946,6 +22048,15 @@ var ApiGatewayV2Provider = class {
21946
22048
  throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update API Gateway V2 Authorizer ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
21947
22049
  }
21948
22050
  }
22051
+ serviceIntegrationParameters(logicalId, physicalId, resourceType, sent) {
22052
+ if (sent == null) return void 0;
22053
+ const redacted = Object.keys(sent).filter((key) => {
22054
+ const value = sent[key];
22055
+ return typeof value === "string" && (dynamicReferenceTokens(value).length > 0 || value === "***");
22056
+ });
22057
+ if (redacted.length > 0) throw markNonRetryable(new ProvisioningError(safeMsg`${logicalId} (${resourceType}): this update must re-send the service integration's RequestParameters (AWS re-validates the full mapping beside IntegrationSubtype), but the value of ${redacted.join(", ")} is a redacted secret reference that cdkd cannot send. The integration was not updated.`, resourceType, logicalId, physicalId));
22058
+ return sent;
22059
+ }
21949
22060
  clearableUpdate(next, previous, resetValue) {
21950
22061
  const resolved = next !== void 0 ? next : previous !== void 0 ? resetValue : void 0;
21951
22062
  return {
@@ -23397,6 +23508,14 @@ var AgentCoreEvaluatorProvider = class {
23397
23508
  "KmsKeyArn",
23398
23509
  "Tags"
23399
23510
  ])]]);
23511
+ removalHandledInUpdate = /* @__PURE__ */ new Map([["AWS::BedrockAgentCore::Evaluator", /* @__PURE__ */ new Set([
23512
+ "EvaluatorName",
23513
+ "EvaluatorConfig",
23514
+ "Level",
23515
+ "Description",
23516
+ "KmsKeyArn",
23517
+ "Tags"
23518
+ ])]]);
23400
23519
  constructor() {
23401
23520
  const awsClients = getAwsClients();
23402
23521
  this.client = awsClients.bedrockAgentCoreControl;
@@ -25485,7 +25604,7 @@ const CLEARED_BY_TLS_DOWNGRADE = /* @__PURE__ */ new Set(["SslPolicy", "Certific
25485
25604
  const listenerLeftInPlaceWarning = (logicalId, names, caller) => {
25486
25605
  const one = names.length === 1;
25487
25606
  const subject = one ? "property" : "properties";
25488
- return caller === "rollback" ? safeMsg`${logicalId} (AWS::ElasticLoadBalancingV2::Listener): ${subject} ${names.join(", ")} ${one ? "is" : "are"} absent from the state being restored; ModifyListener keeps a setting it is not sent, so the rollback leaves the value the failed deploy applied in place.` : safeMsg`${logicalId} (AWS::ElasticLoadBalancingV2::Listener): ${subject} ${names.join(", ")} ${one ? "was" : "were"} removed from the template; ModifyListener keeps a setting it is not sent and cdkd sends no reset, so the current AWS value stays in place. Declare the intended value explicitly to change it.`;
25607
+ return caller === "rollback" ? safeMsg`${logicalId} (AWS::ElasticLoadBalancingV2::Listener): ${subject} ${names.join(", ")} ${one ? "is" : "are"} absent from the state being restored; ModifyListener keeps a setting it is not sent, so the rollback leaves the value the failed deploy applied in place.` : safeMsg`${logicalId} (AWS::ElasticLoadBalancingV2::Listener): ${subject} ${names.join(", ")} ${one ? "was" : "were"} removed from the template and ${one ? "keeps its" : "keep their"} current AWS value, as CloudFormation leaves ${one ? "it" : "them"}; ModifyListener keeps a setting it is not sent. Declare the intended value explicitly to change it.`;
25489
25608
  };
25490
25609
  var ELBv2Provider = class {
25491
25610
  elbv2Client;
@@ -28645,6 +28764,10 @@ function templateZoneVisibility(properties) {
28645
28764
  if (!Array.isArray(vpcs)) return void 0;
28646
28765
  return vpcs.some((v) => typeof v === "object" && v !== null && !Array.isArray(v) && !isIntrinsicOnly(v)) ? true : void 0;
28647
28766
  }
28767
+ const VPCS_KEPT_ON_REMOVAL_NOTE = "A private hosted zone stays private and keeps at least one VPC; to change its associations, declare the VPCs you want and deploy.";
28768
+ function declaresNoVpcs(vpcs) {
28769
+ return vpcs == null || Array.isArray(vpcs) && vpcs.length === 0;
28770
+ }
28648
28771
  function sentence$1(text) {
28649
28772
  return text.endsWith(".") ? text : `${text}.`;
28650
28773
  }
@@ -28725,7 +28848,7 @@ var Route53Provider = class {
28725
28848
  }
28726
28849
  async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
28727
28850
  switch (resourceType) {
28728
- case "AWS::Route53::HostedZone": return this.updateHostedZone(logicalId, physicalId, resourceType, properties, previousProperties, context?.maskSecrets);
28851
+ case "AWS::Route53::HostedZone": return this.updateHostedZone(logicalId, physicalId, resourceType, properties, previousProperties, context?.maskSecrets, context);
28729
28852
  case "AWS::Route53::RecordSet": return this.updateRecordSet(logicalId, physicalId, resourceType, properties, previousProperties, context);
28730
28853
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
28731
28854
  }
@@ -28870,7 +28993,7 @@ var Route53Provider = class {
28870
28993
  } : void 0;
28871
28994
  }
28872
28995
  }
28873
- async updateHostedZone(logicalId, physicalId, resourceType, properties, previousProperties, mask) {
28996
+ async updateHostedZone(logicalId, physicalId, resourceType, properties, previousProperties, mask, context) {
28874
28997
  this.logger.debug(`Updating Route 53 hosted zone ${logicalId}: ${physicalId}`);
28875
28998
  try {
28876
28999
  const hostedZoneConfig = properties["HostedZoneConfig"];
@@ -28890,6 +29013,7 @@ var Route53Provider = class {
28890
29013
  }));
28891
29014
  const nameServers = (await this.getClient().send(new GetHostedZoneCommand({ Id: physicalId }))).DelegationSet?.NameServers ?? [];
28892
29015
  this.logger.debug(`Successfully updated hosted zone ${logicalId}`);
29016
+ if (context?.desiredFromAwsReadback !== true && declaresNoVpcs(properties["VPCs"]) && Array.isArray(previousProperties["VPCs"]) && previousProperties["VPCs"].length > 0) this.logger.warn(context?.replayingState ? safeMsg`${logicalId} (AWS::Route53::HostedZone): VPCs is absent from the state being restored, so the rollback leaves the zone's VPC associations in place. ${VPCS_KEPT_ON_REMOVAL_NOTE}` : safeMsg`${logicalId} (AWS::Route53::HostedZone): VPCs was removed from the template, and the zone keeps its current VPC associations, as CloudFormation leaves them. ${VPCS_KEPT_ON_REMOVAL_NOTE}`);
28893
29017
  return {
28894
29018
  physicalId,
28895
29019
  wasReplaced: false,
@@ -31608,6 +31732,10 @@ var ElastiCacheProvider = class {
31608
31732
  //#region src/provisioning/providers/servicediscovery-provider.ts
31609
31733
  const PUBLIC_DNS_NAMESPACE_DEFAULT_SOA_TTL = 60;
31610
31734
  const PRIVATE_DNS_NAMESPACE_DEFAULT_SOA_TTL = 15;
31735
+ const CREATE_SERVICE_NAMESPACE_LAG_MAX_RETRIES = 9;
31736
+ const CREATE_SERVICE_NAMESPACE_LAG_INITIAL_DELAY_MS = 500;
31737
+ const CREATE_SERVICE_NAMESPACE_LAG_MAX_DELAY_MS = 4e3;
31738
+ const CREATE_SERVICE_NAMESPACE_LAG_BACKOFF_SECONDS = Array.from({ length: CREATE_SERVICE_NAMESPACE_LAG_MAX_RETRIES }, (_, i) => Math.min(CREATE_SERVICE_NAMESPACE_LAG_INITIAL_DELAY_MS * 2 ** i, CREATE_SERVICE_NAMESPACE_LAG_MAX_DELAY_MS)).reduce((a, b) => a + b, 0) / 1e3;
31611
31739
  const NAMESPACE_TYPES = [
31612
31740
  "AWS::ServiceDiscovery::PrivateDnsNamespace",
31613
31741
  "AWS::ServiceDiscovery::HttpNamespace",
@@ -31618,6 +31746,19 @@ const NAMESPACE_KIND_BY_TYPE = /* @__PURE__ */ new Map([
31618
31746
  ["AWS::ServiceDiscovery::PublicDnsNamespace", "DNS_PUBLIC"],
31619
31747
  ["AWS::ServiceDiscovery::HttpNamespace", "HTTP"]
31620
31748
  ]);
31749
+ function sameAsRecorded(desired, recorded) {
31750
+ if (typeof recorded === "string" && isRecordedStandIn(recorded)) return false;
31751
+ if (Array.isArray(desired) && Array.isArray(recorded)) return desired.length === recorded.length && desired.every((item, i) => sameAsRecorded(item, recorded[i]));
31752
+ if (desired !== null && recorded !== null && typeof desired === "object" && typeof recorded === "object" && !Array.isArray(desired) && !Array.isArray(recorded)) {
31753
+ const d = desired;
31754
+ const r = recorded;
31755
+ return [.../* @__PURE__ */ new Set([...Object.keys(d), ...Object.keys(r)])].every((key) => Object.hasOwn(d, key) === Object.hasOwn(r, key) && sameAsRecorded(d[key], r[key]));
31756
+ }
31757
+ return isDeepStrictEqual(desired, recorded);
31758
+ }
31759
+ function isRecordedStandIn(value) {
31760
+ return dynamicReferenceTokens(value).length > 0 || value.includes("***");
31761
+ }
31621
31762
  const NAMESPACE_ID_PATTERN = /^ns-[a-z0-9]{16}$/;
31622
31763
  const SERVICE_ID_PATTERN = /^srv-[a-z0-9]{16}$/;
31623
31764
  var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
@@ -31669,6 +31810,17 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
31669
31810
  "Name",
31670
31811
  "Tags",
31671
31812
  "Properties"
31813
+ ])],
31814
+ ["AWS::ServiceDiscovery::Service", /* @__PURE__ */ new Set([
31815
+ "Name",
31816
+ "NamespaceId",
31817
+ "Type",
31818
+ "HealthCheckCustomConfig",
31819
+ "Tags",
31820
+ "ServiceAttributes",
31821
+ "Description",
31822
+ "DnsConfig",
31823
+ "HealthCheckConfig"
31672
31824
  ])]
31673
31825
  ]);
31674
31826
  getClient() {
@@ -31970,16 +32122,31 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
31970
32122
  if (!name) throw new ProvisioningError(`Name is required for ServiceDiscovery Service ${logicalId}`, resourceType, logicalId);
31971
32123
  let leftBehindServiceId;
31972
32124
  try {
31973
- const service = (await client.send(new CreateServiceCommand$1({
31974
- Name: name,
31975
- ...namespaceId && { NamespaceId: namespaceId },
31976
- ...description && { Description: description },
31977
- ...dnsConfig && { DnsConfig: dnsConfig },
31978
- ...healthCheckCustomConfig && { HealthCheckCustomConfig: healthCheckCustomConfig },
31979
- ...healthCheckConfig && { HealthCheckConfig: healthCheckConfig },
31980
- ...tags.length > 0 && { Tags: tags },
31981
- ...type && { Type: type }
31982
- }))).Service;
32125
+ const watch = startInterruptWatch(`Cloud Map service ${logicalId}`);
32126
+ let response;
32127
+ try {
32128
+ response = await withRetry(() => client.send(new CreateServiceCommand$1({
32129
+ Name: name,
32130
+ ...namespaceId && { NamespaceId: namespaceId },
32131
+ ...description && { Description: description },
32132
+ ...dnsConfig && { DnsConfig: dnsConfig },
32133
+ ...healthCheckCustomConfig && { HealthCheckCustomConfig: healthCheckCustomConfig },
32134
+ ...healthCheckConfig && { HealthCheckConfig: healthCheckConfig },
32135
+ ...tags.length > 0 && { Tags: tags },
32136
+ ...type && { Type: type }
32137
+ })), logicalId, {
32138
+ maxRetries: CREATE_SERVICE_NAMESPACE_LAG_MAX_RETRIES,
32139
+ initialDelayMs: CREATE_SERVICE_NAMESPACE_LAG_INITIAL_DELAY_MS,
32140
+ maxDelayMs: CREATE_SERVICE_NAMESPACE_LAG_MAX_DELAY_MS,
32141
+ isRetryable: (_text, error) => error instanceof NamespaceNotFound,
32142
+ logger: this.maskedRetryLogger(maskSecrets),
32143
+ isInterrupted: watch.isInterrupted,
32144
+ onInterrupted: watch.onInterrupted
32145
+ });
32146
+ } finally {
32147
+ watch.dispose();
32148
+ }
32149
+ const service = response.Service;
31983
32150
  if (!service || !service.Id) throw new Error("CreateService did not return Service ID");
31984
32151
  const serviceId = service.Id;
31985
32152
  leftBehindServiceId = serviceId;
@@ -32023,7 +32190,8 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
32023
32190
  };
32024
32191
  } catch (error) {
32025
32192
  const cause = error instanceof Error ? error : void 0;
32026
- const thrown = this.wrapMaskedError(maskerOrIdentity(maskSecrets), error, (text) => new ProvisioningError(`Failed to create service discovery service ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
32193
+ const retriedNote = error instanceof NamespaceNotFound ? ` (Cloud Map still rejected the namespace after ${CREATE_SERVICE_NAMESPACE_LAG_BACKOFF_SECONDS}s of retries)` : "";
32194
+ const thrown = this.wrapMaskedError(maskerOrIdentity(maskSecrets), error, (text) => new ProvisioningError(`Failed to create service discovery service ${logicalId}: ${text}${retriedNote}`, resourceType, logicalId, void 0, cause));
32027
32195
  if (leftBehindServiceId) markCreatedBeforeFailure(thrown, logicalId, resourceType, leftBehindServiceId);
32028
32196
  throw thrown;
32029
32197
  }
@@ -32032,17 +32200,14 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
32032
32200
  this.logger.debug(`Updating service discovery service ${logicalId}: ${physicalId}`);
32033
32201
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
32034
32202
  const client = this.getClient();
32035
- const serviceChange = {};
32036
- if (properties["Description"] !== void 0) serviceChange.Description = properties["Description"];
32037
- const dnsConfig = properties["DnsConfig"];
32038
- if (dnsConfig?.DnsRecords !== void 0) serviceChange.DnsConfig = { DnsRecords: dnsConfig.DnsRecords };
32039
- if (properties["HealthCheckConfig"] !== void 0) serviceChange.HealthCheckConfig = properties["HealthCheckConfig"];
32203
+ const servicePlan = this.planServiceChange(properties, previousProperties);
32204
+ const serviceChange = servicePlan?.change ?? {};
32040
32205
  const newAttrs = this.normalizeServiceAttributes(properties["ServiceAttributes"]);
32041
32206
  const oldAttrs = this.normalizeServiceAttributes(previousProperties["ServiceAttributes"]);
32042
32207
  const upsertAttrs = {};
32043
32208
  for (const [k, v] of Object.entries(newAttrs)) if (oldAttrs[k] !== v) upsertAttrs[k] = v;
32044
32209
  const removedAttrKeys = Object.keys(oldAttrs).filter((k) => !Object.hasOwn(newAttrs, k));
32045
- const hasServiceChange = Object.keys(serviceChange).length > 0;
32210
+ const hasServiceChange = servicePlan !== void 0;
32046
32211
  const hasAttrUpsert = Object.keys(upsertAttrs).length > 0;
32047
32212
  const hasAttrRemove = removedAttrKeys.length > 0;
32048
32213
  const tagPlan = planTagDiff(previousProperties["Tags"], properties["Tags"]);
@@ -32056,8 +32221,10 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
32056
32221
  wasReplaced: false
32057
32222
  };
32058
32223
  }
32224
+ let knownArn;
32059
32225
  try {
32060
32226
  if (hasServiceChange) {
32227
+ if (servicePlan.keepRemovedFromLive) knownArn = await this.keepUndeclaredServiceFields(physicalId, serviceChange);
32061
32228
  const operationId = (await client.send(new UpdateServiceCommand$1({
32062
32229
  Id: physicalId,
32063
32230
  Service: serviceChange
@@ -32094,7 +32261,7 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
32094
32261
  }
32095
32262
  }
32096
32263
  if (hasTagChange) {
32097
- const arn = (await client.send(new GetServiceCommand({ Id: physicalId }))).Service?.Arn;
32264
+ const arn = knownArn ?? (await client.send(new GetServiceCommand({ Id: physicalId }))).Service?.Arn;
32098
32265
  if (!arn) throw new ProvisioningError(safeMsg`Could not resolve the ARN of service discovery service ${logicalId}; its Tags were not updated`, resourceType, logicalId, physicalId);
32099
32266
  if (tagPlan.remove.length > 0) await client.send(new UntagResourceCommand$16({
32100
32267
  ResourceARN: arn,
@@ -32119,6 +32286,30 @@ var ServiceDiscoveryProvider = class ServiceDiscoveryProvider {
32119
32286
  throw this.wrapMaskedError(maskerOrIdentity(maskSecrets), error, (text) => new ProvisioningError(`Failed to update service discovery service ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
32120
32287
  }
32121
32288
  }
32289
+ planServiceChange(properties, previousProperties) {
32290
+ const declaredDiffers = (key) => properties[key] !== void 0 && !sameAsRecorded(properties[key], previousProperties[key]);
32291
+ const change = {};
32292
+ if (properties["Description"] !== void 0) change.Description = properties["Description"];
32293
+ const desiredRecords = properties["DnsConfig"]?.DnsRecords;
32294
+ const previousRecords = previousProperties["DnsConfig"]?.DnsRecords;
32295
+ if (desiredRecords !== void 0) change.DnsConfig = { DnsRecords: desiredRecords };
32296
+ if (properties["HealthCheckConfig"] !== void 0) change.HealthCheckConfig = properties["HealthCheckConfig"];
32297
+ if (declaredDiffers("Description") || declaredDiffers("HealthCheckConfig")) return {
32298
+ change,
32299
+ keepRemovedFromLive: false
32300
+ };
32301
+ if (desiredRecords !== void 0 && !sameAsRecorded(desiredRecords, previousRecords)) return {
32302
+ change,
32303
+ keepRemovedFromLive: true
32304
+ };
32305
+ }
32306
+ async keepUndeclaredServiceFields(physicalId, serviceChange) {
32307
+ if (serviceChange.Description !== void 0 && serviceChange.HealthCheckConfig !== void 0) return;
32308
+ const live = (await this.getClient().send(new GetServiceCommand({ Id: physicalId }))).Service;
32309
+ if (serviceChange.Description === void 0 && live?.Description !== void 0) serviceChange.Description = live.Description;
32310
+ if (serviceChange.HealthCheckConfig === void 0 && live?.HealthCheckConfig !== void 0) serviceChange.HealthCheckConfig = live.HealthCheckConfig;
32311
+ return live?.Arn;
32312
+ }
32122
32313
  async deleteService(logicalId, physicalId, resourceType, context) {
32123
32314
  this.logger.debug(`Deleting service discovery service ${logicalId}: ${physicalId}`);
32124
32315
  const client = this.getClient();
@@ -36319,6 +36510,7 @@ var KMSProvider = class {
36319
36510
  "Origin",
36320
36511
  "BypassPolicyLockoutSafetyCheck"
36321
36512
  ])], ["AWS::KMS::Alias", /* @__PURE__ */ new Set(["AliasName", "TargetKeyId"])]]);
36513
+ removalDefaults = /* @__PURE__ */ new Map([["AWS::KMS::Key", /* @__PURE__ */ new Map([["RotationPeriodInDays", 365]])]]);
36322
36514
  getClient() {
36323
36515
  if (!this.client) this.client = new KMSClient({
36324
36516
  ...ambientClientDefaults(),
@@ -36343,7 +36535,7 @@ var KMSProvider = class {
36343
36535
  async update(logicalId, physicalId, resourceType, properties, _previousProperties, context) {
36344
36536
  assertRegionMatch(context?.expectedRegion ? await this.getClient().config.region() : void 0, context?.expectedRegion, resourceType, logicalId, physicalId, "pre-update");
36345
36537
  switch (resourceType) {
36346
- case "AWS::KMS::Key": return this.updateKey(logicalId, physicalId, resourceType, properties, _previousProperties, context?.maskSecrets);
36538
+ case "AWS::KMS::Key": return this.updateKey(logicalId, physicalId, resourceType, properties, _previousProperties, context);
36347
36539
  case "AWS::KMS::Alias": return this.updateAlias(logicalId, physicalId, resourceType, properties, context?.maskSecrets);
36348
36540
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
36349
36541
  }
@@ -36362,7 +36554,7 @@ var KMSProvider = class {
36362
36554
  const keyPolicy = properties["KeyPolicy"];
36363
36555
  const keySpec = properties["KeySpec"];
36364
36556
  const keyUsage = properties["KeyUsage"];
36365
- const enableKeyRotation = properties["EnableKeyRotation"];
36557
+ const enableKeyRotation = templateBool(properties["EnableKeyRotation"]);
36366
36558
  const multiRegion = properties["MultiRegion"];
36367
36559
  const origin = properties["Origin"];
36368
36560
  const bypassPolicyLockoutSafetyCheck = properties["BypassPolicyLockoutSafetyCheck"];
@@ -36383,7 +36575,7 @@ var KMSProvider = class {
36383
36575
  const inputDigest = createHash("sha256").update(JSON.stringify({
36384
36576
  input,
36385
36577
  enableKeyRotation: enableKeyRotation === true,
36386
- enabled: properties["Enabled"] !== false
36578
+ enabled: templateBool(properties["Enabled"]) !== false
36387
36579
  })).digest("hex");
36388
36580
  let createdKeyId;
36389
36581
  let supersededPending = false;
@@ -36419,7 +36611,7 @@ var KMSProvider = class {
36419
36611
  if (replayWindow !== void 0) await this.reportPossibleOrphanKeys(logicalId, input, replayWindow);
36420
36612
  }
36421
36613
  createdKeyId = keyId;
36422
- if (enableKeyRotation) {
36614
+ if (enableKeyRotation === true) {
36423
36615
  const rotationPeriodInDays = properties["RotationPeriodInDays"];
36424
36616
  this.logger.debug(`Enabling key rotation for KMS Key ${logicalId}`);
36425
36617
  await this.getClient().send(new EnableKeyRotationCommand({
@@ -36427,7 +36619,7 @@ var KMSProvider = class {
36427
36619
  ...rotationPeriodInDays !== void 0 && { RotationPeriodInDays: rotationPeriodInDays }
36428
36620
  }));
36429
36621
  }
36430
- if (properties["Enabled"] === false) {
36622
+ if (templateBool(properties["Enabled"]) === false) {
36431
36623
  this.logger.debug(`Disabling KMS Key ${logicalId}`);
36432
36624
  await this.getClient().send(new DisableKeyCommand({ KeyId: keyId }));
36433
36625
  }
@@ -36567,9 +36759,13 @@ var KMSProvider = class {
36567
36759
  const deletion = shown.map((keyId) => aws`aws kms schedule-key-deletion --key-id ${keyId}${region} --pending-window-in-days 7`.render()).join(" ; ");
36568
36760
  this.logger.warn(safeMsg`${lead}, and KMS may have created a key then that no cdkd state records. ${candidates.length} customer managed key(s) created between ${since} and ${until} match this key's settings: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. cdkd does not adopt or delete them, because a key has no name or token that ties it to ${logicalId} -- another key with the same settings is indistinguishable. ${window.replayedInSend === true ? "cdkd recorded the key the create returned, so the orphan (if any) and that key both exist." : "Creating a new key now, so the orphan (if any) and the new key will both exist."} First inspect each candidate: ${inspect}. Only after confirming a key is this deploy's orphan and no other deploy uses it, schedule its deletion: ${deletion}.${incomplete}`);
36569
36761
  }
36570
- async updateKey(logicalId, physicalId, resourceType, properties, previousProperties, mask) {
36762
+ async updateKey(logicalId, physicalId, resourceType, properties, previousProperties, context) {
36571
36763
  this.logger.debug(`Updating KMS Key ${logicalId}: ${physicalId}`);
36764
+ const mask = context?.maskSecrets;
36765
+ properties = withRemovalDefaults(this.removalDefaults, resourceType, properties, previousProperties, context);
36572
36766
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
36767
+ const newEnabled = templateBool(properties["Enabled"]);
36768
+ const enabledChange = newEnabled === templateBool(previousProperties["Enabled"]) ? void 0 : newEnabled === false ? "disable" : "enable";
36573
36769
  try {
36574
36770
  const newDescription = properties["Description"];
36575
36771
  if (newDescription !== previousProperties["Description"]) {
@@ -36579,41 +36775,49 @@ var KMSProvider = class {
36579
36775
  Description: newDescription ?? ""
36580
36776
  }));
36581
36777
  }
36582
- const newEnableKeyRotation = properties["EnableKeyRotation"];
36583
- if (newEnableKeyRotation !== previousProperties["EnableKeyRotation"]) {
36584
- if (newEnableKeyRotation) {
36585
- const rotationPeriodInDays = properties["RotationPeriodInDays"];
36778
+ if (enabledChange === "enable") {
36779
+ this.logger.debug(`Enabling KMS Key ${logicalId}`);
36780
+ await this.getClient().send(new EnableKeyCommand({ KeyId: physicalId }));
36781
+ }
36782
+ const newEnableKeyRotation = templateBool(properties["EnableKeyRotation"]);
36783
+ const oldEnableKeyRotation = templateBool(previousProperties["EnableKeyRotation"]);
36784
+ const rotationPeriodInDays = properties["RotationPeriodInDays"];
36785
+ if (newEnableKeyRotation === true) {
36786
+ if (newEnableKeyRotation !== oldEnableKeyRotation || rotationPeriodInDays !== void 0 && rotationPeriodInDays !== previousProperties["RotationPeriodInDays"]) {
36586
36787
  this.logger.debug(`Enabling key rotation for KMS Key ${logicalId}`);
36587
- await this.getClient().send(new EnableKeyRotationCommand({
36788
+ await this.sendRotation(() => this.getClient().send(new EnableKeyRotationCommand({
36588
36789
  KeyId: physicalId,
36589
36790
  ...rotationPeriodInDays !== void 0 && { RotationPeriodInDays: rotationPeriodInDays }
36590
- }));
36591
- } else {
36592
- this.logger.debug(`Disabling key rotation for KMS Key ${logicalId}`);
36593
- await this.getClient().send(new DisableKeyRotationCommand({ KeyId: physicalId }));
36791
+ })), enabledChange === "enable", resourceType, logicalId, physicalId);
36594
36792
  }
36793
+ } else if (newEnableKeyRotation !== oldEnableKeyRotation) {
36794
+ this.logger.debug(`Disabling key rotation for KMS Key ${logicalId}`);
36795
+ await this.sendRotation(() => this.getClient().send(new DisableKeyRotationCommand({ KeyId: physicalId })), enabledChange === "enable", resourceType, logicalId, physicalId);
36595
36796
  }
36596
- const newEnabled = properties["Enabled"];
36597
- if (newEnabled !== previousProperties["Enabled"]) {
36598
- if (newEnabled === false) {
36599
- this.logger.debug(`Disabling KMS Key ${logicalId}`);
36600
- await this.getClient().send(new DisableKeyCommand({ KeyId: physicalId }));
36601
- } else {
36602
- this.logger.debug(`Enabling KMS Key ${logicalId}`);
36603
- await this.getClient().send(new EnableKeyCommand({ KeyId: physicalId }));
36604
- }
36797
+ if (enabledChange === "disable") {
36798
+ this.logger.debug(`Disabling KMS Key ${logicalId}`);
36799
+ await this.getClient().send(new DisableKeyCommand({ KeyId: physicalId }));
36605
36800
  }
36606
36801
  await this.applyTagDiff(physicalId, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
36607
36802
  const newKeyPolicy = properties["KeyPolicy"];
36608
36803
  const oldKeyPolicy = previousProperties["KeyPolicy"];
36609
36804
  const newPolicyStr = newKeyPolicy ? typeof newKeyPolicy === "string" ? newKeyPolicy : JSON.stringify(newKeyPolicy) : void 0;
36610
- if (newPolicyStr !== (oldKeyPolicy ? typeof oldKeyPolicy === "string" ? oldKeyPolicy : JSON.stringify(oldKeyPolicy) : void 0) && newPolicyStr) {
36805
+ const oldPolicyStr = oldKeyPolicy ? typeof oldKeyPolicy === "string" ? oldKeyPolicy : JSON.stringify(oldKeyPolicy) : void 0;
36806
+ const policyRemoved = context?.removedProperties !== void 0 ? context.removedProperties.has("KeyPolicy") : oldKeyPolicy !== void 0 && newKeyPolicy === void 0;
36807
+ if (newPolicyStr !== oldPolicyStr && newPolicyStr) {
36611
36808
  this.logger.debug(`Updating key policy for KMS Key ${logicalId}`);
36612
36809
  await this.getClient().send(new PutKeyPolicyCommand({
36613
36810
  KeyId: physicalId,
36614
36811
  PolicyName: "default",
36615
36812
  Policy: newPolicyStr
36616
36813
  }));
36814
+ } else if (policyRemoved && newKeyPolicy === void 0) {
36815
+ this.logger.debug(safeMsg`Resetting key policy for KMS Key ${logicalId} to the default`);
36816
+ await this.getClient().send(new PutKeyPolicyCommand({
36817
+ KeyId: physicalId,
36818
+ PolicyName: "default",
36819
+ Policy: await this.defaultKeyPolicy(physicalId)
36820
+ }));
36617
36821
  }
36618
36822
  this.logger.debug(`Successfully updated KMS Key ${logicalId}`);
36619
36823
  return {
@@ -36621,10 +36825,35 @@ var KMSProvider = class {
36621
36825
  wasReplaced: false
36622
36826
  };
36623
36827
  } catch (error) {
36828
+ if (error instanceof CdkdError) throw error;
36624
36829
  const cause = error instanceof Error ? error : void 0;
36625
36830
  throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to update KMS Key ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
36626
36831
  }
36627
36832
  }
36833
+ async sendRotation(send, justEnabled, resourceType, logicalId, physicalId) {
36834
+ try {
36835
+ await send();
36836
+ } catch (error) {
36837
+ if (!(error instanceof DisabledException) || justEnabled) throw error;
36838
+ throw markNonRetryable(new ProvisioningError(safeMsg`Failed to update KMS Key ${logicalId}: the key is currently disabled in AWS, and KMS refuses a key rotation change on a disabled key (CloudFormation fails this update too). Enable the key first (declare Enabled: true, or enable it in AWS), or drop the rotation change from this update.`, resourceType, logicalId, physicalId, error));
36839
+ }
36840
+ }
36841
+ async defaultKeyPolicy(keyId) {
36842
+ const resp = await this.getClient().send(new DescribeKeyCommand({ KeyId: keyId }));
36843
+ const match = /^arn:([^:]+):kms:[^:]*:(\d{12}):key\//.exec(resp.KeyMetadata?.Arn ?? "");
36844
+ if (match === null) throw new Error("DescribeKey returned no key ARN, so the default key policy cannot name the account");
36845
+ return JSON.stringify({
36846
+ Version: "2012-10-17",
36847
+ Id: "key-default-1",
36848
+ Statement: [{
36849
+ Sid: "Enable IAM User Permissions",
36850
+ Effect: "Allow",
36851
+ Principal: { AWS: `arn:${match[1]}:iam::${match[2]}:root` },
36852
+ Action: "kms:*",
36853
+ Resource: "*"
36854
+ }]
36855
+ });
36856
+ }
36628
36857
  async deleteKey(logicalId, physicalId, resourceType, properties, context) {
36629
36858
  this.logger.debug(`Scheduling deletion for KMS Key ${logicalId}: ${physicalId}`);
36630
36859
  const pendingWindowInDays = properties?.["PendingWindowInDays"] ?? 7;
@@ -36831,6 +37060,11 @@ var KMSProvider = class {
36831
37060
  return null;
36832
37061
  }
36833
37062
  };
37063
+ function templateBool(value) {
37064
+ if (value === void 0 || value === null) return void 0;
37065
+ if (typeof value === "string") return value.toLowerCase() === "true";
37066
+ return Boolean(value);
37067
+ }
36834
37068
 
36835
37069
  //#endregion
36836
37070
  //#region src/provisioning/providers/budgets-budget-provider.ts
@@ -39205,8 +39439,12 @@ var EFSProvider = class {
39205
39439
  this.getClient();
39206
39440
  return this.mountTargetCreateClient;
39207
39441
  }
39208
- wrapMaskedError(mask, error, build) {
39209
- return wrapMaskedAwsError(mask, error, build);
39442
+ wrapMaskedError(log, error, build) {
39443
+ const failure = describeAwsFailure(error);
39444
+ if (!(error instanceof Error)) return build(log.mask(failure.detail));
39445
+ if (!failure.redacted) return wrapMaskedAwsError(log.mask, error, build);
39446
+ log.debug(build(log.mask(failure.detail)).message);
39447
+ return markRedactedCause(build(`${log.mask(failure.summary)}${relayedNameCollision(failure.detail)}`));
39210
39448
  }
39211
39449
  async create(logicalId, resourceType, properties, context) {
39212
39450
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
@@ -39278,7 +39516,7 @@ var EFSProvider = class {
39278
39516
  } catch (error) {
39279
39517
  if (error instanceof ProvisioningError) throw error;
39280
39518
  const cause = error instanceof Error ? error : void 0;
39281
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to update EFS FileSystem ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39519
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update EFS FileSystem ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39282
39520
  }
39283
39521
  }
39284
39522
  async updateMountTarget(logicalId, physicalId, resourceType, properties, log) {
@@ -39303,7 +39541,7 @@ var EFSProvider = class {
39303
39541
  };
39304
39542
  } catch (error) {
39305
39543
  const cause = error instanceof Error ? error : void 0;
39306
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to update EFS MountTarget ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39544
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to update EFS MountTarget ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39307
39545
  }
39308
39546
  }
39309
39547
  async delete(logicalId, physicalId, resourceType, _properties, context) {
@@ -39385,7 +39623,7 @@ var EFSProvider = class {
39385
39623
  }
39386
39624
  }
39387
39625
  const cause = error instanceof Error ? error : void 0;
39388
- const thrown = error instanceof ProvisioningError ? error : this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create EFS FileSystem ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
39626
+ const thrown = error instanceof ProvisioningError ? error : this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to create EFS FileSystem ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
39389
39627
  if (fileSystemLeftBehind && fileSystemId !== void 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, fileSystemId);
39390
39628
  throw thrown;
39391
39629
  }
@@ -39510,7 +39748,8 @@ var EFSProvider = class {
39510
39748
  return;
39511
39749
  }
39512
39750
  const cause = error instanceof Error ? error : void 0;
39513
- throw new ProvisioningError(`Failed to delete EFS FileSystem ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
39751
+ const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
39752
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to delete EFS FileSystem ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39514
39753
  }
39515
39754
  }
39516
39755
  async waitForFileSystemAvailable(fileSystemId, logicalId, resourceType, log) {
@@ -39549,7 +39788,7 @@ var EFSProvider = class {
39549
39788
  };
39550
39789
  } catch (error) {
39551
39790
  const cause = error instanceof Error ? error : void 0;
39552
- const thrown = error instanceof ProvisioningError ? error : this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create EFS MountTarget ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
39791
+ const thrown = error instanceof ProvisioningError ? error : this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to create EFS MountTarget ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
39553
39792
  if (createdMountTargetId) markCreatedBeforeFailure(thrown, logicalId, resourceType, createdMountTargetId);
39554
39793
  throw thrown;
39555
39794
  }
@@ -39580,7 +39819,8 @@ var EFSProvider = class {
39580
39819
  return;
39581
39820
  }
39582
39821
  const cause = error instanceof Error ? error : void 0;
39583
- throw new ProvisioningError(`Failed to delete EFS MountTarget ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
39822
+ const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
39823
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to delete EFS MountTarget ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39584
39824
  }
39585
39825
  }
39586
39826
  async waitForMountTargetDeleted(mountTargetId, logicalId) {
@@ -39648,7 +39888,7 @@ var EFSProvider = class {
39648
39888
  } catch (error) {
39649
39889
  if (error instanceof ProvisioningError) throw error;
39650
39890
  const cause = error instanceof Error ? error : void 0;
39651
- throw this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(`Failed to create EFS AccessPoint ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
39891
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to create EFS AccessPoint ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
39652
39892
  }
39653
39893
  }
39654
39894
  async createOrAdoptAccessPoint(logicalId, resourceType, log, input) {
@@ -39709,7 +39949,8 @@ var EFSProvider = class {
39709
39949
  return;
39710
39950
  }
39711
39951
  const cause = error instanceof Error ? error : void 0;
39712
- throw new ProvisioningError(`Failed to delete EFS AccessPoint ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
39952
+ const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
39953
+ throw this.wrapMaskedError(log, error, (text) => new ProvisioningError(`Failed to delete EFS AccessPoint ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
39713
39954
  }
39714
39955
  }
39715
39956
  async readCurrentState(physicalId, _logicalId, resourceType) {
@@ -39986,6 +40227,21 @@ var FSxFileSystemProvider = class {
39986
40227
  this.pollIntervalMs = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS$3;
39987
40228
  this.maxWaitMs = options?.maxWaitMs ?? DEFAULT_MAX_WAIT_MS$3;
39988
40229
  }
40230
+ wrapStatusReasonError(mask, message, build) {
40231
+ const text = describeAwsStatusReason({ message }, "no failure details reported");
40232
+ if (!text.redacted) return build(text.detail, void 0);
40233
+ const m = maskerOrIdentity(mask);
40234
+ const cause = new Error(text.detail);
40235
+ this.logger.debug(m(build(m(text.detail), cause).message));
40236
+ return markRedactedCause(build(m(text.summary), cause));
40237
+ }
40238
+ wrapCaughtError(mask, error, build) {
40239
+ const failure = describeAwsFailure(error);
40240
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
40241
+ const m = maskerOrIdentity(mask);
40242
+ this.logger.debug(m(build(m(failure.detail)).message));
40243
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
40244
+ }
39989
40245
  handledProperties = /* @__PURE__ */ new Map([["AWS::FSx::FileSystem", /* @__PURE__ */ new Set([
39990
40246
  "BackupId",
39991
40247
  "FileSystemType",
@@ -40019,7 +40275,7 @@ var FSxFileSystemProvider = class {
40019
40275
  getMinResourceTimeoutMs() {
40020
40276
  return this.maxWaitMs;
40021
40277
  }
40022
- async create(logicalId, resourceType, properties) {
40278
+ async create(logicalId, resourceType, properties, context) {
40023
40279
  const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
40024
40280
  if (resourceType !== "AWS::FSx::FileSystem") throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId);
40025
40281
  const backupId = properties["BackupId"];
@@ -40085,7 +40341,7 @@ var FSxFileSystemProvider = class {
40085
40341
  throw markNonRetryable(new ProvisioningError(safeMsg`FSx answered the create of ${logicalId} with file system ${returnedId}, which ${createdAt === void 0 ? "carries no creation time" : "predates this create"}: the create token cdkd derives for this stack's file system is held by it, and it is NOT recorded in cdkd state. It is not one this deploy, or an interrupted earlier deploy of this stack, made: it was created under this token by an earlier cdkd version, or a completed deploy recorded it and cdkd later let go of it, and it may hold data, so cdkd neither records nor deletes it. Inspect it with: ${inspect} --file-system-ids ${returnedId} -- then import it into this stack, or delete it once you are sure its data is not needed, and deploy again.`, resourceType, logicalId));
40086
40342
  }
40087
40343
  fileSystemId = returnedId;
40088
- const fs = await this.waitForFileSystemAvailable(fileSystemId, logicalId, resourceType);
40344
+ const fs = await this.waitForFileSystemAvailable(fileSystemId, logicalId, resourceType, context?.maskSecrets);
40089
40345
  this.logger.debug(`Successfully created FSx FileSystem ${logicalId}: ${fileSystemId}`);
40090
40346
  this.createTokenFirstSentAt.delete(clientRequestToken);
40091
40347
  return {
@@ -40107,13 +40363,9 @@ var FSxFileSystemProvider = class {
40107
40363
  throw error;
40108
40364
  }
40109
40365
  const cause = error instanceof Error ? error : void 0;
40110
- const message = `Failed to create FSx FileSystem ${logicalId}: ${describeAwsFailure(error).detail}`;
40111
- if (survivorId !== void 0) {
40112
- const thrown = new ProvisioningError(message, resourceType, logicalId, void 0, cause);
40113
- markCreatedBeforeFailure(thrown, logicalId, resourceType, survivorId);
40114
- throw thrown;
40115
- }
40116
- throw new ProvisioningError(message, resourceType, logicalId, void 0, cause);
40366
+ const thrown = this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to create FSx FileSystem ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
40367
+ if (survivorId !== void 0) markCreatedBeforeFailure(thrown, logicalId, resourceType, survivorId);
40368
+ throw thrown;
40117
40369
  }
40118
40370
  }
40119
40371
  toCreateLustreConfiguration(config) {
@@ -40325,7 +40577,7 @@ var FSxFileSystemProvider = class {
40325
40577
  }))).FileSystem?.AdministrativeActions ?? []).filter((a) => a.AdministrativeActionType === "FILE_SYSTEM_UPDATE" && (a.Status === "PENDING" || a.Status === "IN_PROGRESS"));
40326
40578
  const requestTimes = respPendingActions.map((a) => a.RequestTime?.getTime()).filter((t) => t !== void 0);
40327
40579
  const actionThresholdMs = requestTimes.length > 0 ? Math.min(...requestTimes) : callTimeMs - 6e4;
40328
- updatedFs = await this.waitForUpdateActionComplete(physicalId, logicalId, resourceType, actionThresholdMs, respPendingActions.length > 0);
40580
+ updatedFs = await this.waitForUpdateActionComplete(physicalId, logicalId, resourceType, actionThresholdMs, respPendingActions.length > 0, context?.maskSecrets);
40329
40581
  }
40330
40582
  if (tagsChanged) await this.applyTagDiff(physicalId, resourceType, logicalId, properties["Tags"], previousProperties["Tags"]);
40331
40583
  if (!updatedFs) try {
@@ -40343,7 +40595,7 @@ var FSxFileSystemProvider = class {
40343
40595
  } catch (error) {
40344
40596
  if (error instanceof ProvisioningError) throw error;
40345
40597
  const cause = error instanceof Error ? error : void 0;
40346
- throw new ProvisioningError(`Failed to update FSx FileSystem ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
40598
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to update FSx FileSystem ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
40347
40599
  }
40348
40600
  }
40349
40601
  detectVariantConfigKey(properties, previousProperties) {
@@ -40536,9 +40788,9 @@ var FSxFileSystemProvider = class {
40536
40788
  return;
40537
40789
  }
40538
40790
  const cause = error instanceof Error ? error : void 0;
40539
- throw new ProvisioningError(`Failed to delete FSx FileSystem ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
40791
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to delete FSx FileSystem ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
40540
40792
  }
40541
- await this.waitForFileSystemDeleted(physicalId, logicalId, resourceType);
40793
+ await this.waitForFileSystemDeleted(physicalId, logicalId, resourceType, context?.maskSecrets);
40542
40794
  this.logger.debug(`Successfully deleted FSx FileSystem ${logicalId}`);
40543
40795
  }
40544
40796
  async isSameResource(journaledPhysicalId, record, resourceType, context) {
@@ -40581,23 +40833,20 @@ var FSxFileSystemProvider = class {
40581
40833
  throw error;
40582
40834
  }
40583
40835
  }
40584
- async waitForFileSystemAvailable(fileSystemId, logicalId, resourceType) {
40836
+ async waitForFileSystemAvailable(fileSystemId, logicalId, resourceType, mask) {
40585
40837
  const startTime = Date.now();
40586
40838
  const transientState = { count: 0 };
40587
40839
  while (Date.now() - startTime < this.maxWaitMs) {
40588
40840
  const fs = await this.describeForPoll(fileSystemId, transientState);
40589
40841
  const lifecycle = fs?.Lifecycle;
40590
40842
  if (fs && lifecycle === "AVAILABLE") return fs;
40591
- if (lifecycle === "FAILED" || lifecycle === "MISCONFIGURED") {
40592
- const detail = fs?.FailureDetails?.Message ?? "no failure details reported";
40593
- throw new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state ${lifecycle}: ${detail}`, resourceType, logicalId, fileSystemId);
40594
- }
40843
+ if (lifecycle === "FAILED" || lifecycle === "MISCONFIGURED") throw this.wrapStatusReasonError(mask, fs?.FailureDetails?.Message, (text, cause) => new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state ${lifecycle}: ${text}`, resourceType, logicalId, fileSystemId, cause));
40595
40844
  this.logger.debug(`FSx FileSystem ${fileSystemId} state: ${lifecycle ?? "unknown"}, waiting...`);
40596
40845
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
40597
40846
  }
40598
40847
  throw new ProvisioningError(`Timed out waiting for FSx FileSystem ${fileSystemId} to become AVAILABLE (${Math.round(this.maxWaitMs / 6e4)} min)`, resourceType, logicalId, fileSystemId);
40599
40848
  }
40600
- async waitForUpdateActionComplete(fileSystemId, logicalId, resourceType, actionThresholdMs, requireActionObservation) {
40849
+ async waitForUpdateActionComplete(fileSystemId, logicalId, resourceType, actionThresholdMs, requireActionObservation, mask) {
40601
40850
  const startTime = Date.now();
40602
40851
  const transientState = { count: 0 };
40603
40852
  let seenTrackedAction = false;
@@ -40607,10 +40856,7 @@ var FSxFileSystemProvider = class {
40607
40856
  const updateActions = (fs.AdministrativeActions ?? []).filter((a) => a.AdministrativeActionType === "FILE_SYSTEM_UPDATE" && (a.RequestTime === void 0 || a.RequestTime.getTime() >= actionThresholdMs));
40608
40857
  if (updateActions.length > 0) seenTrackedAction = true;
40609
40858
  const failed = updateActions.find((a) => a.Status === "FAILED");
40610
- if (failed) {
40611
- const detail = failed.FailureDetails?.Message ?? "no failure details reported";
40612
- throw new ProvisioningError(`FSx FileSystem ${fileSystemId} update failed (FILE_SYSTEM_UPDATE administrative action): ${detail}`, resourceType, logicalId, fileSystemId);
40613
- }
40859
+ if (failed) throw this.wrapStatusReasonError(mask, failed.FailureDetails?.Message, (text, cause) => new ProvisioningError(`FSx FileSystem ${fileSystemId} update failed (FILE_SYSTEM_UPDATE administrative action): ${text}`, resourceType, logicalId, fileSystemId, cause));
40614
40860
  if (!updateActions.some((a) => a.Status === "PENDING" || a.Status === "IN_PROGRESS") && (!requireActionObservation || seenTrackedAction) && fs.Lifecycle === "AVAILABLE") return fs;
40615
40861
  this.logger.debug(`FSx FileSystem ${fileSystemId} update in progress (lifecycle: ${fs.Lifecycle ?? "unknown"}), waiting...`);
40616
40862
  }
@@ -40618,7 +40864,7 @@ var FSxFileSystemProvider = class {
40618
40864
  }
40619
40865
  throw new ProvisioningError(`Timed out waiting for FSx FileSystem ${fileSystemId} update to complete (${Math.round(this.maxWaitMs / 6e4)} min)`, resourceType, logicalId, fileSystemId);
40620
40866
  }
40621
- async waitForFileSystemDeleted(fileSystemId, logicalId, resourceType) {
40867
+ async waitForFileSystemDeleted(fileSystemId, logicalId, resourceType, mask) {
40622
40868
  const startTime = Date.now();
40623
40869
  const transientState = { count: 0 };
40624
40870
  while (Date.now() - startTime < this.maxWaitMs) {
@@ -40630,17 +40876,14 @@ var FSxFileSystemProvider = class {
40630
40876
  } catch (error) {
40631
40877
  if (error instanceof FileSystemNotFound$1) return;
40632
40878
  const cause = error instanceof Error ? error : void 0;
40633
- throw new ProvisioningError(`Failed to poll FSx FileSystem ${fileSystemId} deletion: ${describeAwsFailure(error).detail}`, resourceType, logicalId, fileSystemId, cause);
40879
+ throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to poll FSx FileSystem ${fileSystemId} deletion: ${text}`, resourceType, logicalId, fileSystemId, cause));
40634
40880
  }
40635
40881
  if (!fs && sawResponse) return;
40636
40882
  if (!fs) {
40637
40883
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
40638
40884
  continue;
40639
40885
  }
40640
- if (fs.Lifecycle === "FAILED") {
40641
- const detail = fs.FailureDetails?.Message ?? "no failure details reported";
40642
- throw new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state FAILED during deletion: ${detail}`, resourceType, logicalId, fileSystemId);
40643
- }
40886
+ if (fs.Lifecycle === "FAILED") throw this.wrapStatusReasonError(mask, fs.FailureDetails?.Message, (text, cause) => new ProvisioningError(`FSx FileSystem ${fileSystemId} entered lifecycle state FAILED during deletion: ${text}`, resourceType, logicalId, fileSystemId, cause));
40644
40887
  this.logger.debug(`FSx FileSystem ${fileSystemId} state: ${fs.Lifecycle ?? "unknown"}, waiting for deletion...`);
40645
40888
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
40646
40889
  }
@@ -40976,6 +41219,21 @@ var EMRClusterProvider = class {
40976
41219
  this.pollIntervalMs = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS$2;
40977
41220
  this.maxWaitMs = options?.maxWaitMs ?? DEFAULT_MAX_WAIT_MS$2;
40978
41221
  }
41222
+ wrapStatusReasonError(mask, reason, fallback, build) {
41223
+ const text = describeAwsStatusReason(reason, fallback);
41224
+ if (!text.redacted) return build(text.detail, void 0);
41225
+ const m = maskerOrIdentity(mask);
41226
+ const cause = new Error(text.detail);
41227
+ this.logger.debug(m(build(m(text.detail), cause).message));
41228
+ return markRedactedCause(build(m(text.summary), cause));
41229
+ }
41230
+ wrapCaughtError(mask, error, build) {
41231
+ const failure = describeAwsFailure(error);
41232
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
41233
+ const m = maskerOrIdentity(mask);
41234
+ this.logger.debug(m(build(m(failure.detail)).message));
41235
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
41236
+ }
40979
41237
  handledProperties = /* @__PURE__ */ new Map([["AWS::EMR::Cluster", /* @__PURE__ */ new Set([
40980
41238
  "AdditionalInfo",
40981
41239
  "Applications",
@@ -41113,7 +41371,7 @@ var EMRClusterProvider = class {
41113
41371
  const replayWindow = replayedSendWindow(response, attemptStartMs);
41114
41372
  if (replayWindow !== void 0) await reportOrphans(replayWindow);
41115
41373
  if (!clusterId) throw new ProvisioningError(`EMR RunJobFlow for ${logicalId} returned no JobFlowId`, resourceType, logicalId);
41116
- const cluster = await this.waitForClusterReady(clusterId, logicalId, resourceType);
41374
+ const cluster = await this.waitForClusterReady(clusterId, logicalId, resourceType, context?.maskSecrets);
41117
41375
  this.logger.debug(`Successfully created EMR Cluster ${logicalId}: ${clusterId}`);
41118
41376
  return {
41119
41377
  physicalId: clusterId,
@@ -41140,14 +41398,12 @@ var EMRClusterProvider = class {
41140
41398
  throw error;
41141
41399
  }
41142
41400
  const cause = error instanceof Error ? error : void 0;
41143
- const message = `Failed to create EMR Cluster ${logicalId}: ${describeAwsFailure(error).detail}`;
41401
+ const thrown = this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to create EMR Cluster ${logicalId}: ${text}`, resourceType, logicalId, void 0, cause));
41144
41402
  if (survivorId !== void 0) {
41145
- const thrown = new ProvisioningError(message, resourceType, logicalId, void 0, cause);
41146
41403
  markCreatedBeforeFailure(thrown, logicalId, resourceType, survivorId);
41147
41404
  markNonRetryable(thrown);
41148
- throw thrown;
41149
41405
  }
41150
- throw new ProvisioningError(message, resourceType, logicalId, void 0, cause);
41406
+ throw thrown;
41151
41407
  }
41152
41408
  }
41153
41409
  toJobFlowInstancesConfig(config) {
@@ -41338,7 +41594,7 @@ var EMRClusterProvider = class {
41338
41594
  } catch (error) {
41339
41595
  if (error instanceof ProvisioningError) throw error;
41340
41596
  const cause = error instanceof Error ? error : void 0;
41341
- throw new ProvisioningError(`Failed to update EMR Cluster ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
41597
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to update EMR Cluster ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
41342
41598
  }
41343
41599
  }
41344
41600
  async applyTagDiff(physicalId, resourceType, logicalId, prevTagsRaw, nextTagsRaw) {
@@ -41392,7 +41648,7 @@ var EMRClusterProvider = class {
41392
41648
  return;
41393
41649
  }
41394
41650
  const cause = error instanceof Error ? error : void 0;
41395
- throw new ProvisioningError(`Failed to describe EMR Cluster ${logicalId} before deletion: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
41651
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to describe EMR Cluster ${logicalId} before deletion: ${text}`, resourceType, logicalId, physicalId, cause));
41396
41652
  }
41397
41653
  const currentState = current?.Status?.State;
41398
41654
  if (currentState && TERMINAL_STATES.has(currentState)) {
@@ -41421,9 +41677,9 @@ var EMRClusterProvider = class {
41421
41677
  flip.deleteAccepted = true;
41422
41678
  } catch (error) {
41423
41679
  const cause = error instanceof Error ? error : void 0;
41424
- throw new ProvisioningError(`Failed to terminate EMR Cluster ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
41680
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to terminate EMR Cluster ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
41425
41681
  }
41426
- await this.waitForClusterTerminated(physicalId, logicalId, resourceType);
41682
+ await this.waitForClusterTerminated(physicalId, logicalId, resourceType, context?.maskSecrets);
41427
41683
  this.logger.debug(`Successfully deleted EMR Cluster ${logicalId}`);
41428
41684
  }
41429
41685
  async describeForPoll(clusterId, transientState, maxConsecutiveTransient = 5) {
@@ -41442,7 +41698,7 @@ var EMRClusterProvider = class {
41442
41698
  throw error;
41443
41699
  }
41444
41700
  }
41445
- async waitForClusterReady(clusterId, logicalId, resourceType) {
41701
+ async waitForClusterReady(clusterId, logicalId, resourceType, mask) {
41446
41702
  const startTime = Date.now();
41447
41703
  const transientState = { count: 0 };
41448
41704
  while (Date.now() - startTime < this.maxWaitMs) {
@@ -41450,15 +41706,18 @@ var EMRClusterProvider = class {
41450
41706
  const state = cluster?.Status?.State;
41451
41707
  if (cluster && state && CREATE_READY_STATES.has(state)) return cluster;
41452
41708
  if (state && TERMINAL_STATES.has(state)) {
41453
- const reason = cluster?.Status?.StateChangeReason?.Message ?? "no state-change reason reported";
41454
- throw new ProvisioningError(`EMR Cluster ${clusterId} entered terminal state ${state} during creation: ${reason}`, resourceType, logicalId, clusterId);
41709
+ const reason = cluster?.Status?.StateChangeReason;
41710
+ throw this.wrapStatusReasonError(mask, {
41711
+ code: reason?.Code,
41712
+ message: reason?.Message
41713
+ }, "no state-change reason reported", (text, cause) => new ProvisioningError(`EMR Cluster ${clusterId} entered terminal state ${state} during creation: ${text}`, resourceType, logicalId, clusterId, cause));
41455
41714
  }
41456
41715
  this.logger.debug(`EMR Cluster ${clusterId} state: ${state ?? "unknown"}, waiting...`);
41457
41716
  await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
41458
41717
  }
41459
41718
  throw new ProvisioningError(`Timed out waiting for EMR Cluster ${clusterId} to reach WAITING/RUNNING (${Math.round(this.maxWaitMs / 6e4)} min)`, resourceType, logicalId, clusterId);
41460
41719
  }
41461
- async waitForClusterTerminated(clusterId, logicalId, resourceType) {
41720
+ async waitForClusterTerminated(clusterId, logicalId, resourceType, mask) {
41462
41721
  const startTime = Date.now();
41463
41722
  const transientState = { count: 0 };
41464
41723
  while (Date.now() - startTime < this.maxWaitMs) {
@@ -41468,7 +41727,7 @@ var EMRClusterProvider = class {
41468
41727
  } catch (error) {
41469
41728
  if (error instanceof InvalidRequestException) return;
41470
41729
  const cause = error instanceof Error ? error : void 0;
41471
- throw new ProvisioningError(`Failed to poll EMR Cluster ${clusterId} termination: ${describeAwsFailure(error).detail}`, resourceType, logicalId, clusterId, cause);
41730
+ throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to poll EMR Cluster ${clusterId} termination: ${text}`, resourceType, logicalId, clusterId, cause));
41472
41731
  }
41473
41732
  const state = cluster?.Status?.State;
41474
41733
  if (state && TERMINAL_STATES.has(state)) {
@@ -41719,6 +41978,21 @@ var EMRInstanceGroupConfigProvider = class {
41719
41978
  this.pollIntervalMs = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS$1;
41720
41979
  this.maxWaitMs = options?.maxWaitMs ?? DEFAULT_MAX_WAIT_MS$1;
41721
41980
  }
41981
+ wrapStatusReasonError(mask, reason, fallback, build) {
41982
+ const text = describeAwsStatusReason(reason, fallback);
41983
+ if (!text.redacted) return build(text.detail, void 0);
41984
+ const m = maskerOrIdentity(mask);
41985
+ const cause = new Error(text.detail);
41986
+ this.logger.debug(m(build(m(text.detail), cause).message));
41987
+ return markRedactedCause(build(m(text.summary), cause));
41988
+ }
41989
+ wrapCaughtError(mask, error, build) {
41990
+ const failure = describeAwsFailure(error);
41991
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
41992
+ const m = maskerOrIdentity(mask);
41993
+ this.logger.debug(m(build(m(failure.detail)).message));
41994
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
41995
+ }
41722
41996
  handledProperties = /* @__PURE__ */ new Map([["AWS::EMR::InstanceGroupConfig", /* @__PURE__ */ new Set([
41723
41997
  "AutoScalingPolicy",
41724
41998
  "BidPrice",
@@ -41802,7 +42076,7 @@ var EMRInstanceGroupConfigProvider = class {
41802
42076
  const replayWindow = replayedSendWindow(response, attemptStartMs);
41803
42077
  if (replayWindow !== void 0 && group.InstanceRole === "TASK") await reportOrphans(replayWindow);
41804
42078
  if (!groupId) throw new ProvisioningError(`EMR AddInstanceGroups for ${logicalId} returned no instance group id`, resourceType, logicalId);
41805
- await this.waitForGroupReady(jobFlowId, groupId, logicalId, resourceType, toNumber$1(properties["InstanceCount"]) ?? 0);
42079
+ await this.waitForGroupReady(jobFlowId, groupId, logicalId, resourceType, toNumber$1(properties["InstanceCount"]) ?? 0, false, context?.maskSecrets);
41806
42080
  this.logger.debug(`Successfully added EMR instance group ${logicalId}: ${groupId}`);
41807
42081
  return {
41808
42082
  physicalId: groupId,
@@ -41812,7 +42086,7 @@ var EMRInstanceGroupConfigProvider = class {
41812
42086
  }
41813
42087
  };
41814
42088
  } catch (error) {
41815
- const thrown = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to add EMR instance group ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0);
42089
+ const thrown = error instanceof ProvisioningError ? error : this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to add EMR instance group ${logicalId}: ${text}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
41816
42090
  let leftBehindGroupId = createdGroupId;
41817
42091
  if (leftBehindGroupId && properties["InstanceRole"] === "TASK") {
41818
42092
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
@@ -41891,7 +42165,7 @@ var EMRInstanceGroupConfigProvider = class {
41891
42165
  InstanceCount: toNumber$1(properties["InstanceCount"]) ?? 0
41892
42166
  }]
41893
42167
  }));
41894
- if (jobFlowId) await this.waitForGroupReady(jobFlowId, physicalId, logicalId, resourceType, toNumber$1(properties["InstanceCount"]) ?? 0, true);
42168
+ if (jobFlowId) await this.waitForGroupReady(jobFlowId, physicalId, logicalId, resourceType, toNumber$1(properties["InstanceCount"]) ?? 0, true, context?.maskSecrets);
41895
42169
  }
41896
42170
  if (autoScalingChanged) {
41897
42171
  if (!jobFlowId) throw new ProvisioningError(`EMR InstanceGroupConfig ${logicalId} AutoScalingPolicy update needs JobFlowId (the cluster id), which is absent`, resourceType, logicalId, physicalId);
@@ -41918,7 +42192,7 @@ var EMRInstanceGroupConfigProvider = class {
41918
42192
  } catch (error) {
41919
42193
  if (error instanceof ProvisioningError || error instanceof ResourceUpdateNotSupportedError) throw error;
41920
42194
  const cause = error instanceof Error ? error : void 0;
41921
- throw new ProvisioningError(`Failed to update EMR instance group ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
42195
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to update EMR instance group ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
41922
42196
  }
41923
42197
  }
41924
42198
  async delete(logicalId, physicalId, resourceType, properties, context) {
@@ -41949,7 +42223,7 @@ var EMRInstanceGroupConfigProvider = class {
41949
42223
  async getAttribute(physicalId, _resourceType, attributeName) {
41950
42224
  if (attributeName === "Id" || attributeName === "InstanceGroupId") return physicalId;
41951
42225
  }
41952
- async waitForGroupReady(clusterId, groupId, logicalId, resourceType, expectedCount, toleratesStaleFailedState = false) {
42226
+ async waitForGroupReady(clusterId, groupId, logicalId, resourceType, expectedCount, toleratesStaleFailedState = false, mask) {
41953
42227
  const startTime = Date.now();
41954
42228
  const transientState = { count: 0 };
41955
42229
  let initialState;
@@ -41964,8 +42238,11 @@ var EMRInstanceGroupConfigProvider = class {
41964
42238
  if (state && READY_STATES$1.has(state) && group?.RunningInstanceCount === expectedCount) return;
41965
42239
  const enforceFailedStates = !toleratesStaleFailedState || hasLeftInitialState;
41966
42240
  if (state && enforceFailedStates && FAILED_STATES$1.has(state)) {
41967
- const reason = group?.Status?.StateChangeReason?.Message ?? "no state-change reason reported";
41968
- throw new ProvisioningError(`EMR instance group ${groupId} entered failed state ${state}: ${reason}`, resourceType, logicalId, groupId);
42241
+ const reason = group?.Status?.StateChangeReason;
42242
+ throw this.wrapStatusReasonError(mask, {
42243
+ code: reason?.Code,
42244
+ message: reason?.Message
42245
+ }, "no state-change reason reported", (text, cause) => new ProvisioningError(`EMR instance group ${groupId} entered failed state ${state}: ${text}`, resourceType, logicalId, groupId, cause));
41969
42246
  }
41970
42247
  if (state && !enforceFailedStates && FAILED_STATES$1.has(state)) this.logger.debug(`EMR instance group ${groupId} still reads ${state} from before the resize; waiting for it to leave that state before treating it as failed`);
41971
42248
  this.logger.debug(`EMR instance group ${groupId} state: ${state ?? "unknown"}, running ${group?.RunningInstanceCount ?? "?"}/${expectedCount}, waiting...`);
@@ -42036,6 +42313,21 @@ var EMRInstanceFleetConfigProvider = class {
42036
42313
  this.pollIntervalMs = options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
42037
42314
  this.maxWaitMs = options?.maxWaitMs ?? DEFAULT_MAX_WAIT_MS;
42038
42315
  }
42316
+ wrapStatusReasonError(mask, reason, fallback, build) {
42317
+ const text = describeAwsStatusReason(reason, fallback);
42318
+ if (!text.redacted) return build(text.detail, void 0);
42319
+ const m = maskerOrIdentity(mask);
42320
+ const cause = new Error(text.detail);
42321
+ this.logger.debug(m(build(m(text.detail), cause).message));
42322
+ return markRedactedCause(build(m(text.summary), cause));
42323
+ }
42324
+ wrapCaughtError(mask, error, build) {
42325
+ const failure = describeAwsFailure(error);
42326
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
42327
+ const m = maskerOrIdentity(mask);
42328
+ this.logger.debug(m(build(m(failure.detail)).message));
42329
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
42330
+ }
42039
42331
  handledProperties = /* @__PURE__ */ new Map([["AWS::EMR::InstanceFleetConfig", /* @__PURE__ */ new Set([
42040
42332
  "ClusterId",
42041
42333
  "InstanceFleetType",
@@ -42128,7 +42420,7 @@ var EMRInstanceFleetConfigProvider = class {
42128
42420
  await this.waitForFleetReady(clusterId, fleetId, logicalId, resourceType, this.targetCapacities(properties), {
42129
42421
  onDemand: 0,
42130
42422
  spot: 0
42131
- });
42423
+ }, false, context?.maskSecrets);
42132
42424
  this.logger.debug(`Successfully added EMR instance fleet ${logicalId}: ${fleetId}`);
42133
42425
  return {
42134
42426
  physicalId: fleetId,
@@ -42138,7 +42430,7 @@ var EMRInstanceFleetConfigProvider = class {
42138
42430
  }
42139
42431
  };
42140
42432
  } catch (error) {
42141
- const thrown = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to add EMR instance fleet ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0);
42433
+ const thrown = error instanceof ProvisioningError ? error : this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to add EMR instance fleet ${logicalId}: ${text}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
42142
42434
  if (createdFleetId) {
42143
42435
  markCreatedBeforeFailure(thrown, logicalId, resourceType, createdFleetId);
42144
42436
  markNonRetryable(thrown);
@@ -42212,7 +42504,7 @@ var EMRInstanceFleetConfigProvider = class {
42212
42504
  ClusterId: clusterId,
42213
42505
  InstanceFleet: modify
42214
42506
  }));
42215
- await this.waitForFleetReady(clusterId, physicalId, logicalId, resourceType, this.targetCapacities(properties), this.targetCapacities(previousProperties), true);
42507
+ await this.waitForFleetReady(clusterId, physicalId, logicalId, resourceType, this.targetCapacities(properties), this.targetCapacities(previousProperties), true, context?.maskSecrets);
42216
42508
  this.logger.debug(`Successfully updated EMR instance fleet ${logicalId}`);
42217
42509
  warnLeftInPlace();
42218
42510
  return {
@@ -42226,7 +42518,7 @@ var EMRInstanceFleetConfigProvider = class {
42226
42518
  } catch (error) {
42227
42519
  if (error instanceof ProvisioningError || error instanceof ResourceUpdateNotSupportedError) throw error;
42228
42520
  const cause = error instanceof Error ? error : void 0;
42229
- throw new ProvisioningError(`Failed to update EMR instance fleet ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
42521
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to update EMR instance fleet ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
42230
42522
  }
42231
42523
  }
42232
42524
  async delete(logicalId, physicalId, resourceType, properties, context) {
@@ -42264,7 +42556,7 @@ var EMRInstanceFleetConfigProvider = class {
42264
42556
  spot: toNumber(properties["TargetSpotCapacity"]) ?? 0
42265
42557
  };
42266
42558
  }
42267
- async waitForFleetReady(clusterId, fleetId, logicalId, resourceType, target, previous, toleratesStaleFailedState = false) {
42559
+ async waitForFleetReady(clusterId, fleetId, logicalId, resourceType, target, previous, toleratesStaleFailedState = false, mask) {
42268
42560
  const startTime = Date.now();
42269
42561
  const transientState = { count: 0 };
42270
42562
  let initialState;
@@ -42284,8 +42576,11 @@ var EMRInstanceFleetConfigProvider = class {
42284
42576
  if (state && READY_STATES.has(state) && capacityReady) return;
42285
42577
  const enforceFailedStates = !toleratesStaleFailedState || hasLeftInitialState;
42286
42578
  if (state && enforceFailedStates && FAILED_STATES.has(state)) {
42287
- const reason = fleet?.Status?.StateChangeReason?.Message ?? "no state-change reason reported";
42288
- throw new ProvisioningError(`EMR instance fleet ${fleetId} entered failed state ${state}: ${reason}`, resourceType, logicalId, fleetId);
42579
+ const reason = fleet?.Status?.StateChangeReason;
42580
+ throw this.wrapStatusReasonError(mask, {
42581
+ code: reason?.Code,
42582
+ message: reason?.Message
42583
+ }, "no state-change reason reported", (text, cause) => new ProvisioningError(`EMR instance fleet ${fleetId} entered failed state ${state}: ${text}`, resourceType, logicalId, fleetId, cause));
42289
42584
  }
42290
42585
  if (state && !enforceFailedStates && FAILED_STATES.has(state)) this.logger.debug(`EMR instance fleet ${fleetId} still reads ${state} from before the resize; waiting for it to leave that state before treating it as failed`);
42291
42586
  this.logger.debug(`EMR instance fleet ${fleetId} state: ${state ?? "unknown"}, provisioned ${onDemand}/${target.onDemand} on-demand + ${spot}/${target.spot} spot (${provisioned} total), waiting...`);
@@ -46666,6 +46961,13 @@ var ACMCertificateProvider = class {
46666
46961
  logger = getLogger().child("ACMCertificateProvider");
46667
46962
  maxPollAttempts = Number(process.env["CDKD_ACM_POLL_ATTEMPTS"] ?? 60);
46668
46963
  pollIntervalMs = Number(process.env["CDKD_ACM_POLL_INTERVAL_MS"] ?? 1e4);
46964
+ wrapCaughtError(mask, error, build) {
46965
+ const failure = describeAwsFailure(error);
46966
+ if (!(error instanceof Error) || !failure.redacted) return build(failure.detail);
46967
+ const m = mask ?? ((text) => text);
46968
+ this.logger.debug(m(build(m(failure.detail)).message));
46969
+ return markRedactedCause(build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`));
46970
+ }
46669
46971
  constructor() {
46670
46972
  this.acmClient = getAwsClients().acm;
46671
46973
  }
@@ -46691,7 +46993,7 @@ var ACMCertificateProvider = class {
46691
46993
  "KeyAlgorithm",
46692
46994
  "Tags"
46693
46995
  ])]]);
46694
- async create(logicalId, resourceType, properties) {
46996
+ async create(logicalId, resourceType, properties, context) {
46695
46997
  this.logger.debug(`Requesting ACM certificate ${logicalId}`);
46696
46998
  const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
46697
46999
  const domainName = properties["DomainName"];
@@ -46743,14 +47045,11 @@ var ACMCertificateProvider = class {
46743
47045
  throw thrown;
46744
47046
  }
46745
47047
  const cause = error instanceof Error ? error : void 0;
46746
- const detail = describeAwsFailure(error).detail;
46747
- const message = `Failed to create ACM certificate ${logicalIdShown(logicalId)}: ${detail}`;
46748
- if (requestedArn && survivorNote !== void 0) {
46749
- const thrown = new ProvisioningError(`${message} ${survivorNote}`, resourceType, logicalId, requestedArn, cause);
46750
- markCreatedBeforeFailure(thrown, logicalId, resourceType, requestedArn);
46751
- throw thrown;
46752
- }
46753
- throw new ProvisioningError(message, resourceType, logicalId, requestedArn, cause);
47048
+ const build = (text) => new ProvisioningError(`Failed to create ACM certificate ${logicalIdShown(logicalId)}: ` + (survivorNote !== void 0 ? `${text} ${survivorNote}` : text), resourceType, logicalId, requestedArn, cause);
47049
+ if (!requestedArn || survivorNote === void 0) throw this.wrapCaughtError(context?.maskSecrets, error, build);
47050
+ const thrown = this.wrapCaughtError(context?.maskSecrets, error, build);
47051
+ markCreatedBeforeFailure(thrown, logicalId, resourceType, requestedArn);
47052
+ throw thrown;
46754
47053
  }
46755
47054
  }
46756
47055
  regionOfArn(arn) {
@@ -46802,7 +47101,7 @@ var ACMCertificateProvider = class {
46802
47101
  }
46803
47102
  if (changedImmutable) {
46804
47103
  this.logger.debug(`${changedImmutable} changed, replacing ACM certificate: ${physicalId}`);
46805
- const createResult = await this.create(logicalId, resourceType, properties);
47104
+ const createResult = await this.create(logicalId, resourceType, properties, context?.maskSecrets ? { maskSecrets: context.maskSecrets } : void 0);
46806
47105
  let orphanReason;
46807
47106
  let oldResourceSurvivor = "unconfirmed";
46808
47107
  try {
@@ -46851,7 +47150,7 @@ var ACMCertificateProvider = class {
46851
47150
  };
46852
47151
  } catch (error) {
46853
47152
  const cause = error instanceof Error ? error : void 0;
46854
- throw new ProvisioningError(`Failed to update ACM certificate ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
47153
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to update ACM certificate ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
46855
47154
  }
46856
47155
  }
46857
47156
  async delete(logicalId, physicalId, resourceType, _properties, context) {
@@ -46871,7 +47170,7 @@ var ACMCertificateProvider = class {
46871
47170
  this.logger.debug(`Successfully deleted ACM certificate ${logicalId}`);
46872
47171
  } catch (error) {
46873
47172
  const cause = error instanceof Error ? error : void 0;
46874
- throw new ProvisioningError(`Failed to delete ACM certificate ${logicalId}: ${describeAwsFailure(error).detail}`, resourceType, logicalId, physicalId, cause);
47173
+ throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to delete ACM certificate ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
46875
47174
  }
46876
47175
  }
46877
47176
  async getAttribute(physicalId, _resourceType, attributeName) {
@@ -46993,4 +47292,4 @@ var ACMCertificateProvider = class {
46993
47292
 
46994
47293
  //#endregion
46995
47294
  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 };
46996
- //# sourceMappingURL=provider-classes-BUvql6rX.js.map
47295
+ //# sourceMappingURL=provider-classes-CBbWGsK0.js.map