@go-to-k/cdkd 0.296.11 → 0.296.13

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 (31) hide show
  1. package/dist/{asg-provider-HvY_p4Yc.js → asg-provider-DeeIdM5B.js} +20 -9
  2. package/dist/asg-provider-DeeIdM5B.js.map +1 -0
  3. package/dist/cli.js +2 -2
  4. package/dist/{deploy-engine-aXeTL7rk.js → deploy-engine-FDsHckZR.js} +6781 -5372
  5. package/dist/deploy-engine-FDsHckZR.js.map +1 -0
  6. package/dist/{iam-policy-targets-BREzwsG6.js → iam-policy-targets-elNafvpb.js} +116 -10
  7. package/dist/iam-policy-targets-elNafvpb.js.map +1 -0
  8. package/dist/{iam-role-provider-B8gFSZcy.js → iam-role-provider-BuWI_oJp.js} +5 -93
  9. package/dist/iam-role-provider-BuWI_oJp.js.map +1 -0
  10. package/dist/index.d.ts +22 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -3
  13. package/dist/{neptune-provider-xf0xgelu.js → neptune-provider-Bdc1YYxL.js} +21 -10
  14. package/dist/neptune-provider-Bdc1YYxL.js.map +1 -0
  15. package/dist/{program-w_06Pj_g.js → program-1S4fU3m4.js} +387 -60
  16. package/dist/program-1S4fU3m4.js.map +1 -0
  17. package/dist/{provider-classes-4lVceW9g.js → provider-classes-hW6X0dKh.js} +506 -88
  18. package/dist/provider-classes-hW6X0dKh.js.map +1 -0
  19. package/dist/{rds-provider-CUN4EuIb.js → rds-provider-Q1U7N7ee.js} +80 -14
  20. package/dist/rds-provider-Q1U7N7ee.js.map +1 -0
  21. package/dist/{version-BJ10lRpQ.js → version-B9EuX7Oh.js} +2 -2
  22. package/dist/{version-BJ10lRpQ.js.map → version-B9EuX7Oh.js.map} +1 -1
  23. package/package.json +1 -1
  24. package/dist/asg-provider-HvY_p4Yc.js.map +0 -1
  25. package/dist/deploy-engine-aXeTL7rk.js.map +0 -1
  26. package/dist/iam-policy-targets-BREzwsG6.js.map +0 -1
  27. package/dist/iam-role-provider-B8gFSZcy.js.map +0 -1
  28. package/dist/neptune-provider-xf0xgelu.js.map +0 -1
  29. package/dist/program-w_06Pj_g.js.map +0 -1
  30. package/dist/provider-classes-4lVceW9g.js.map +0 -1
  31. package/dist/rds-provider-CUN4EuIb.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { r as getAwsClients } from "./aws-clients-CnmtbrxD.js";
2
2
  import { A as displayIdent, F as plainIdentOr, I as safeMsg, M as displayStackName, N as isPasteableIdent, T as SECRET_REF_MAX_CODE_POINTS, _ as generateResourceNameWithFallback, g as generateResourceName, j as displaySafe, n as getLogger } from "./logger-DAaB7GFO.js";
3
- import { $ as compositeIdFormatMessage, $n as markRedactedCause, A as isTerminalDeleteFailure, B as WITHHELD_AWS_COMMAND, Bt as clientDefaultsFor, C as refusalTypeShown, D as ProtectionFlipRegistry, Dn as shellQuote, H as pasteableAwsCommand, Ht as AccountIdUnavailableError, J as isInterruptedWaitError, Jn as safeStringify, Kn as describeAwsFailure, L as userPoolProtectionSite, Ln as markNameCollision, Lt as withPasteableAwsProfile, M as observeThenDisableProtection, Mt as injectiveKey, N as protectionFlipKey, Nt as injectiveKeyPrefix, On as withheldTargetClause, P as rdsFamilyProtectionSite, Q as canonicalizeRoute53QueryName, Qn as markNonRetryable, Rn as markReplayMayCollide, Rt as ambientClientDefaults, S as quotedRemedyLogicalId, Sn as pasteableCommand, T as resolveExplicitPhysicalId, U as protectedReplacementAdvice, Un as isRetryableTransientError, V as isAwsCliLiteral, Vn as isAmbiguousOutcomeError, Vt as credentialFingerprint, W as renderDisableCommand, Wn as isTransientServerError, Wt as CdkdError, X as ElapsedBudgetRegistry, Xn as isMarkedNonRetryable, Y as startInterruptWatch, Yn as THROTTLING_ERROR_NAMES, Zn as isThrottlingError, _ as VALUE_NOT_SHOWN, a as onlySecretDerived, at as segmentAfterAnchor, b as isQuotableImportValue, bn as hasClauseBreak, bt as markAuxiliaryFailure, c as recordedPrincipalsRepair, ct as createMaskedRetryLogger, dt as maskerOrIdentity, er as wrapMaskedAwsError, et as compositeIdSeparatorRefusal, ft as withDerivedNameMasks, g as assertRegionMatch, h as RESOURCE_NOT_FOUND, ht as clearCreatedBeforeFailure, i as holdsSecretDerivedEntry, in as ProvisioningError, j as logGroupProtectionSite, k as deleteWithProtectionCompensation, lt as isSecretDerivedValue, nt as logicalIdShown, o as readPrincipalLists, on as ResourceUpdateNotSupportedError, ot as stateOrphanRecordRemedy, p as withRemovalDefaults, qn as isAwsAuthoredFailure, r as SECRET_DERIVED_READ_LIVE, rt as packCompositeId, st as createMaskedLogSinks, tt as compositeIdSkipResult, u as clearOnUpdateRemoval, ut as maskDeep, v as isPlainImportJson, w as remedyLogicalId, wn as plainOrDescribed, x as normalizeAwsTagsToCfn, xn as isInertUnquoted, xt as markCreatedBeforeFailure, y as isPlainImportValue, yn as commandHole, z as UNNAMEABLE_ID_CLAUSE, zt as ambientCredentialConfig } from "./iam-policy-targets-BREzwsG6.js";
3
+ import { A as refusalTypeShown, An as pasteableCommand, B as protectionFlipKey, Bt as injectiveKey, C as assertRegionMatch, D as isQuotableImportValue, Dn as commandHole, E as isPlainImportValue, Fn as shellQuote, Gn as markNameCollision, Gt as withPasteableAwsProfile, I as deleteWithProtectionCompensation, In as withheldTargetClause, J as isAwsCliLiteral, Jt as clientDefaultsFor, K as UNNAMEABLE_ID_CLAUSE, Kn as markReplayMayCollide, Kt as ambientClientDefaults, L as isTerminalDeleteFailure, M as resolveExplicitPhysicalId, Mn as plainOrDescribed, O as normalizeAwsTagsToCfn, On as hasClauseBreak, Ot as markAuxiliaryFailure, P as ProtectionFlipRegistry, Qn as isTransientServerError, Qt as CdkdError, R as logGroupProtectionSite, S as RESOURCE_NOT_FOUND, St as clearCreatedBeforeFailure, T as isPlainImportJson, V as rdsFamilyProtectionSite, Vt as injectiveKeyPrefix, W as userPoolProtectionSite, X as protectedReplacementAdvice, Xt as AccountIdUnavailableError, Y as pasteableAwsCommand, Yn as isAmbiguousOutcomeError, Yt as credentialFingerprint, Z as renderDisableCommand, Zn as isRetryableTransientError, _ as RecentIdSet, _t as maskDeep, a as onlySecretDerived, ar as isThrottlingError, at as canonicalizeRoute53QueryName, b as setBounded, c as recordedPrincipalsRepair, cr as wrapMaskedAwsError, ct as compositeIdSkipResult, er as describeAwsFailure, fn as ProvisioningError, ft as segmentAfterAnchor, g as AmbiguousCreateLatch, gt as isSecretDerivedValue, h as AMBIGUOUS_LATCH_TTL_MS, ht as createMaskedRetryLogger, i as holdsSecretDerivedEntry, ir as isMarkedNonRetryable, j as remedyLogicalId, k as quotedRemedyLogicalId, kn as isInertUnquoted, kt as markCreatedBeforeFailure, lt as logicalIdShown, mn as ResourceUpdateNotSupportedError, mt as createMaskedLogSinks, nr as safeStringify, nt as startInterruptWatch, o as readPrincipalLists, or as markNonRetryable, ot as compositeIdFormatMessage, p as withRemovalDefaults, pt as stateOrphanRecordRemedy, q as WITHHELD_AWS_COMMAND, qt as ambientCredentialConfig, r as SECRET_DERIVED_READ_LIVE, rr as THROTTLING_ERROR_NAMES, rt as ElapsedBudgetRegistry, sr as markRedactedCause, st as compositeIdSeparatorRefusal, tr as isAwsAuthoredFailure, tt as isInterruptedWaitError, u as clearOnUpdateRemoval, ut as packCompositeId, v as createAttemptKey, vt as maskerOrIdentity, w as VALUE_NOT_SHOWN, x as withoutServerErrorRetries, y as isInsideWindow, yt as withDerivedNameMasks, z as observeThenDisableProtection } from "./iam-policy-targets-elNafvpb.js";
4
4
  import { s as ambientRegion } from "./aws-client-defaults-D0q0z4dG.js";
5
- import { $n as deleteSkipReason, $r as accountArgs, A as resolveDynamoDbDeleteBudgetClock, Aa as replayWarn, An as acquireIdempotencyToken, Ar as s3BucketWebsiteUrl, B as getPriorAttempts, Ba as sameLambdaFunctionAddress, Ca as toFiniteNumber, Ct as getStackRecords, D as beginDeleteWait, Da as configIntegerRefusal, Dr as s3BucketDomainName, E as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Ea as configBooleanRefusal, En as earliestDefined, Er as s3BucketArn, F as waitForIndexesSettled, Fn as refuseMalformedDesiredTags, Gn as getCurrentResourceSecrets, I as ECR_AUTO_DELETE_IMAGES_TAG, In as tagMapAsList, It as REDACTED_DELETE_ADDRESS_SKIP_REASON, Ji as refuseMalformedResourcesForDestroy, Jn as slowCcOperationTimeoutMs, Ka as hasMaskableValues, Ko as stringifyValue, L as S3_AUTO_DELETE_OBJECTS_TAG, La as withRetry, Ln as tagPlanWarning, Lt as isRedactedRecordedValue, M as DELETE_INDEX_WAIT_PROCEED_NOTE, Ma as requireConfigObject, Mn as DBPROXY_TAG_OPTIONS, N as INDEX_SETTLE_POLL_INTERVAL_MS, Na as requireConfigString, Nn as planTagDiff, O as compensateRemovedDeletionProtection, Oa as configStringRefusal, Oi as refuseMalformedNestedChildOutputs, On as reserveStackCreateToken, Or as s3BucketDualStackDomainName, P as deleteTableWithIndexBusyRetry, Pn as readTagList, Pr as getAccountInfo, Pt as getCurrentProducerRegions, R as hasCdkAutoDeleteTag, Ra as canonicalLambdaFunctionName, Rn as definedAttributes, Rt as redactedDeleteAddressFields, Sa as toCfnInteger, T as DynamoDBGlobalTableProvider, Ta as coerceCfnInteger, Tr as isSettledInstanceState, V as markRefusedBeforeApplying, Wr as parseWebACLArn, Xn as unchangedBehindSecretReference, Zo as rewriteTemplateAssetReferences, Zs as decodeListingKey, _t as getCurrentNestedStackContext, a as findNestedTemplateTreeDefect, ar as isTerminationProtectionPropagationError, ba as coerceWarmThroughput$1, c as renderNestedTemplateTreeDefect, ca as findSilentDropProperties, cr as reEnableInstanceApiTermination, dc as describeFileReadFailure, dt as getNestedRevertRun, ec as canonicalizeRegion, er as withIndeterminateGuard, fc as displayAssemblyPath, fo as recoverMaskedOutput, io as redactSecretsForState, ir as ec2InstanceProtectionSite, j as resolveDynamoDbDeleteBudgetMs, ja as requireConfigArray, jn as DBPROXY_TAGS_WHAT, k as deleteBudgetKey, ka as readConfigString, kr as s3BucketRegionalDomainName, mc as resolveAssemblyPath, mo as carriesSecretMask, mt as revertNestedChildFromJournal, nr as markWaitAbandoned, o as isAbsoluteAssetPath, oa as withheldAccountClause, or as observeThenDisableInstanceApiTermination, pc as renderAssemblyPathEscape, qr as passedParameterClassesOf, ro as markSameGenerationBag, s as listNestedTemplateRows, so as dynamicReferenceTokens, sr as reDisableInstanceApiTermination, t as DeployEngine, tc as derivePartitionAndUrlSuffix, tr as isWaitAbandonedError, ua as withoutSilentDropProperties, vt as withNestedStackContext, wa as coerceCfnBoolean, xa as isWarmThroughputDecrease, xt as awaitInFlightSibling, ya as WARM_THROUGHPUT_MEMBERS, z as isTruthyCfnBoolean, za as lambdaFunctionNameForMask, zn as stringifyIfAssigned, zt as redactedDeleteAddressSkip } from "./deploy-engine-aXeTL7rk.js";
6
- import { a as AmbiguousCreateLatch, c as isInsideWindow, i as AMBIGUOUS_LATCH_TTL_MS, l as setBounded, n as collectInlinePolicyNamesManagedBySiblings, o as RecentIdSet, r as IamCreateClientCache, s as createAttemptKey, t as IAMRoleProvider, u as withoutServerErrorRetries } from "./iam-role-provider-B8gFSZcy.js";
7
- import { a as canonicalizeIpProtocolValue, i as resolveSecretDerivedPrincipals, n as runDestroyForStack, o as resolvedResourceTimeoutMs, r as isResolvableSecretPrincipalList, t as canonicalizeIpv4Cidr } from "./program-w_06Pj_g.js";
8
- import { RDSProvider } from "./rds-provider-CUN4EuIb.js";
9
- import { NeptuneProvider } from "./neptune-provider-xf0xgelu.js";
10
- import { ASGProvider } from "./asg-provider-HvY_p4Yc.js";
5
+ import { $r as passedParameterClassesOf, Aa as coerceCfnBoolean, Bn as planTagDiff, Br as getAccountInfo, Ct as INDEX_SETTLE_POLL_INTERVAL_MS, Da as isWarmThroughputDecrease, Dc as renderAssemblyPathEscape, Dt as S3_AUTO_DELETE_OBJECTS_TAG, Ea as coerceWarmThroughput$1, Ec as displayAssemblyPath, Eo as recoverMaskedOutput, Et as ECR_AUTO_DELETE_IMAGES_TAG, Fa as readConfigString, Fn as reserveStackCreateToken, Fr as s3BucketRegionalDomainName, Ga as lambdaFunctionNameForMask, Gn as definedAttributes, Gt as redactedDeleteAddressFields, Hn as refuseMalformedDesiredTags, Ia as replayWarn, Ir as s3BucketWebsiteUrl, Ka as sameLambdaFunctionAddress, Kn as stringifyIfAssigned, Kt as redactedDeleteAddressSkip, La as requireConfigArray, Ln as acquireIdempotencyToken, Ma as configBooleanRefusal, Mr as s3BucketArn, Na as configIntegerRefusal, Nn as earliestDefined, Nr as s3BucketDomainName, Oa as toCfnInteger, Oc as resolveAssemblyPath, Oo as carriesSecretMask, Ot as hasCdkAutoDeleteTag, Pa as configStringRefusal, Pi as refuseMalformedNestedChildOutputs, Pr as s3BucketDualStackDomainName, Qn as getCurrentResourceSecrets, Ra as requireConfigObject, Rn as DBPROXY_TAGS_WHAT, St as DELETE_INDEX_WAIT_PROCEED_NOTE, T as markRefusedBeforeApplying, Ta as WARM_THROUGHPUT_MEMBERS, Tc as describeFileReadFailure, Tt as waitForIndexesSettled, Ua as withRetry, Un as tagMapAsList, Ut as REDACTED_DELETE_ADDRESS_SKIP_REASON, Vn as readTagList, Vt as getCurrentProducerRegions, Wa as canonicalLambdaFunctionName, Wn as tagPlanWarning, Wt as isRedactedRecordedValue, Xr as parseWebACLArn, Z as getNestedRevertRun, _o as markSameGenerationBag, _t as beginDeleteWait, a as findNestedTemplateTreeDefect, ai as accountArgs, ar as deleteSkipReason, bt as resolveDynamoDbDeleteBudgetClock, c as renderNestedTemplateTreeDefect, cr as markWaitAbandoned, dc as decodeListingKey, dr as isTerminationProtectionPropagationError, ds as rewriteTemplateAssetReferences, ea as refuseMalformedResourcesForDestroy, et as revertNestedChildFromJournal, fa as withheldAccountClause, fr as observeThenDisableInstanceApiTermination, ga as withoutSilentDropProperties, gt as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, hc as derivePartitionAndUrlSuffix, ht as DynamoDBGlobalTableProvider, it as withNestedStackContext, ja as coerceCfnInteger, jr as isSettledInstanceState, ka as toFiniteNumber, kt as isTruthyCfnBoolean, lt as getStackRecords, ma as findSilentDropProperties, mc as canonicalizeRegion, mr as reEnableInstanceApiTermination, nr as unchangedBehindSecretReference, o as isAbsoluteAssetPath, oo as hasMaskableValues, or as withIndeterminateGuard, os as stringifyValue, pr as reDisableInstanceApiTermination, rt as getCurrentNestedStackContext, s as listNestedTemplateRows, sr as isWaitAbandonedError, st as awaitInFlightSibling, t as DeployEngine, to as passedNoEchoParametersOf, tr as slowCcOperationTimeoutMs, ur as ec2InstanceProtectionSite, vo as redactSecretsForState, vt as compensateRemovedDeletionProtection, w as getPriorAttempts, wt as deleteTableWithIndexBusyRetry, xo as dynamicReferenceTokens, xt as resolveDynamoDbDeleteBudgetMs, yt as deleteBudgetKey, za as requireConfigString, zn as DBPROXY_TAG_OPTIONS } from "./deploy-engine-FDsHckZR.js";
6
+ import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-BuWI_oJp.js";
7
+ import { a as canonicalizeIpProtocolValue, i as resolveSecretDerivedPrincipals, n as runDestroyForStack, o as resolvedResourceTimeoutMs, r as isResolvableSecretPrincipalList, t as canonicalizeIpv4Cidr } from "./program-1S4fU3m4.js";
8
+ import { RDSProvider } from "./rds-provider-Q1U7N7ee.js";
9
+ import { NeptuneProvider } from "./neptune-provider-Bdc1YYxL.js";
10
+ import { ASGProvider } from "./asg-provider-DeeIdM5B.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, 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";
@@ -3053,8 +3053,31 @@ function noRecordedRegionCause() {
3053
3053
  function shownLifecycleRuleId(id) {
3054
3054
  return id === void 0 || id === null || id === "" ? "(no Id)" : displayIdent(id);
3055
3055
  }
3056
+ const createBucketLatch = new AmbiguousCreateLatch("CreateBucket");
3057
+ const heldCreateBucketWindows = /* @__PURE__ */ new Map();
3058
+ function takeCreateBucketWindow(logicalId) {
3059
+ const latched = createBucketLatch.take(logicalId);
3060
+ const key = createAttemptKey("CreateBucket", logicalId);
3061
+ const held = heldCreateBucketWindows.get(key);
3062
+ heldCreateBucketWindows.delete(key);
3063
+ const kept = held !== void 0 && Date.now() - held.heldAtMs <= 18e5 ? held.window : void 0;
3064
+ if (latched === void 0) return kept;
3065
+ if (kept === void 0) return latched;
3066
+ return {
3067
+ floorMs: Math.min(latched.floorMs, kept.floorMs),
3068
+ ceilingMs: Math.max(latched.ceilingMs, kept.ceilingMs)
3069
+ };
3070
+ }
3071
+ function holdCreateBucketWindow(logicalId, window) {
3072
+ setBounded(heldCreateBucketWindows, createAttemptKey("CreateBucket", logicalId), {
3073
+ window,
3074
+ heldAtMs: Date.now()
3075
+ });
3076
+ }
3056
3077
  var S3BucketProvider = class S3BucketProvider {
3057
3078
  s3Client;
3079
+ createClientHolder = {};
3080
+ credentialConfig;
3058
3081
  logger = getLogger().child("S3BucketProvider");
3059
3082
  opMask = void 0;
3060
3083
  handledProperties = /* @__PURE__ */ new Map([["AWS::S3::Bucket", /* @__PURE__ */ new Set([
@@ -3082,6 +3105,27 @@ var S3BucketProvider = class S3BucketProvider {
3082
3105
  constructor() {
3083
3106
  const awsClients = getAwsClients();
3084
3107
  this.s3Client = awsClients.s3;
3108
+ this.credentialConfig = awsClients.credentialConfig ?? {};
3109
+ }
3110
+ getCreateClient() {
3111
+ const holder = this.createClientHolder;
3112
+ holder.client ??= this.s3Client.config.region().then((region) => withoutServerErrorRetries(new S3Client({
3113
+ ...clientDefaultsFor(this.credentialConfig),
3114
+ region
3115
+ })), (error) => {
3116
+ holder.client = void 0;
3117
+ throw error;
3118
+ });
3119
+ return holder.client;
3120
+ }
3121
+ refuseAmbiguousCreateAdopt(logicalId, resourceType, bucketName, region, via) {
3122
+ const aws = pasteableAwsCommand(this.shownMask);
3123
+ const regionArg = region ? aws` --region ${region}` : aws``;
3124
+ const owned = aws`aws s3api list-buckets --prefix ${bucketName}`.render();
3125
+ const versions = aws`aws s3api list-object-versions --bucket ${bucketName} --max-items 10${regionArg}`.render();
3126
+ const deletion = aws`aws s3api delete-bucket --bucket ${bucketName}${regionArg}`.render();
3127
+ const presence = "preflight" in via && via.preflight === "indeterminate" ? "a bucket of that name may exist (cdkd could not read its location)" : "the bucket now exists";
3128
+ throw markNonRetryable(new ProvisioningError(`Refusing to adopt S3 bucket ${this.shown(bucketName)} for ${displaySafe(logicalId)} (${resourceType}): an earlier attempt of this create ended without a definite answer (a server error or a lost response) after it may have created the bucket, and ${presence}, so cdkd cannot tell whether this deploy or someone else created it. Check whether this account owns it: ${owned} (it lists only this account's buckets; its CreationDate is a hint, not proof, since some bucket changes update it), and whether it holds any object or object version: ${versions}. If it is listed there, its CreationDate matches the failed attempt, it is empty, and nobody else on your team uses this name, it is this deploy's orphan: delete it with ${deletion} (S3 refuses with BucketNotEmpty if anything is left in it) and re-run the deploy. If it is a bucket you mean this stack to own, re-run the deploy to adopt it.`, resourceType, logicalId, bucketName, "cause" in via ? via.cause : void 0));
3085
3129
  }
3086
3130
  async getRegion() {
3087
3131
  return await this.s3Client.config.region() || "us-east-1";
@@ -3827,6 +3871,7 @@ var S3BucketProvider = class S3BucketProvider {
3827
3871
  noWriteProbe() {
3828
3872
  const probe = Object.create(this);
3829
3873
  probe.s3Client = { send: async () => ({}) };
3874
+ Object.defineProperty(probe, "createClientHolder", { value: { client: Promise.resolve(probe.s3Client) } });
3830
3875
  const silent = () => {};
3831
3876
  probe.logger = Object.assign(Object.create(this.logger), {
3832
3877
  debug: silent,
@@ -4241,6 +4286,8 @@ var S3BucketProvider = class S3BucketProvider {
4241
4286
  allowedPattern: /[^a-z0-9.-]/g
4242
4287
  });
4243
4288
  let bucketLeftBehind = false;
4289
+ let ambiguousWindow;
4290
+ let windowSpent = false;
4244
4291
  try {
4245
4292
  const createParams = { Bucket: bucketName };
4246
4293
  const region = await this.getRegion();
@@ -4249,17 +4296,35 @@ var S3BucketProvider = class S3BucketProvider {
4249
4296
  if (declaresBucketObjectLock(properties)) createParams.ObjectLockEnabledForBucket = true;
4250
4297
  const preflight = canonicalizeRegion(region) === "us-east-1" ? await this.probeBucketRegion(bucketName) : { kind: "absent" };
4251
4298
  let createdNewBucket = false;
4299
+ const createClient = await this.getCreateClient();
4300
+ ambiguousWindow = takeCreateBucketWindow(logicalId);
4301
+ if (ambiguousWindow !== void 0 && (preflight.kind === "indeterminate" || preflight.kind === "region" && preflight.region === "us-east-1")) {
4302
+ windowSpent = true;
4303
+ this.refuseAmbiguousCreateAdopt(logicalId, resourceType, bucketName, canonicalRegion, { preflight: preflight.kind });
4304
+ }
4252
4305
  try {
4253
- await this.s3Client.send(new CreateBucketCommand(createParams));
4306
+ const attemptStartMs = Date.now();
4307
+ try {
4308
+ await createClient.send(new CreateBucketCommand(createParams));
4309
+ } catch (sendError) {
4310
+ createBucketLatch.noteFailure(logicalId, sendError, attemptStartMs, ambiguousWindow);
4311
+ throw sendError;
4312
+ }
4254
4313
  createdNewBucket = preflight.kind === "absent";
4255
4314
  bucketLeftBehind = createdNewBucket;
4315
+ if (createdNewBucket) windowSpent = true;
4256
4316
  if (preflight.kind === "region" && preflight.region !== "us-east-1") this.refuseForeignRegionAdopt(logicalId, resourceType, bucketName, "us-east-1", preflight.region);
4257
4317
  if (preflight.kind === "region") this.logger.warn(`S3 bucket ${this.shown(bucketName)} for ${displaySafe(logicalId)} (${resourceType}) already existed in ${preflight.region} and was ADOPTED, not created. In us-east-1 S3 answers a re-create of a bucket you already own with 200 OK and RESETS that bucket's access control lists, so any ACL previously set on ${this.shown(bucketName)} is now the default. cdkd will not delete this bucket if the rest of this create fails.`);
4258
4318
  this.logger.debug(`Created S3 bucket: ${this.shown(bucketName)}`);
4259
4319
  } catch (createError) {
4260
4320
  if (createError instanceof ProvisioningError) throw createError;
4321
+ if (createError instanceof Error && createError.name === "BucketAlreadyExists") windowSpent = true;
4261
4322
  if (createError instanceof Error && (createError.name === "BucketAlreadyOwnedByYou" || createError.message.includes("you already own it"))) {
4262
4323
  await this.assertExistingBucketRegion(logicalId, resourceType, bucketName, region, createError);
4324
+ if (ambiguousWindow !== void 0) {
4325
+ windowSpent = true;
4326
+ this.refuseAmbiguousCreateAdopt(logicalId, resourceType, bucketName, canonicalRegion, { cause: createError });
4327
+ }
4263
4328
  this.logger.debug(`S3 bucket ${this.shown(bucketName)} already exists and is owned by you`);
4264
4329
  } else throw createError;
4265
4330
  }
@@ -4294,6 +4359,7 @@ var S3BucketProvider = class S3BucketProvider {
4294
4359
  ...effectiveProperties ? { effectiveProperties } : {}
4295
4360
  };
4296
4361
  } catch (error) {
4362
+ if (ambiguousWindow !== void 0 && !windowSpent) holdCreateBucketWindow(logicalId, ambiguousWindow);
4297
4363
  const thrown = this.wrapOperationError("create", logicalId, resourceType, bucketName, error);
4298
4364
  if (bucketLeftBehind) markCreatedBeforeFailure(thrown, logicalId, resourceType, bucketName);
4299
4365
  throw thrown;
@@ -10177,6 +10243,8 @@ function maskLeafValue(value, maskSecrets) {
10177
10243
  }
10178
10244
  var DynamoDBTableProvider = class {
10179
10245
  dynamoDBClient;
10246
+ createClient;
10247
+ credentialConfig;
10180
10248
  logger = getLogger().child("DynamoDBTableProvider");
10181
10249
  handledProperties = /* @__PURE__ */ new Map([["AWS::DynamoDB::Table", /* @__PURE__ */ new Set([
10182
10250
  "TableName",
@@ -10205,6 +10273,17 @@ var DynamoDBTableProvider = class {
10205
10273
  constructor() {
10206
10274
  const awsClients = getAwsClients();
10207
10275
  this.dynamoDBClient = awsClients.dynamoDB;
10276
+ this.credentialConfig = awsClients.credentialConfig ?? {};
10277
+ }
10278
+ getCreateClient() {
10279
+ this.createClient ??= this.dynamoDBClient.config.region().then((region) => withoutServerErrorRetries(new DynamoDBClient({
10280
+ ...clientDefaultsFor(this.credentialConfig),
10281
+ region
10282
+ })), (error) => {
10283
+ this.createClient = void 0;
10284
+ throw error;
10285
+ });
10286
+ return this.createClient;
10208
10287
  }
10209
10288
  getMinResourceTimeoutMs() {
10210
10289
  return DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS;
@@ -10268,7 +10347,7 @@ var DynamoDBTableProvider = class {
10268
10347
  if (properties["TableClass"]) createParams.TableClass = properties["TableClass"];
10269
10348
  const createResourcePolicyDoc = this.extractResourcePolicyDocument(properties["ResourcePolicy"]);
10270
10349
  if (createResourcePolicyDoc !== void 0) createParams.ResourcePolicy = createResourcePolicyDoc;
10271
- await this.dynamoDBClient.send(new CreateTableCommand(createParams));
10350
+ await (await this.getCreateClient()).send(new CreateTableCommand(createParams));
10272
10351
  tableCreated = true;
10273
10352
  this.logger.debug(`CreateTable initiated for ${tableName}, waiting for ACTIVE status`);
10274
10353
  const tableInfo = await this.waitForTableActive(tableName);
@@ -12727,6 +12806,8 @@ var SecretsManagerSecretProvider = class {
12727
12806
  //#region src/provisioning/providers/ssm-parameter-provider.ts
12728
12807
  var SSMParameterProvider = class SSMParameterProvider {
12729
12808
  ssmClient;
12809
+ createClient;
12810
+ credentialConfig;
12730
12811
  logger = getLogger().child("SSMParameterProvider");
12731
12812
  wrapMaskedError(mask, error, build) {
12732
12813
  return wrapMaskedAwsError(mask, error, build);
@@ -12745,6 +12826,19 @@ var SSMParameterProvider = class SSMParameterProvider {
12745
12826
  constructor() {
12746
12827
  const awsClients = getAwsClients();
12747
12828
  this.ssmClient = awsClients.ssm;
12829
+ this.credentialConfig = awsClients.credentialConfig ?? {};
12830
+ }
12831
+ getCreateClient() {
12832
+ const shared = this.ssmClient;
12833
+ if (!(shared instanceof SSMClient)) return Promise.resolve(shared);
12834
+ this.createClient ??= shared.config.region().then((region) => withoutServerErrorRetries(new SSMClient({
12835
+ ...clientDefaultsFor(this.credentialConfig),
12836
+ region
12837
+ })), (error) => {
12838
+ this.createClient = void 0;
12839
+ throw error;
12840
+ });
12841
+ return this.createClient;
12748
12842
  }
12749
12843
  static userTags(tags) {
12750
12844
  return tags.filter((t) => !t.Key.startsWith("aws:"));
@@ -12793,7 +12887,7 @@ var SSMParameterProvider = class SSMParameterProvider {
12793
12887
  if (properties["Tier"]) putParams.Tier = properties["Tier"];
12794
12888
  if (properties["Policies"]) putParams.Policies = properties["Policies"];
12795
12889
  if (properties["DataType"]) putParams.DataType = properties["DataType"];
12796
- await this.ssmClient.send(new PutParameterCommand(putParams));
12890
+ await (await this.getCreateClient()).send(new PutParameterCommand(putParams));
12797
12891
  leftBehind = true;
12798
12892
  try {
12799
12893
  if (ssmTags.length > 0) await this.ssmClient.send(new AddTagsToResourceCommand({
@@ -13737,10 +13831,18 @@ function isNamedError(error, names) {
13737
13831
  }
13738
13832
  const NAT_GATEWAY_NOT_FOUND_NAMES = /* @__PURE__ */ new Set(["NatGatewayNotFound"]);
13739
13833
  const EIP_ALLOCATION_NOT_FOUND_NAMES = /* @__PURE__ */ new Set(["InvalidAllocationID.NotFound"]);
13834
+ const INSTANCE_NOT_FOUND_NAMES = /* @__PURE__ */ new Set(["InvalidInstanceID.NotFound"]);
13835
+ const VPC_NOT_FOUND_NAMES = /* @__PURE__ */ new Set(["InvalidVpcID.NotFound"]);
13836
+ const SUBNET_NOT_FOUND_NAMES = /* @__PURE__ */ new Set(["InvalidSubnetID.NotFound"]);
13837
+ const SECURITY_GROUP_NOT_FOUND_NAMES = /* @__PURE__ */ new Set(["InvalidGroup.NotFound"]);
13740
13838
  const NAT_GATEWAY_ID_PATTERN = /^nat-[0-9a-f]+$/;
13741
13839
  const EIP_ALLOCATION_ID_PATTERN = /^eipalloc-[0-9a-f]+$/;
13742
- function natGatewayIdentity(physicalId) {
13743
- return NAT_GATEWAY_ID_PATTERN.test(physicalId) ? physicalId : void 0;
13840
+ const INSTANCE_ID_PATTERN = /^i-[0-9a-f]+$/;
13841
+ const VPC_ID_PATTERN = /^vpc-[0-9a-f]+$/;
13842
+ const SUBNET_ID_PATTERN = /^subnet-[0-9a-f]+$/;
13843
+ const SECURITY_GROUP_ID_PATTERN = /^sg-[0-9a-f]+$/;
13844
+ function generatedIdIdentity(pattern, physicalId) {
13845
+ return pattern.test(physicalId) ? physicalId : void 0;
13744
13846
  }
13745
13847
  function eipAllocationIdentity(physicalId) {
13746
13848
  const segments = physicalId.split("|");
@@ -14080,17 +14182,28 @@ var EC2Provider = class {
14080
14182
  }
14081
14183
  async isSameResource(journaledPhysicalId, record, resourceType, context) {
14082
14184
  let read;
14083
- let journaledId;
14084
- let recordId;
14185
+ let identity;
14085
14186
  if (resourceType === "AWS::EC2::NatGateway") {
14086
- journaledId = natGatewayIdentity(journaledPhysicalId);
14087
- recordId = natGatewayIdentity(record.physicalId);
14187
+ identity = (id) => generatedIdIdentity(NAT_GATEWAY_ID_PATTERN, id);
14088
14188
  read = (id) => this.readNatGatewayIdIfLive(id);
14089
14189
  } else if (resourceType === "AWS::EC2::EIP") {
14090
- journaledId = eipAllocationIdentity(journaledPhysicalId);
14091
- recordId = eipAllocationIdentity(record.physicalId);
14190
+ identity = eipAllocationIdentity;
14092
14191
  read = (id) => this.readEipAllocationIdIfExists(id);
14192
+ } else if (resourceType === "AWS::EC2::Instance") {
14193
+ identity = (id) => generatedIdIdentity(INSTANCE_ID_PATTERN, id);
14194
+ read = (id) => this.readInstanceIdIfLive(id);
14195
+ } else if (resourceType === "AWS::EC2::VPC") {
14196
+ identity = (id) => generatedIdIdentity(VPC_ID_PATTERN, id);
14197
+ read = (id) => this.readVpcIdIfLive(id);
14198
+ } else if (resourceType === "AWS::EC2::Subnet") {
14199
+ identity = (id) => generatedIdIdentity(SUBNET_ID_PATTERN, id);
14200
+ read = (id) => this.readSubnetIdIfLive(id);
14201
+ } else if (resourceType === "AWS::EC2::SecurityGroup") {
14202
+ identity = (id) => generatedIdIdentity(SECURITY_GROUP_ID_PATTERN, id);
14203
+ read = (id) => this.readSecurityGroupIdIfExists(id);
14093
14204
  } else return "unknown";
14205
+ const journaledId = identity(journaledPhysicalId);
14206
+ const recordId = identity(record.physicalId);
14094
14207
  if (journaledId === void 0 || recordId === void 0) return "unknown";
14095
14208
  if (journaledId === recordId) return "same";
14096
14209
  if (resourceType === "AWS::EC2::EIP" && journaledPhysicalId === journaledId) return "unknown";
@@ -14111,6 +14224,65 @@ var EC2Provider = class {
14111
14224
  const gateway = gateways[0];
14112
14225
  return gateway.State === "pending" || gateway.State === "available" ? gateway.NatGatewayId : void 0;
14113
14226
  }
14227
+ async readInstanceIdIfLive(instanceId) {
14228
+ let response;
14229
+ try {
14230
+ response = await this.ec2Client.send(new DescribeInstancesCommand({ InstanceIds: [instanceId] }));
14231
+ } catch (error) {
14232
+ if (isNamedError(error, INSTANCE_NOT_FOUND_NAMES)) return void 0;
14233
+ throw error;
14234
+ }
14235
+ const instances = (response.Reservations ?? []).flatMap((r) => r.Instances ?? []);
14236
+ if (instances.length !== 1 || typeof instances[0]?.InstanceId !== "string") throw new Error("DescribeInstances did not return exactly the instance asked for");
14237
+ const instance = instances[0];
14238
+ const state = instance.State?.Name;
14239
+ if (state === "shutting-down" || state === "terminated") return void 0;
14240
+ if (state === "pending" || state === "running" || state === "stopping" || state === "stopped") return instance.InstanceId;
14241
+ throw new Error("DescribeInstances returned an instance in no known state");
14242
+ }
14243
+ async readVpcIdIfLive(vpcId) {
14244
+ let response;
14245
+ try {
14246
+ response = await this.ec2Client.send(new DescribeVpcsCommand({ VpcIds: [vpcId] }));
14247
+ } catch (error) {
14248
+ if (isNamedError(error, VPC_NOT_FOUND_NAMES)) return void 0;
14249
+ throw error;
14250
+ }
14251
+ const vpcs = response.Vpcs ?? [];
14252
+ if (vpcs.length !== 1 || typeof vpcs[0]?.VpcId !== "string") throw new Error("DescribeVpcs did not return exactly the VPC asked for");
14253
+ const vpc = vpcs[0];
14254
+ if (vpc.State === "deleting") return void 0;
14255
+ if (vpc.State === "pending" || vpc.State === "available") return vpc.VpcId;
14256
+ throw new Error("DescribeVpcs returned a VPC in no known state");
14257
+ }
14258
+ async readSubnetIdIfLive(subnetId) {
14259
+ let response;
14260
+ try {
14261
+ response = await this.ec2Client.send(new DescribeSubnetsCommand({ SubnetIds: [subnetId] }));
14262
+ } catch (error) {
14263
+ if (isNamedError(error, SUBNET_NOT_FOUND_NAMES)) return void 0;
14264
+ throw error;
14265
+ }
14266
+ const subnets = response.Subnets ?? [];
14267
+ if (subnets.length !== 1 || typeof subnets[0]?.SubnetId !== "string") throw new Error("DescribeSubnets did not return exactly the subnet asked for");
14268
+ const subnet = subnets[0];
14269
+ const state = subnet.State;
14270
+ if (state === "pending" || state === "available") return subnet.SubnetId;
14271
+ if (state === "failed" || state === "failed-insufficient-capacity" || state === "unavailable") return;
14272
+ throw new Error("DescribeSubnets returned a subnet in no known state");
14273
+ }
14274
+ async readSecurityGroupIdIfExists(groupId) {
14275
+ let response;
14276
+ try {
14277
+ response = await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [groupId] }));
14278
+ } catch (error) {
14279
+ if (isNamedError(error, SECURITY_GROUP_NOT_FOUND_NAMES)) return void 0;
14280
+ throw error;
14281
+ }
14282
+ const groups = response.SecurityGroups ?? [];
14283
+ if (groups.length !== 1 || typeof groups[0]?.GroupId !== "string") throw new Error("DescribeSecurityGroups did not return exactly the group asked for");
14284
+ return groups[0].GroupId;
14285
+ }
14114
14286
  async readEipAllocationIdIfExists(allocationId) {
14115
14287
  let response;
14116
14288
  try {
@@ -14238,10 +14410,11 @@ var EC2Provider = class {
14238
14410
  this.logger.debug(`Successfully deleted VPC ${logicalId}`);
14239
14411
  return;
14240
14412
  } catch (error) {
14241
- if (this.isNotFoundError(error)) {
14413
+ if (this.isNotFoundError(error) && (context?.failedCreateOrphan !== true || isNamedError(error, VPC_NOT_FOUND_NAMES))) {
14242
14414
  const clientRegion = await this.ec2Client.config.region();
14243
14415
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
14244
- this.logger.debug(`VPC ${physicalId} does not exist, skipping deletion`);
14416
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` VPC ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
14417
+ else this.logger.debug(`VPC ${physicalId} does not exist, skipping deletion`);
14245
14418
  return;
14246
14419
  }
14247
14420
  const msg = describeAwsFailure(error).detail;
@@ -14402,10 +14575,11 @@ var EC2Provider = class {
14402
14575
  this.logger.debug(`Successfully deleted Subnet ${logicalId}`);
14403
14576
  return;
14404
14577
  } catch (error) {
14405
- if (this.isNotFoundError(error)) {
14578
+ if (this.isNotFoundError(error) && (context?.failedCreateOrphan !== true || isNamedError(error, SUBNET_NOT_FOUND_NAMES))) {
14406
14579
  const clientRegion = await this.ec2Client.config.region();
14407
14580
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
14408
- this.logger.debug(`Subnet ${physicalId} does not exist, skipping deletion`);
14581
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Subnet ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
14582
+ else this.logger.debug(`Subnet ${physicalId} does not exist, skipping deletion`);
14409
14583
  return;
14410
14584
  }
14411
14585
  const msg = describeAwsFailure(error).detail;
@@ -15086,10 +15260,11 @@ var EC2Provider = class {
15086
15260
  this.logger.debug(`Successfully deleted SecurityGroup ${logicalId}`);
15087
15261
  return;
15088
15262
  } catch (error) {
15089
- if (this.isNotFoundError(error)) {
15263
+ if (this.isNotFoundError(error) && (context?.failedCreateOrphan !== true || isNamedError(error, SECURITY_GROUP_NOT_FOUND_NAMES))) {
15090
15264
  const clientRegion = await this.ec2Client.config.region();
15091
15265
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
15092
- this.logger.debug(`SecurityGroup ${physicalId} does not exist, skipping deletion`);
15266
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Security group ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
15267
+ else this.logger.debug(`SecurityGroup ${physicalId} does not exist, skipping deletion`);
15093
15268
  return;
15094
15269
  }
15095
15270
  const msg = describeAwsFailure(error).detail;
@@ -15759,7 +15934,8 @@ var EC2Provider = class {
15759
15934
  if (this.isNotFoundError(error)) {
15760
15935
  const clientRegion = await this.ec2Client.config.region();
15761
15936
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
15762
- this.logger.debug(`EC2 Instance ${physicalId} already terminated (not found), treating as success`);
15937
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` EC2 instance ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
15938
+ else this.logger.debug(`EC2 Instance ${physicalId} already terminated (not found), treating as success`);
15763
15939
  return;
15764
15940
  }
15765
15941
  const msg = describeAwsFailure(error).detail;
@@ -19907,16 +20083,31 @@ var CloudFrontOAIProvider = class {
19907
20083
  //#region src/provisioning/providers/cloudfront-oac-provider.ts
19908
20084
  var CloudFrontOACProvider = class {
19909
20085
  cloudFrontClient;
20086
+ createClient;
20087
+ credentialConfig;
19910
20088
  logger = getLogger().child("CloudFrontOACProvider");
19911
20089
  handledProperties = /* @__PURE__ */ new Map([["AWS::CloudFront::OriginAccessControl", /* @__PURE__ */ new Set(["OriginAccessControlConfig"])]]);
19912
20090
  constructor() {
19913
20091
  const awsClients = getAwsClients();
19914
20092
  this.cloudFrontClient = awsClients.cloudFront;
20093
+ this.credentialConfig = awsClients.credentialConfig ?? {};
20094
+ }
20095
+ getCreateClient() {
20096
+ const shared = this.cloudFrontClient;
20097
+ if (!(shared instanceof CloudFrontClient)) return Promise.resolve(shared);
20098
+ this.createClient ??= shared.config.region().then((region) => withoutServerErrorRetries(new CloudFrontClient({
20099
+ ...clientDefaultsFor(this.credentialConfig),
20100
+ region
20101
+ })), (error) => {
20102
+ this.createClient = void 0;
20103
+ throw error;
20104
+ });
20105
+ return this.createClient;
19915
20106
  }
19916
20107
  async create(logicalId, resourceType, properties) {
19917
20108
  this.logger.debug(`Creating CloudFront Origin Access Control ${logicalId}`);
19918
20109
  try {
19919
- const oacId = (await this.cloudFrontClient.send(new CreateOriginAccessControlCommand({ OriginAccessControlConfig: this.toSdkConfig(properties["OriginAccessControlConfig"], logicalId, resourceType) }))).OriginAccessControl?.Id;
20110
+ const oacId = (await (await this.getCreateClient()).send(new CreateOriginAccessControlCommand({ OriginAccessControlConfig: this.toSdkConfig(properties["OriginAccessControlConfig"], logicalId, resourceType) }))).OriginAccessControl?.Id;
19920
20111
  if (!oacId) throw new Error("CreateOriginAccessControl returned no OriginAccessControl.Id");
19921
20112
  this.logger.debug(`Created CloudFront Origin Access Control: ${oacId}`);
19922
20113
  return {
@@ -23111,6 +23302,15 @@ function isElbv2NotFoundName(error) {
23111
23302
  const name = error?.name;
23112
23303
  return name === "LoadBalancerNotFoundException" || name === "TargetGroupNotFoundException" || name === "ListenerNotFoundException";
23113
23304
  }
23305
+ const ELBV2_ARN_PATTERNS = /* @__PURE__ */ new Map([
23306
+ ["AWS::ElasticLoadBalancingV2::LoadBalancer", /^arn:(aws[a-z-]*):elasticloadbalancing:([a-z0-9-]+):(\d{12}):loadbalancer\/(?:app|net|gwy)\/[A-Za-z0-9-]+\/[0-9a-f]+$/],
23307
+ ["AWS::ElasticLoadBalancingV2::TargetGroup", /^arn:(aws[a-z-]*):elasticloadbalancing:([a-z0-9-]+):(\d{12}):targetgroup\/[A-Za-z0-9-]+\/[0-9a-f]+$/],
23308
+ ["AWS::ElasticLoadBalancingV2::Listener", /^arn:(aws[a-z-]*):elasticloadbalancing:([a-z0-9-]+):(\d{12}):listener\/(?:app|net|gwy)\/[A-Za-z0-9-]+\/[0-9a-f]+\/[0-9a-f]+$/]
23309
+ ]);
23310
+ function elbv2ArnScope(resourceType, physicalId) {
23311
+ const match = ELBV2_ARN_PATTERNS.get(resourceType)?.exec(physicalId);
23312
+ return match ? `${match[1]}:${match[2]}:${match[3]}` : void 0;
23313
+ }
23114
23314
  var ELBv2Provider = class {
23115
23315
  elbv2Client;
23116
23316
  providerRegion = ambientRegion();
@@ -23164,7 +23364,8 @@ var ELBv2Provider = class {
23164
23364
  "SslPolicy",
23165
23365
  "AlpnPolicy",
23166
23366
  "MutualAuthentication",
23167
- "ListenerAttributes"
23367
+ "ListenerAttributes",
23368
+ "Tags"
23168
23369
  ])]
23169
23370
  ]);
23170
23371
  getClient() {
@@ -23180,6 +23381,13 @@ var ELBv2Provider = class {
23180
23381
  maskErrorMessage(error, maskSecrets) {
23181
23382
  return maskerOrIdentity(maskSecrets)(error instanceof Error ? error.message : String(error));
23182
23383
  }
23384
+ isDeleteTargetGone(error, context, notFoundName) {
23385
+ return context?.failedCreateOrphan === true ? hasErrorName(error, [notFoundName]) : this.isNotFoundError(error);
23386
+ }
23387
+ logDeleteTargetGone(context, what, physicalId, logicalId, debugText) {
23388
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` ${what} ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
23389
+ else this.logger.debug(debugText);
23390
+ }
23183
23391
  wrapMaskedError(mask, error, build) {
23184
23392
  return wrapMaskedAwsError(mask, error, build);
23185
23393
  }
@@ -23217,6 +23425,47 @@ var ELBv2Provider = class {
23217
23425
  default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
23218
23426
  }
23219
23427
  }
23428
+ async isSameResource(journaledPhysicalId, record, resourceType, context) {
23429
+ const journaledScope = elbv2ArnScope(resourceType, journaledPhysicalId);
23430
+ const recordScope = elbv2ArnScope(resourceType, record.physicalId);
23431
+ if (journaledScope === void 0 || journaledScope !== recordScope) return "unknown";
23432
+ if (journaledPhysicalId === record.physicalId) return "same";
23433
+ if (journaledScope.split(":")[1] !== context.expectedRegion) return "unknown";
23434
+ if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
23435
+ if (await this.readElbv2ArnIfExists(resourceType, record.physicalId) !== record.physicalId) return "unknown";
23436
+ const journaledLive = await this.readElbv2ArnIfExists(resourceType, journaledPhysicalId);
23437
+ if (journaledLive === record.physicalId) return "same";
23438
+ return journaledLive === void 0 || journaledLive === journaledPhysicalId ? "different" : "unknown";
23439
+ }
23440
+ async readElbv2ArnIfExists(resourceType, arn) {
23441
+ let notFoundName;
23442
+ let read;
23443
+ switch (resourceType) {
23444
+ case "AWS::ElasticLoadBalancingV2::LoadBalancer":
23445
+ notFoundName = "LoadBalancerNotFoundException";
23446
+ read = async () => (await this.getClient().send(new DescribeLoadBalancersCommand({ LoadBalancerArns: [arn] }))).LoadBalancers?.map((lb) => lb.LoadBalancerArn);
23447
+ break;
23448
+ case "AWS::ElasticLoadBalancingV2::TargetGroup":
23449
+ notFoundName = "TargetGroupNotFoundException";
23450
+ read = async () => (await this.getClient().send(new DescribeTargetGroupsCommand({ TargetGroupArns: [arn] }))).TargetGroups?.map((tg) => tg.TargetGroupArn);
23451
+ break;
23452
+ case "AWS::ElasticLoadBalancingV2::Listener":
23453
+ notFoundName = "ListenerNotFoundException";
23454
+ read = async () => (await this.getClient().send(new DescribeListenersCommand({ ListenerArns: [arn] }))).Listeners?.map((l) => l.ListenerArn);
23455
+ break;
23456
+ default: throw new Error(`No ELBv2 identity read for ${resourceType}`);
23457
+ }
23458
+ let arns;
23459
+ try {
23460
+ arns = await read();
23461
+ } catch (error) {
23462
+ if (error?.name === notFoundName) return void 0;
23463
+ throw error;
23464
+ }
23465
+ const found = arns ?? [];
23466
+ if (found.length !== 1 || typeof found[0] !== "string" || found[0] === "") throw new Error("ELBv2 did not return exactly the resource asked for");
23467
+ return found[0];
23468
+ }
23220
23469
  async createLoadBalancer(logicalId, resourceType, properties, maskSecrets) {
23221
23470
  this.logger.debug(`Creating LoadBalancer ${logicalId}`);
23222
23471
  const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
@@ -23490,10 +23739,10 @@ var ELBv2Provider = class {
23490
23739
  flip.deleteAccepted = true;
23491
23740
  this.logger.debug(`Successfully deleted LoadBalancer ${logicalId}`);
23492
23741
  } catch (error) {
23493
- if (this.isNotFoundError(error)) {
23742
+ if (this.isDeleteTargetGone(error, context, "LoadBalancerNotFoundException")) {
23494
23743
  const clientRegion = await this.getClient().config.region();
23495
23744
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
23496
- this.logger.debug(`LoadBalancer ${physicalId} does not exist, skipping deletion`);
23745
+ this.logDeleteTargetGone(context, "Load balancer", physicalId, logicalId, `LoadBalancer ${physicalId} does not exist, skipping deletion`);
23497
23746
  return;
23498
23747
  }
23499
23748
  const cause = error instanceof Error ? error : void 0;
@@ -23657,10 +23906,10 @@ var ELBv2Provider = class {
23657
23906
  await this.getClient().send(new DeleteTargetGroupCommand({ TargetGroupArn: physicalId }));
23658
23907
  this.logger.debug(`Successfully deleted TargetGroup ${logicalId}`);
23659
23908
  } catch (error) {
23660
- if (this.isNotFoundError(error)) {
23909
+ if (this.isDeleteTargetGone(error, context, "TargetGroupNotFoundException")) {
23661
23910
  const clientRegion = await this.getClient().config.region();
23662
23911
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
23663
- this.logger.debug(`TargetGroup ${physicalId} does not exist, skipping deletion`);
23912
+ this.logDeleteTargetGone(context, "Target group", physicalId, logicalId, `TargetGroup ${physicalId} does not exist, skipping deletion`);
23664
23913
  return;
23665
23914
  }
23666
23915
  const cause = error instanceof Error ? error : void 0;
@@ -23801,10 +24050,10 @@ var ELBv2Provider = class {
23801
24050
  await this.getClient().send(new DeleteListenerCommand({ ListenerArn: physicalId }));
23802
24051
  this.logger.debug(`Successfully deleted Listener ${logicalId}`);
23803
24052
  } catch (error) {
23804
- if (this.isNotFoundError(error)) {
24053
+ if (this.isDeleteTargetGone(error, context, "ListenerNotFoundException")) {
23805
24054
  const clientRegion = await this.getClient().config.region();
23806
24055
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
23807
- this.logger.debug(`Listener ${physicalId} does not exist, skipping deletion`);
24056
+ this.logDeleteTargetGone(context, "Listener", physicalId, logicalId, `Listener ${physicalId} does not exist, skipping deletion`);
23808
24057
  return;
23809
24058
  }
23810
24059
  const cause = error instanceof Error ? error : void 0;
@@ -24221,6 +24470,7 @@ const RETAINED_ON_REMOVAL = [
24221
24470
  ];
24222
24471
  var RDSDBProxyProvider = class {
24223
24472
  rdsClient;
24473
+ createClient;
24224
24474
  providerRegion = ambientRegion();
24225
24475
  logger = getLogger().child("RDSDBProxyProvider");
24226
24476
  attributeCache = /* @__PURE__ */ new Map();
@@ -24237,12 +24487,22 @@ var RDSDBProxyProvider = class {
24237
24487
  "Tags"
24238
24488
  ])]]);
24239
24489
  getClient() {
24240
- if (!this.rdsClient) this.rdsClient = new RDSClient({
24241
- ...ambientClientDefaults(),
24242
- ...this.providerRegion ? { region: this.providerRegion } : {}
24243
- });
24490
+ if (!this.rdsClient) {
24491
+ this.rdsClient = new RDSClient({
24492
+ ...ambientClientDefaults(),
24493
+ ...this.providerRegion ? { region: this.providerRegion } : {}
24494
+ });
24495
+ this.createClient = withoutServerErrorRetries(new RDSClient({
24496
+ ...ambientClientDefaults(),
24497
+ ...this.providerRegion ? { region: this.providerRegion } : {}
24498
+ }));
24499
+ }
24244
24500
  return this.rdsClient;
24245
24501
  }
24502
+ getCreateClient() {
24503
+ this.getClient();
24504
+ return this.createClient;
24505
+ }
24246
24506
  async create(logicalId, resourceType, properties) {
24247
24507
  const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, void 0, "Tags", DBPROXY_TAGS_WHAT, DBPROXY_TAG_OPTIONS);
24248
24508
  const dbProxyName = properties["DBProxyName"] ?? generateResourceName(logicalId, { maxLength: 64 });
@@ -24257,7 +24517,7 @@ var RDSDBProxyProvider = class {
24257
24517
  const client = this.getClient();
24258
24518
  this.logger.debug(`Creating DBProxy ${dbProxyName} (${engineFamily})`);
24259
24519
  try {
24260
- await client.send(new CreateDBProxyCommand({
24520
+ await this.getCreateClient().send(new CreateDBProxyCommand({
24261
24521
  DBProxyName: dbProxyName,
24262
24522
  EngineFamily: engineFamily,
24263
24523
  Auth: auth,
@@ -24535,6 +24795,7 @@ const POLL_INTERVAL_MS = 5e3;
24535
24795
  const POLL_TIMEOUT_MS = 18e5;
24536
24796
  var RDSDBProxyEndpointProvider = class {
24537
24797
  rdsClient;
24798
+ createClient;
24538
24799
  providerRegion = ambientRegion();
24539
24800
  logger = getLogger().child("RDSDBProxyEndpointProvider");
24540
24801
  attributeCache = /* @__PURE__ */ new Map();
@@ -24547,12 +24808,22 @@ var RDSDBProxyEndpointProvider = class {
24547
24808
  "Tags"
24548
24809
  ])]]);
24549
24810
  getClient() {
24550
- if (!this.rdsClient) this.rdsClient = new RDSClient({
24551
- ...ambientClientDefaults(),
24552
- ...this.providerRegion ? { region: this.providerRegion } : {}
24553
- });
24811
+ if (!this.rdsClient) {
24812
+ this.rdsClient = new RDSClient({
24813
+ ...ambientClientDefaults(),
24814
+ ...this.providerRegion ? { region: this.providerRegion } : {}
24815
+ });
24816
+ this.createClient = withoutServerErrorRetries(new RDSClient({
24817
+ ...ambientClientDefaults(),
24818
+ ...this.providerRegion ? { region: this.providerRegion } : {}
24819
+ }));
24820
+ }
24554
24821
  return this.rdsClient;
24555
24822
  }
24823
+ getCreateClient() {
24824
+ this.getClient();
24825
+ return this.createClient;
24826
+ }
24556
24827
  async create(logicalId, resourceType, properties) {
24557
24828
  const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, void 0, "Tags", DBPROXY_TAGS_WHAT, DBPROXY_TAG_OPTIONS);
24558
24829
  const dbProxyName = properties["DBProxyName"];
@@ -24563,7 +24834,7 @@ var RDSDBProxyEndpointProvider = class {
24563
24834
  const client = this.getClient();
24564
24835
  this.logger.debug(`Creating DBProxyEndpoint ${dbProxyEndpointName} (proxy=${dbProxyName})`);
24565
24836
  try {
24566
- await client.send(new CreateDBProxyEndpointCommand({
24837
+ await this.getCreateClient().send(new CreateDBProxyEndpointCommand({
24567
24838
  DBProxyName: dbProxyName,
24568
24839
  DBProxyEndpointName: dbProxyEndpointName,
24569
24840
  VpcSubnetIds: vpcSubnetIds,
@@ -25374,6 +25645,7 @@ function instanceAttributes(instance) {
25374
25645
  }
25375
25646
  var DocDBProvider = class {
25376
25647
  docdbClient;
25648
+ createClient;
25377
25649
  providerRegion = ambientRegion();
25378
25650
  logger = getLogger().child("DocDBProvider");
25379
25651
  protectionFlips = new ProtectionFlipRegistry();
@@ -25405,12 +25677,22 @@ var DocDBProvider = class {
25405
25677
  "Tags"
25406
25678
  ])]]);
25407
25679
  getClient() {
25408
- if (!this.docdbClient) this.docdbClient = new DocDBClient({
25409
- ...ambientClientDefaults(),
25410
- ...this.providerRegion ? { region: this.providerRegion } : {}
25411
- });
25680
+ if (!this.docdbClient) {
25681
+ this.docdbClient = new DocDBClient({
25682
+ ...ambientClientDefaults(),
25683
+ ...this.providerRegion ? { region: this.providerRegion } : {}
25684
+ });
25685
+ this.createClient = withoutServerErrorRetries(new DocDBClient({
25686
+ ...ambientClientDefaults(),
25687
+ ...this.providerRegion ? { region: this.providerRegion } : {}
25688
+ }));
25689
+ }
25412
25690
  return this.docdbClient;
25413
25691
  }
25692
+ getCreateClient() {
25693
+ this.getClient();
25694
+ return this.createClient;
25695
+ }
25414
25696
  async create(logicalId, resourceType, properties) {
25415
25697
  switch (resourceType) {
25416
25698
  case "AWS::DocDB::DBCluster": return this.createDBCluster(logicalId, resourceType, properties);
@@ -25442,7 +25724,7 @@ var DocDBProvider = class {
25442
25724
  });
25443
25725
  let clusterCreated = false;
25444
25726
  try {
25445
- const response = await this.getClient().send(new CreateDBClusterCommand$1({
25727
+ const response = await this.getCreateClient().send(new CreateDBClusterCommand$1({
25446
25728
  DBClusterIdentifier: dbClusterIdentifier,
25447
25729
  Engine: "docdb",
25448
25730
  EngineVersion: properties["EngineVersion"],
@@ -25588,7 +25870,7 @@ var DocDBProvider = class {
25588
25870
  });
25589
25871
  let instanceCreated = false;
25590
25872
  try {
25591
- const response = await this.getClient().send(new CreateDBInstanceCommand$1({
25873
+ const response = await this.getCreateClient().send(new CreateDBInstanceCommand$1({
25592
25874
  DBInstanceIdentifier: dbInstanceIdentifier,
25593
25875
  DBInstanceClass: properties["DBInstanceClass"],
25594
25876
  Engine: "docdb",
@@ -25816,6 +26098,7 @@ var DocDBProvider = class {
25816
26098
  //#region src/provisioning/providers/docdb-subnet-group-provider.ts
25817
26099
  var DocDBSubnetGroupProvider = class {
25818
26100
  docdbClient;
26101
+ createClient;
25819
26102
  providerRegion = ambientRegion();
25820
26103
  logger = getLogger().child("DocDBSubnetGroupProvider");
25821
26104
  handledProperties = /* @__PURE__ */ new Map([["AWS::DocDB::DBSubnetGroup", /* @__PURE__ */ new Set([
@@ -25825,12 +26108,22 @@ var DocDBSubnetGroupProvider = class {
25825
26108
  "Tags"
25826
26109
  ])]]);
25827
26110
  getClient() {
25828
- if (!this.docdbClient) this.docdbClient = new DocDBClient({
25829
- ...ambientClientDefaults(),
25830
- ...this.providerRegion ? { region: this.providerRegion } : {}
25831
- });
26111
+ if (!this.docdbClient) {
26112
+ this.docdbClient = new DocDBClient({
26113
+ ...ambientClientDefaults(),
26114
+ ...this.providerRegion ? { region: this.providerRegion } : {}
26115
+ });
26116
+ this.createClient = withoutServerErrorRetries(new DocDBClient({
26117
+ ...ambientClientDefaults(),
26118
+ ...this.providerRegion ? { region: this.providerRegion } : {}
26119
+ }));
26120
+ }
25832
26121
  return this.docdbClient;
25833
26122
  }
26123
+ getCreateClient() {
26124
+ this.getClient();
26125
+ return this.createClient;
26126
+ }
25834
26127
  assertType(resourceType, logicalId, physicalId) {
25835
26128
  if (resourceType !== "AWS::DocDB::DBSubnetGroup") throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
25836
26129
  }
@@ -25843,7 +26136,7 @@ var DocDBSubnetGroupProvider = class {
25843
26136
  lowercase: true
25844
26137
  });
25845
26138
  try {
25846
- await this.getClient().send(new CreateDBSubnetGroupCommand$1({
26139
+ await this.getCreateClient().send(new CreateDBSubnetGroupCommand$1({
25847
26140
  DBSubnetGroupName: dbSubnetGroupName,
25848
26141
  DBSubnetGroupDescription: properties["DBSubnetGroupDescription"] || `Subnet group for ${logicalId}`,
25849
26142
  SubnetIds: properties["SubnetIds"],
@@ -27176,6 +27469,7 @@ function collectSdkUnsupportedRuleKeys(value, found) {
27176
27469
  }
27177
27470
  var WAFv2WebACLProvider = class {
27178
27471
  wafv2Client;
27472
+ createClient;
27179
27473
  providerRegion = ambientRegion();
27180
27474
  logger = getLogger().child("WAFv2WebACLProvider");
27181
27475
  handledProperties = /* @__PURE__ */ new Map([["AWS::WAFv2::WebACL", /* @__PURE__ */ new Set([
@@ -27193,12 +27487,22 @@ var WAFv2WebACLProvider = class {
27193
27487
  "AssociationConfig"
27194
27488
  ])]]);
27195
27489
  getClient() {
27196
- if (!this.wafv2Client) this.wafv2Client = new WAFV2Client({
27197
- ...ambientClientDefaults(),
27198
- ...this.providerRegion ? { region: this.providerRegion } : {}
27199
- });
27490
+ if (!this.wafv2Client) {
27491
+ this.wafv2Client = new WAFV2Client({
27492
+ ...ambientClientDefaults(),
27493
+ ...this.providerRegion ? { region: this.providerRegion } : {}
27494
+ });
27495
+ this.createClient = withoutServerErrorRetries(new WAFV2Client({
27496
+ ...ambientClientDefaults(),
27497
+ ...this.providerRegion ? { region: this.providerRegion } : {}
27498
+ }));
27499
+ }
27200
27500
  return this.wafv2Client;
27201
27501
  }
27502
+ getCreateClient() {
27503
+ this.getClient();
27504
+ return this.createClient;
27505
+ }
27202
27506
  async create(logicalId, resourceType, properties, context) {
27203
27507
  this.logger.debug(`Creating WAFv2 WebACL ${logicalId}`);
27204
27508
  const desiredTags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
@@ -27210,7 +27514,7 @@ var WAFv2WebACLProvider = class {
27210
27514
  Key: tag.Key,
27211
27515
  Value: tag.Value
27212
27516
  }));
27213
- const summary = (await this.getClient().send(new CreateWebACLCommand({
27517
+ const summary = (await this.getCreateClient().send(new CreateWebACLCommand({
27214
27518
  Name: name,
27215
27519
  Scope: scope,
27216
27520
  DefaultAction: properties["DefaultAction"],
@@ -28392,6 +28696,7 @@ var CognitoUserPoolProvider = class {
28392
28696
  const CACHE_DELETE_WAIT_MS = Math.max(6e5, slowCcOperationTimeoutMs("AWS::ElastiCache::CacheCluster", "DELETE"));
28393
28697
  var ElastiCacheProvider = class {
28394
28698
  client;
28699
+ createClient;
28395
28700
  providerRegion = ambientRegion();
28396
28701
  logger = getLogger().child("ElastiCacheProvider");
28397
28702
  removalDefaults = /* @__PURE__ */ new Map([["AWS::ElastiCache::CacheCluster", /* @__PURE__ */ new Map([["AutoMinorVersionUpgrade", true]])]]);
@@ -28428,12 +28733,22 @@ var ElastiCacheProvider = class {
28428
28733
  ])]]);
28429
28734
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::ElastiCache::CacheCluster", /* @__PURE__ */ new Map([["CacheSecurityGroupNames", "EC2-Classic-only — use VpcSecurityGroupIds for VPC-deployed clusters (EC2-Classic retired 2022-08-15)"]])]]);
28430
28735
  getClient() {
28431
- if (!this.client) this.client = new ElastiCacheClient({
28432
- ...ambientClientDefaults(),
28433
- ...this.providerRegion ? { region: this.providerRegion } : {}
28434
- });
28736
+ if (!this.client) {
28737
+ this.client = new ElastiCacheClient({
28738
+ ...ambientClientDefaults(),
28739
+ ...this.providerRegion ? { region: this.providerRegion } : {}
28740
+ });
28741
+ this.createClient = withoutServerErrorRetries(new ElastiCacheClient({
28742
+ ...ambientClientDefaults(),
28743
+ ...this.providerRegion ? { region: this.providerRegion } : {}
28744
+ }));
28745
+ }
28435
28746
  return this.client;
28436
28747
  }
28748
+ getCreateClient() {
28749
+ this.getClient();
28750
+ return this.createClient;
28751
+ }
28437
28752
  async create(logicalId, resourceType, properties) {
28438
28753
  switch (resourceType) {
28439
28754
  case "AWS::ElastiCache::SubnetGroup": return this.createSubnetGroup(logicalId, resourceType, properties);
@@ -28464,7 +28779,7 @@ var ElastiCacheProvider = class {
28464
28779
  lowercase: true
28465
28780
  });
28466
28781
  try {
28467
- await this.getClient().send(new CreateCacheSubnetGroupCommand({
28782
+ await this.getCreateClient().send(new CreateCacheSubnetGroupCommand({
28468
28783
  CacheSubnetGroupName: cacheSubnetGroupName,
28469
28784
  CacheSubnetGroupDescription: properties["Description"] ?? properties["CacheSubnetGroupDescription"] ?? `Subnet group for ${logicalId}`,
28470
28785
  SubnetIds: properties["SubnetIds"],
@@ -28532,7 +28847,7 @@ var ElastiCacheProvider = class {
28532
28847
  });
28533
28848
  let clusterCreated = false;
28534
28849
  try {
28535
- await this.getClient().send(new CreateCacheClusterCommand({
28850
+ await this.getCreateClient().send(new CreateCacheClusterCommand({
28536
28851
  CacheClusterId: cacheClusterId,
28537
28852
  Engine: properties["Engine"],
28538
28853
  CacheNodeType: properties["CacheNodeType"],
@@ -33983,6 +34298,7 @@ function removableRecorded(kind, items) {
33983
34298
  }
33984
34299
  var BudgetsBudgetProvider = class {
33985
34300
  client;
34301
+ createClient;
33986
34302
  providerRegion = ambientRegion();
33987
34303
  logger = getLogger().child("BudgetsBudgetProvider");
33988
34304
  accountIdPromise;
@@ -33992,12 +34308,26 @@ var BudgetsBudgetProvider = class {
33992
34308
  "ResourceTags"
33993
34309
  ])]]);
33994
34310
  getClient() {
33995
- if (!this.client) this.client = new BudgetsClient({
33996
- ...ambientClientDefaults(),
33997
- ...this.providerRegion ? { region: this.providerRegion } : {}
33998
- });
34311
+ if (!this.client) {
34312
+ this.client = new BudgetsClient({
34313
+ ...ambientClientDefaults(),
34314
+ ...this.providerRegion ? { region: this.providerRegion } : {}
34315
+ });
34316
+ this.createClient = withoutServerErrorRetries(new BudgetsClient({
34317
+ ...ambientClientDefaults(),
34318
+ ...this.providerRegion ? { region: this.providerRegion } : {}
34319
+ }));
34320
+ }
33999
34321
  return this.client;
34000
34322
  }
34323
+ wrapBudgetError(mask, error, verb, logicalId, resourceType, physicalId) {
34324
+ const cause = error instanceof Error ? error : void 0;
34325
+ return wrapMaskedAwsError(mask, error, (text) => new ProvisioningError(`Failed to ${verb} budget ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
34326
+ }
34327
+ getCreateClient() {
34328
+ this.getClient();
34329
+ return this.createClient;
34330
+ }
34001
34331
  resolveAccountId() {
34002
34332
  if (!this.accountIdPromise) this.accountIdPromise = (async () => {
34003
34333
  try {
@@ -34118,7 +34448,7 @@ var BudgetsBudgetProvider = class {
34118
34448
  const notifications = this.toSdkNotificationsWithSubscribers(lists.NotificationsWithSubscribers);
34119
34449
  const resourceTags = this.toSdkResourceTags(lists.ResourceTags);
34120
34450
  const arn = await this.budgetArn(accountId, name);
34121
- await this.getClient().send(new CreateBudgetCommand({
34451
+ await this.getCreateClient().send(new CreateBudgetCommand({
34122
34452
  AccountId: accountId,
34123
34453
  Budget: this.toSdkBudget(properties["Budget"], name, logicalId, resourceType, mask),
34124
34454
  ...notifications.length > 0 && { NotificationsWithSubscribers: notifications },
@@ -34131,8 +34461,7 @@ var BudgetsBudgetProvider = class {
34131
34461
  };
34132
34462
  } catch (error) {
34133
34463
  if (error instanceof ProvisioningError) throw error;
34134
- const cause = error instanceof Error ? error : void 0;
34135
- throw new ProvisioningError(`Failed to create budget ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
34464
+ throw this.wrapBudgetError(mask, error, "create", logicalId, resourceType, void 0);
34136
34465
  }
34137
34466
  }
34138
34467
  async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
@@ -34177,8 +34506,7 @@ var BudgetsBudgetProvider = class {
34177
34506
  };
34178
34507
  } catch (error) {
34179
34508
  if (error instanceof ProvisioningError) throw error;
34180
- const cause = error instanceof Error ? error : void 0;
34181
- throw new ProvisioningError(`Failed to update budget ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
34509
+ throw this.wrapBudgetError(mask, error, "update", logicalId, resourceType, physicalId);
34182
34510
  }
34183
34511
  }
34184
34512
  readDesiredLists(logicalId, resourceType, values, physicalId) {
@@ -34808,6 +35136,22 @@ var KinesisStreamProvider = class {
34808
35136
  if (journaledArn === void 0) return "different";
34809
35137
  return journaledArn === recordArn ? "same" : "different";
34810
35138
  }
35139
+ async resourceIdentity(physicalId, _resourceType, context) {
35140
+ if (!isStreamName(physicalId)) return void 0;
35141
+ if (await this.getClient().config.region() !== context.expectedRegion) return void 0;
35142
+ let response;
35143
+ try {
35144
+ response = await this.getClient().send(new DescribeStreamSummaryCommand({ StreamName: physicalId }));
35145
+ } catch (error) {
35146
+ if (error instanceof ResourceNotFoundException$10) return RESOURCE_NOT_FOUND;
35147
+ throw error;
35148
+ }
35149
+ const arn = response.StreamDescriptionSummary?.StreamARN;
35150
+ const created = response.StreamDescriptionSummary?.StreamCreationTimestamp;
35151
+ if (typeof arn !== "string" || arn === "") return void 0;
35152
+ if (!(created instanceof Date) || Number.isNaN(created.getTime())) return void 0;
35153
+ return `${arn}@${created.getTime()}`;
35154
+ }
34811
35155
  async readStreamArnIfExists(streamName) {
34812
35156
  let response;
34813
35157
  try {
@@ -36160,6 +36504,7 @@ function sameRootDirectory(requested, described) {
36160
36504
  }
36161
36505
  var EFSProvider = class {
36162
36506
  client;
36507
+ mountTargetCreateClient;
36163
36508
  providerRegion = ambientRegion();
36164
36509
  logger = getLogger().child("EFSProvider");
36165
36510
  unconfirmedCreationTokens = /* @__PURE__ */ new Map();
@@ -36192,12 +36537,22 @@ var EFSProvider = class {
36192
36537
  ]);
36193
36538
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::EFS::FileSystem", /* @__PURE__ */ new Map([["ReplicationConfiguration", "Cross-region EFS replication (CreateReplicationConfiguration) provisions a separate destination file system in another region with its own lifecycle, KMS key, and availability-zone placement; replicating + then tearing down the destination on destroy is a multi-resource, cross-region orchestration that is out of scope for the single-resource SDK provider. Tracked as a follow-up to issue #609."]])], ["AWS::EFS::AccessPoint", /* @__PURE__ */ new Map([["ClientToken", "cdkd supplies its own retry-stable ClientToken on CreateAccessPoint (issues #2039 and #2080), so a template-supplied value would be overwritten. The SDK does not own this field either: measured against @aws-sdk/client-efs 3.1018.0, an omitted ClientToken is auto-filled with a FRESH uuid per attempt, which leaves a retried 500 free to mint a second access point, while a caller-supplied value goes on the wire verbatim."]])]]);
36194
36539
  getClient() {
36195
- if (!this.client) this.client = new EFSClient({
36196
- ...ambientClientDefaults(),
36197
- ...this.providerRegion ? { region: this.providerRegion } : {}
36198
- });
36540
+ if (!this.client) {
36541
+ this.client = new EFSClient({
36542
+ ...ambientClientDefaults(),
36543
+ ...this.providerRegion ? { region: this.providerRegion } : {}
36544
+ });
36545
+ this.mountTargetCreateClient = withoutServerErrorRetries(new EFSClient({
36546
+ ...ambientClientDefaults(),
36547
+ ...this.providerRegion ? { region: this.providerRegion } : {}
36548
+ }));
36549
+ }
36199
36550
  return this.client;
36200
36551
  }
36552
+ getMountTargetCreateClient() {
36553
+ this.getClient();
36554
+ return this.mountTargetCreateClient;
36555
+ }
36201
36556
  wrapMaskedError(mask, error, build) {
36202
36557
  return wrapMaskedAwsError(mask, error, build);
36203
36558
  }
@@ -36527,7 +36882,7 @@ var EFSProvider = class {
36527
36882
  const securityGroups = properties["SecurityGroups"];
36528
36883
  let createdMountTargetId;
36529
36884
  try {
36530
- const mountTargetId = (await this.getClient().send(new CreateMountTargetCommand({
36885
+ const mountTargetId = (await this.getMountTargetCreateClient().send(new CreateMountTargetCommand({
36531
36886
  FileSystemId: fileSystemId,
36532
36887
  SubnetId: subnetId,
36533
36888
  SecurityGroups: securityGroups
@@ -36870,6 +37225,8 @@ var EFSProvider = class {
36870
37225
  //#region src/provisioning/providers/fsx-filesystem-provider.ts
36871
37226
  const DEFAULT_MAX_WAIT_MS$3 = 36e5;
36872
37227
  const DEFAULT_POLL_INTERVAL_MS$3 = 15e3;
37228
+ const FILE_SYSTEM_ID_PATTERN = /^fs-[0-9a-f]+$/;
37229
+ const FILE_SYSTEM_NOT_LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["DELETING", "FAILED"]);
36873
37230
  const LUSTRE_MUTABLE_SUBPROPS = /* @__PURE__ */ new Set([
36874
37231
  "WeeklyMaintenanceStartTime",
36875
37232
  "DailyAutomaticBackupStartTime",
@@ -37522,7 +37879,8 @@ var FSxFileSystemProvider = class {
37522
37879
  if (error instanceof FileSystemNotFound$1) {
37523
37880
  const clientRegion = await this.getClient().config.region();
37524
37881
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
37525
- this.logger.debug(`FSx FileSystem ${physicalId} does not exist, skipping deletion`);
37882
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` FSx file system ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
37883
+ else this.logger.debug(`FSx FileSystem ${physicalId} does not exist, skipping deletion`);
37526
37884
  return;
37527
37885
  }
37528
37886
  const cause = error instanceof Error ? error : void 0;
@@ -37531,6 +37889,30 @@ var FSxFileSystemProvider = class {
37531
37889
  await this.waitForFileSystemDeleted(physicalId, logicalId, resourceType);
37532
37890
  this.logger.debug(`Successfully deleted FSx FileSystem ${logicalId}`);
37533
37891
  }
37892
+ async isSameResource(journaledPhysicalId, record, resourceType, context) {
37893
+ if (resourceType !== "AWS::FSx::FileSystem") return "unknown";
37894
+ if (!FILE_SYSTEM_ID_PATTERN.test(journaledPhysicalId) || !FILE_SYSTEM_ID_PATTERN.test(record.physicalId)) return "unknown";
37895
+ if (journaledPhysicalId === record.physicalId) return "same";
37896
+ if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
37897
+ const recordRead = await this.readFileSystemForIdentity(record.physicalId);
37898
+ if (recordRead === void 0 || recordRead.id !== record.physicalId || FILE_SYSTEM_NOT_LIVE_LIFECYCLES.has(recordRead.lifecycle ?? "")) return "unknown";
37899
+ return (await this.readFileSystemForIdentity(journaledPhysicalId))?.id === record.physicalId ? "same" : "different";
37900
+ }
37901
+ async readFileSystemForIdentity(fileSystemId) {
37902
+ let response;
37903
+ try {
37904
+ response = await this.getClient().send(new DescribeFileSystemsCommand$1({ FileSystemIds: [fileSystemId] }));
37905
+ } catch (error) {
37906
+ if (error instanceof FileSystemNotFound$1) return void 0;
37907
+ throw error;
37908
+ }
37909
+ const fileSystems = response.FileSystems ?? [];
37910
+ if (fileSystems.length !== 1 || typeof fileSystems[0]?.FileSystemId !== "string") throw new Error("DescribeFileSystems did not return exactly the file system asked for");
37911
+ return {
37912
+ id: fileSystems[0].FileSystemId,
37913
+ lifecycle: fileSystems[0].Lifecycle
37914
+ };
37915
+ }
37534
37916
  async describeForPoll(fileSystemId, transientState, maxConsecutiveTransient = 5) {
37535
37917
  try {
37536
37918
  const response = await this.getClient().send(new DescribeFileSystemsCommand$1({ FileSystemIds: [fileSystemId] }));
@@ -37907,6 +38289,7 @@ const LIVE_CLUSTER_STATES = [
37907
38289
  "RUNNING",
37908
38290
  "WAITING"
37909
38291
  ];
38292
+ const CLUSTER_ID_PATTERN = /^j-[0-9A-Z]+$/;
37910
38293
  const runJobFlowLatch = new AmbiguousCreateLatch("emr:RunJobFlow");
37911
38294
  const clustersCreatedByThisProcess = new RecentIdSet();
37912
38295
  function emrClusterProtectionSite(physicalId, region) {
@@ -38345,7 +38728,8 @@ var EMRClusterProvider = class {
38345
38728
  if (error instanceof InvalidRequestException) {
38346
38729
  const clientRegion = await this.getClient().config.region();
38347
38730
  assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
38348
- this.logger.debug(`EMR Cluster ${physicalId} does not exist, skipping deletion`);
38731
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` EMR cluster ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
38732
+ else this.logger.debug(`EMR Cluster ${physicalId} does not exist, skipping deletion`);
38349
38733
  return;
38350
38734
  }
38351
38735
  const cause = error instanceof Error ? error : void 0;
@@ -38353,7 +38737,8 @@ var EMRClusterProvider = class {
38353
38737
  }
38354
38738
  const currentState = current?.Status?.State;
38355
38739
  if (currentState && TERMINAL_STATES.has(currentState)) {
38356
- this.logger.debug(`EMR Cluster ${physicalId} already ${currentState}, skipping deletion`);
38740
+ if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` EMR cluster ${physicalId} (${logicalId}), which a failed deploy created, is already ${currentState}; nothing to delete`);
38741
+ else this.logger.debug(`EMR Cluster ${physicalId} already ${currentState}, skipping deletion`);
38357
38742
  return;
38358
38743
  }
38359
38744
  try {
@@ -38454,6 +38839,27 @@ var EMRClusterProvider = class {
38454
38839
  default: return;
38455
38840
  }
38456
38841
  }
38842
+ async isSameResource(journaledPhysicalId, record, resourceType, context) {
38843
+ if (resourceType !== "AWS::EMR::Cluster") return "unknown";
38844
+ if (!CLUSTER_ID_PATTERN.test(journaledPhysicalId) || !CLUSTER_ID_PATTERN.test(record.physicalId)) return "unknown";
38845
+ if (journaledPhysicalId === record.physicalId) return "same";
38846
+ if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
38847
+ const recorded = await this.readClusterIdentity(record.physicalId);
38848
+ if (recorded?.id !== record.physicalId) return "unknown";
38849
+ return (await this.readClusterIdentity(journaledPhysicalId))?.id === recorded.id ? "same" : "different";
38850
+ }
38851
+ async readClusterIdentity(clusterId) {
38852
+ let response;
38853
+ try {
38854
+ response = await this.getClient().send(new DescribeClusterCommand({ ClusterId: clusterId }));
38855
+ } catch (error) {
38856
+ if (error instanceof InvalidRequestException) return void 0;
38857
+ throw error;
38858
+ }
38859
+ const id = response.Cluster?.Id;
38860
+ if (typeof id !== "string") throw new Error("DescribeCluster did not return the cluster asked for");
38861
+ return { id };
38862
+ }
38457
38863
  async import(input) {
38458
38864
  const explicit = resolveExplicitPhysicalId(input, null);
38459
38865
  if (explicit) {
@@ -40424,6 +40830,7 @@ var CloudTrailProvider = class {
40424
40830
  //#region src/provisioning/providers/codebuild-provider.ts
40425
40831
  var CodeBuildProvider = class {
40426
40832
  client;
40833
+ createClient;
40427
40834
  providerRegion = ambientRegion();
40428
40835
  logger = getLogger().child("CodeBuildProvider");
40429
40836
  disableCcApiFallback = true;
@@ -40452,12 +40859,22 @@ var CodeBuildProvider = class {
40452
40859
  "AutoRetryLimit"
40453
40860
  ])]]);
40454
40861
  getClient() {
40455
- if (!this.client) this.client = new CodeBuildClient({
40456
- ...ambientClientDefaults(),
40457
- ...this.providerRegion ? { region: this.providerRegion } : {}
40458
- });
40862
+ if (!this.client) {
40863
+ this.client = new CodeBuildClient({
40864
+ ...ambientClientDefaults(),
40865
+ ...this.providerRegion ? { region: this.providerRegion } : {}
40866
+ });
40867
+ this.createClient = withoutServerErrorRetries(new CodeBuildClient({
40868
+ ...ambientClientDefaults(),
40869
+ ...this.providerRegion ? { region: this.providerRegion } : {}
40870
+ }));
40871
+ }
40459
40872
  return this.client;
40460
40873
  }
40874
+ getCreateClient() {
40875
+ this.getClient();
40876
+ return this.createClient;
40877
+ }
40461
40878
  mapSource(source, containerPath) {
40462
40879
  if (source == null) return { type: "NO_SOURCE" };
40463
40880
  let buildspec;
@@ -40632,7 +41049,7 @@ var CodeBuildProvider = class {
40632
41049
  this.logger.debug(`Creating CodeBuild Project ${logicalId}`);
40633
41050
  try {
40634
41051
  const input = this.mapProperties(logicalId, properties);
40635
- const result = await this.getClient().send(new CreateProjectCommand(input));
41052
+ const result = await this.getCreateClient().send(new CreateProjectCommand(input));
40636
41053
  const projectName = result.project.name;
40637
41054
  const projectArn = result.project.arn;
40638
41055
  this.logger.debug(`Successfully created CodeBuild Project ${logicalId}: ${projectName}`);
@@ -43299,6 +43716,7 @@ var NestedStackProvider = class {
43299
43716
  parameters: childParameters,
43300
43717
  ...inheritedSecrets && hasMaskableValues(inheritedSecrets) && { inheritedSecrets },
43301
43718
  ...passedClasses && { passedParameterClasses: passedClasses },
43719
+ passedNoEchoParameters: passedNoEchoParametersOf(inheritedSecrets),
43302
43720
  inheritedProducerRegions: getCurrentProducerRegions(),
43303
43721
  parentStackInfo: {
43304
43722
  parentStack: parentCtx.parentStackName,
@@ -43805,4 +44223,4 @@ var ACMCertificateProvider = class {
43805
44223
 
43806
44224
  //#endregion
43807
44225
  export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppSyncProvider, BudgetsBudgetProvider, CloudFrontDistributionProvider, CloudFrontOACProvider, CloudFrontOAIProvider, CloudTrailProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, CodeBuildProvider, CodeCommitRepositoryProvider, CognitoUserPoolProvider, DLMLifecyclePolicyProvider, DocDBProvider, DocDBSubnetGroupProvider, DynamoDBGlobalTableProvider, DynamoDBTableProvider, EC2Provider, ECRProvider, ECSProvider, EFSProvider, ELBv2Provider, EMRClusterProvider, EMRInstanceFleetConfigProvider, EMRInstanceGroupConfigProvider, ElastiCacheProvider, EventBridgeBusProvider, EventBridgeRuleProvider, FSxFileSystemProvider, FirehoseProvider, GlueConnectionProvider, GlueCrawlerProvider, GlueJobProvider, GlueProvider, GlueSecurityConfigurationProvider, GlueTriggerProvider, GlueWorkflowProvider, IAMAccessKeyProvider, IAMInstanceProfileProvider, IAMManagedPolicyProvider, IAMPolicyProvider, IAMRoleProvider, IAMUserGroupProvider, KMSProvider, KinesisStreamConsumerProvider, KinesisStreamProvider, LambdaEventInvokeConfigProvider, LambdaEventSourceMappingProvider, LambdaFunctionProvider, LambdaLayerVersionProvider, LambdaMicrovmImageProvider, LambdaPermissionProvider, LambdaUrlProvider, LogsLogGroupProvider, NeptuneProvider, NestedStackProvider, PipesPipeProvider, RDSDBProxyEndpointProvider, RDSDBProxyProvider, RDSDBProxyTargetGroupProvider, RDSProvider, Route53Provider, S3BucketPolicyProvider, S3BucketProvider, S3DirectoryBucketProvider, S3TablesProvider, S3VectorsProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, SNSTopicProvider, SQSQueuePolicyProvider, SQSQueueProvider, SSMParameterProvider, SchedulerScheduleProvider, SecretsManagerSecretProvider, ServiceDiscoveryProvider, StepFunctionsProvider, WAFv2WebACLProvider, WaitConditionHandleProvider };
43808
- //# sourceMappingURL=provider-classes-4lVceW9g.js.map
44226
+ //# sourceMappingURL=provider-classes-hW6X0dKh.js.map