@go-to-k/cdkd 0.281.26 → 0.281.28
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.
- package/dist/{asg-provider-II3TmZ4t.js → asg-provider-CPA-dc1x.js} +2 -2
- package/dist/{asg-provider-II3TmZ4t.js.map → asg-provider-CPA-dc1x.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/{deploy-engine-XC8HOR51.js → deploy-engine-DnvhlIW5.js} +154 -26
- package/dist/deploy-engine-DnvhlIW5.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-XC8HOR51.js.map +0 -1
|
@@ -1054,6 +1054,25 @@ function resetAwsClients() {
|
|
|
1054
1054
|
*/
|
|
1055
1055
|
const cache = /* @__PURE__ */ new Map();
|
|
1056
1056
|
/**
|
|
1057
|
+
* Read an S3 client's resolved region without issuing a network call.
|
|
1058
|
+
*
|
|
1059
|
+
* Used to discover what the AWS SDK's own region chain (env vars, shared
|
|
1060
|
+
* config profile) picked for a client that was constructed WITHOUT an
|
|
1061
|
+
* explicit region. Never throws — an unresolvable chain (and a hand-rolled
|
|
1062
|
+
* test double with no `config`) both degrade to `undefined` so the caller
|
|
1063
|
+
* falls through to its own default.
|
|
1064
|
+
*/
|
|
1065
|
+
async function readClientRegion(client) {
|
|
1066
|
+
try {
|
|
1067
|
+
const config = client.config;
|
|
1068
|
+
if (!config || typeof config.region !== "function") return void 0;
|
|
1069
|
+
const region = await config.region();
|
|
1070
|
+
return typeof region === "string" && region.length > 0 ? region : void 0;
|
|
1071
|
+
} catch {
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1057
1076
|
* Resolve the AWS region of an S3 bucket via `GetBucketLocation`.
|
|
1058
1077
|
*
|
|
1059
1078
|
* Why `GetBucketLocation` rather than `HeadBucket`:
|
|
@@ -1064,27 +1083,59 @@ const cache = /* @__PURE__ */ new Map();
|
|
|
1064
1083
|
* `GetBucketLocation` is a GET with an XML body and is not subject to the
|
|
1065
1084
|
* same SDK glitch.
|
|
1066
1085
|
*
|
|
1067
|
-
* Why
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1070
|
-
* the
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1086
|
+
* Why the probe is NOT pinned to us-east-1 (issue
|
|
1087
|
+
* [#1763](https://github.com/go-to-k/cdkd/issues/1763)):
|
|
1088
|
+
* `GetBucketLocation` is answered by ANY regional S3 endpoint for any
|
|
1089
|
+
* bucket in the SAME PARTITION — measured 2026-08-13 against a real
|
|
1090
|
+
* eu-west-1 bucket, which resolved identically from us-east-1 / us-west-2 /
|
|
1091
|
+
* ap-northeast-1 / eu-west-1 clients — so the probe never needs to know the
|
|
1092
|
+
* answer to ask the question. But it DOES have to reach the right
|
|
1093
|
+
* partition: a hardcoded `us-east-1` endpoint is unreachable from `aws-cn`
|
|
1094
|
+
* / `us-iso*`, so outside the commercial partition the probe could not run
|
|
1095
|
+
* at all, every call fell through to the commercial default, and every
|
|
1096
|
+
* consumer (the state backend, the lock manager, the exports index, the
|
|
1097
|
+
* custom-resource response path, `upload-cfn-template`) proceeded against
|
|
1098
|
+
* the wrong region. The probe endpoint is therefore taken from, in order:
|
|
1099
|
+
* `opts.region`, `opts.fallbackRegion`, the AWS SDK's own region chain
|
|
1100
|
+
* (env / shared config profile — the chain every other cdkd client
|
|
1101
|
+
* consults), and only then `us-east-1`. Commercial behavior is unchanged:
|
|
1102
|
+
* the resolved value is identical from any commercial endpoint, and a
|
|
1103
|
+
* caller with no region configured anywhere still probes `us-east-1`.
|
|
1104
|
+
*
|
|
1105
|
+
* A SUCCESSFUL result is cached per bucket name for the process lifetime —
|
|
1106
|
+
* bucket regions never move, so the cache never needs invalidation. A FAILED
|
|
1107
|
+
* probe is deliberately NOT cached (mirroring `write-only-properties.ts`):
|
|
1108
|
+
* the failure answer is a guess, and caching it let one transient error pin
|
|
1109
|
+
* every later caller in the process to the wrong region with no way to heal.
|
|
1074
1110
|
*
|
|
1075
1111
|
* @returns The bucket's region (e.g. `us-west-2`). An empty `LocationConstraint`
|
|
1076
|
-
* in the response means `us-east-1` (S3 quirk
|
|
1077
|
-
*
|
|
1112
|
+
* in the response means `us-east-1` (S3 quirk — non-commercial partitions
|
|
1113
|
+
* always report their region explicitly). On any error, returns
|
|
1114
|
+
* `opts.fallbackRegion` if provided, else the region the probe was aimed at.
|
|
1078
1115
|
*/
|
|
1079
1116
|
async function resolveBucketRegion(bucketName, opts = {}) {
|
|
1080
1117
|
const cached = cache.get(bucketName);
|
|
1081
1118
|
if (cached) return cached;
|
|
1119
|
+
let probeFailed = false;
|
|
1082
1120
|
const promise = (async () => {
|
|
1083
|
-
const
|
|
1084
|
-
region: "us-east-1",
|
|
1121
|
+
const auth = {
|
|
1085
1122
|
...opts.profile && { profile: opts.profile },
|
|
1086
1123
|
...opts.credentials && { credentials: opts.credentials }
|
|
1124
|
+
};
|
|
1125
|
+
const explicitRegion = opts.region ?? opts.fallbackRegion;
|
|
1126
|
+
let client = new S3Client({
|
|
1127
|
+
...explicitRegion && { region: explicitRegion },
|
|
1128
|
+
...auth
|
|
1087
1129
|
});
|
|
1130
|
+
let probeRegion = explicitRegion ?? await readClientRegion(client);
|
|
1131
|
+
if (!probeRegion) {
|
|
1132
|
+
client.destroy();
|
|
1133
|
+
probeRegion = "us-east-1";
|
|
1134
|
+
client = new S3Client({
|
|
1135
|
+
region: probeRegion,
|
|
1136
|
+
...auth
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1088
1139
|
try {
|
|
1089
1140
|
const { expectedOwnerParam } = await Promise.resolve().then(() => expected_bucket_owner_exports);
|
|
1090
1141
|
return (await client.send(new GetBucketLocationCommand({
|
|
@@ -1092,13 +1143,16 @@ async function resolveBucketRegion(bucketName, opts = {}) {
|
|
|
1092
1143
|
...await expectedOwnerParam(client)
|
|
1093
1144
|
}))).LocationConstraint || "us-east-1";
|
|
1094
1145
|
} catch {
|
|
1095
|
-
|
|
1146
|
+
probeFailed = true;
|
|
1147
|
+
return opts.fallbackRegion ?? probeRegion;
|
|
1096
1148
|
} finally {
|
|
1097
1149
|
client.destroy();
|
|
1098
1150
|
}
|
|
1099
1151
|
})();
|
|
1100
1152
|
cache.set(bucketName, promise);
|
|
1101
|
-
|
|
1153
|
+
const region = await promise;
|
|
1154
|
+
if (probeFailed && cache.get(bucketName) === promise) cache.delete(bucketName);
|
|
1155
|
+
return region;
|
|
1102
1156
|
}
|
|
1103
1157
|
/**
|
|
1104
1158
|
* Clear the per-bucket region cache. Used by tests to reset state between
|
|
@@ -2441,25 +2495,99 @@ function collectFnTransformNames(value, seen, out) {
|
|
|
2441
2495
|
* already in hand, since it needs no STS round trip.
|
|
2442
2496
|
*/
|
|
2443
2497
|
/**
|
|
2444
|
-
*
|
|
2445
|
-
*
|
|
2498
|
+
* Region prefix -> `{partition, urlSuffix}`, in match order.
|
|
2499
|
+
*
|
|
2500
|
+
* Exported so a caller needing the WHOLE mapping — rather than one region's
|
|
2501
|
+
* answer — can read it here instead of hand-maintaining a parallel list that
|
|
2502
|
+
* silently goes stale when a partition is added (issue #1785 couples `cdkd
|
|
2503
|
+
* gc`'s suffix list to this table for exactly that reason).
|
|
2504
|
+
*
|
|
2505
|
+
* Every row is VERIFIED against AWS-authored partition data rather than taken
|
|
2506
|
+
* from documentation prose (issue #1764 shipped the last three, and the issue
|
|
2507
|
+
* explicitly asked for confirmation rather than trust). Three independent
|
|
2508
|
+
* AWS-authored sources agree on every row, prefix AND suffix:
|
|
2509
|
+
*
|
|
2510
|
+
* 1. `@aws-sdk/util-endpoints`'s vendored `lib/aws/partitions.json` (the copy
|
|
2511
|
+
* in this repo's own `node_modules`) — each row's `regionRegex` +
|
|
2512
|
+
* `outputs.dnsSuffix`.
|
|
2513
|
+
* 2. botocore's `endpoints.json`, as shipped inside the official AWS CLI v2 —
|
|
2514
|
+
* each row's `regionRegex` + `dnsSuffix`.
|
|
2515
|
+
* 3. `aws-cdk-lib`'s `region-info` `PARTITION_MAP` — each row's prefix +
|
|
2516
|
+
* `domainSuffix`.
|
|
2517
|
+
*
|
|
2518
|
+
* Two things the sources settle that are easy to get wrong:
|
|
2519
|
+
*
|
|
2520
|
+
* - `aws-us-gov`'s suffix really IS the commercial `amazonaws.com`; GovCloud
|
|
2521
|
+
* is the one non-commercial partition that does not have its own DNS suffix.
|
|
2522
|
+
* - Each partition is named by exactly ONE region prefix upstream, so this
|
|
2523
|
+
* table needs no per-partition prefix list.
|
|
2524
|
+
*
|
|
2525
|
+
* Match ORDER is only load-bearing to the extent that no prefix here is a
|
|
2526
|
+
* prefix of another — `us-iso-` cannot swallow `us-isob-` / `us-isof-` because
|
|
2527
|
+
* of its trailing hyphen. A row whose prefix nests inside an earlier one would
|
|
2528
|
+
* be unreachable, so keep that invariant (it is pinned by a unit test).
|
|
2529
|
+
*
|
|
2530
|
+
* The one deliberate divergence from upstream is `eusc-`: the SDK / botocore
|
|
2531
|
+
* regex is `^eusc\-(de)\-\w+\-\d+$` and CDK pins the prefix `eusc-de-`, i.e.
|
|
2532
|
+
* both are scoped to today's single European Sovereign Cloud country. cdkd
|
|
2533
|
+
* matches on the broader `eusc-` because the failure directions are not
|
|
2534
|
+
* symmetric — a future `eusc-<cc>-…` region falling through to commercial is
|
|
2535
|
+
* the exact bug this table was widened to fix, while a false match is
|
|
2536
|
+
* impossible: no other partition's regions begin with `eusc-`.
|
|
2446
2537
|
*/
|
|
2447
|
-
|
|
2448
|
-
|
|
2538
|
+
const PARTITION_TABLE = [
|
|
2539
|
+
{
|
|
2540
|
+
prefix: "cn-",
|
|
2449
2541
|
partition: "aws-cn",
|
|
2450
2542
|
urlSuffix: "amazonaws.com.cn"
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2543
|
+
},
|
|
2544
|
+
{
|
|
2545
|
+
prefix: "us-gov-",
|
|
2453
2546
|
partition: "aws-us-gov",
|
|
2454
2547
|
urlSuffix: "amazonaws.com"
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2548
|
+
},
|
|
2549
|
+
{
|
|
2550
|
+
prefix: "us-iso-",
|
|
2457
2551
|
partition: "aws-iso",
|
|
2458
2552
|
urlSuffix: "c2s.ic.gov"
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2553
|
+
},
|
|
2554
|
+
{
|
|
2555
|
+
prefix: "us-isob-",
|
|
2461
2556
|
partition: "aws-iso-b",
|
|
2462
2557
|
urlSuffix: "sc2s.sgov.gov"
|
|
2558
|
+
},
|
|
2559
|
+
{
|
|
2560
|
+
prefix: "us-isof-",
|
|
2561
|
+
partition: "aws-iso-f",
|
|
2562
|
+
urlSuffix: "csp.hci.ic.gov"
|
|
2563
|
+
},
|
|
2564
|
+
{
|
|
2565
|
+
prefix: "eu-isoe-",
|
|
2566
|
+
partition: "aws-iso-e",
|
|
2567
|
+
urlSuffix: "cloud.adc-e.uk"
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
prefix: "eusc-",
|
|
2571
|
+
partition: "aws-eusc",
|
|
2572
|
+
urlSuffix: "amazonaws.eu"
|
|
2573
|
+
}
|
|
2574
|
+
];
|
|
2575
|
+
/**
|
|
2576
|
+
* Derive the AWS partition / URL suffix for an AWS region. Same mapping
|
|
2577
|
+
* CloudFormation applies to `${AWS::Partition}` / `${AWS::URLSuffix}`.
|
|
2578
|
+
*
|
|
2579
|
+
* An unrecognized region resolves to the commercial partition. That fallback
|
|
2580
|
+
* is deliberate (a brand-new commercial region must keep working before this
|
|
2581
|
+
* table hears about it), but it is also what made the pre-#1764 gap quiet: a
|
|
2582
|
+
* genuine registry host in a partition missing from the table came back with
|
|
2583
|
+
* the COMMERCIAL suffix, so `parseEcrRegistryHost` (`src/utils/ecr-uri.ts`)
|
|
2584
|
+
* rejected it under the strict host check issue #1758 added and the image was
|
|
2585
|
+
* classified `public` — anonymous pull, no `docker login`, opaque failure.
|
|
2586
|
+
*/
|
|
2587
|
+
function derivePartitionAndUrlSuffix(region) {
|
|
2588
|
+
for (const { prefix, partition, urlSuffix } of PARTITION_TABLE) if (region.startsWith(prefix)) return {
|
|
2589
|
+
partition,
|
|
2590
|
+
urlSuffix
|
|
2463
2591
|
};
|
|
2464
2592
|
return {
|
|
2465
2593
|
partition: "aws",
|
|
@@ -13513,7 +13641,7 @@ var CloudControlProvider = class {
|
|
|
13513
13641
|
if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
|
|
13514
13642
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
13515
13643
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
13516
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
13644
|
+
const { ASGProvider } = await import("./asg-provider-CPA-dc1x.js").then((n) => n.n);
|
|
13517
13645
|
await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
|
|
13518
13646
|
return;
|
|
13519
13647
|
}
|
|
@@ -20430,7 +20558,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
20430
20558
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
20431
20559
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
20432
20560
|
function getCdkdVersion() {
|
|
20433
|
-
return "0.281.
|
|
20561
|
+
return "0.281.28";
|
|
20434
20562
|
}
|
|
20435
20563
|
/**
|
|
20436
20564
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -22599,4 +22727,4 @@ var DeployEngine = class {
|
|
|
22599
22727
|
|
|
22600
22728
|
//#endregion
|
|
22601
22729
|
export { configStringRefusal as $, MIGRATE_TMP_PREFIX as $t, green as A, SynthesisError as An, validateContainerRepoName as At, slowCcOperationTimeoutMs as B, getDefaultStateBucketName as Bt, MULTI_REGION_RECREATE_BLOCKED_TYPES as C, PartialFailureError as Cn, rewriteTemplateAssetReferences as Ct, bold as D, StackHasActiveImportsError as Dn, getBootstrapMarkerKey as Dt, formatResourceLine as E, ResourceUpdateNotSupportedError as En, ensureAssetStorage as Et, clearOnUpdateRemoval as F, __exportAll as Fn, runDockerStreaming as Ft, getAccountInfo as G, resolveSkipPrefix as Gt, isTerminationProtectionPropagationError as H, resolveApp as Ht, ProviderRegistry as I, AssetManifestLoader as It, normalizeAwsTagsToCfn as J, resolveUseCdkBootstrapAssets as Jt, refStateLookupFromResource as K, resolveStateBucketWithDefault as Kt, findActionableSilentDrops as L, getDockerImageBySourceHash as Lt, yellow as M, isCdkdError as Mn, formatDockerLoginError as Mt, IAMRoleProvider as N, normalizeAwsError as Nn, getDockerCmd as Nt, cyan as O, StackTerminationProtectionError as On, parseBootstrapMarker as Ot, collectInlinePolicyNamesManagedBySiblings as P, withErrorHandling as Pn, runDockerForeground as Pt, configBooleanRefusal as Q, CFN_TEMPLATE_URL_LIMIT as Qt, findSilentDropProperties as R, Synthesizer as Rt, extractDeploymentEventError as S, NestedStackChildDirectDestroyError as Sn, loadPublishableAssetManifest as St, renderStatefulReason as T, ResourceTimeoutError as Tn, BOOTSTRAP_MARKER_PREFIX as Tt, IntrinsicFunctionResolver as U, resolveAutoAssetStorage as Ut, disableInstanceApiTermination as V, getLegacyStateBucketName as Vt, cfnRefValueFromPhysicalId as W, resolveCaptureObservedState as Wt, assertRegionMatch as X, warnDeprecatedNoPrefixCliFlag as Xt, resolveExplicitPhysicalId as Y, stateBucketExistenceConfirmed as Yt, coerceCfnBoolean as Z, CFN_TEMPLATE_BODY_LIMIT as Zt, createPreDeleteFinalSnapshot as _, LocalInvokeBuildError as _n, AssetPublisher as _t, DeploymentEventsStore as a, processStackMessages as an, applyRoleArnIfSet as at, unsupportedFinalSnapshotError as b, LockError as bn, buildAssetRedirectMap as bt, replayFailedOperations as c, AwsClients as cn, withRetry as ct, IMPLICIT_DELETE_DEPENDENCIES as d, setAwsClients as dn, DagBuilder as dt, findLargeInlineResources as en, readConfigString as et, computeImplicitDeleteEdges as f, AssetError as fn, TemplateParser as ft, ccRoutedFinalSnapshotError as g, DeployCancelledError as gn, shouldRetainResource as gt, buildFinalSnapshotIdentifier as h, DependencyError as hn, rebuildClientForBucketRegion as ht, DeploymentEventsReader as i, AssemblyReader as in, requireConfigString as it, red as j, formatError as jn, buildDockerImage as jt, gray as k, StateError as kn, validateAssetBucketName as kt, replayRollback as l, getAwsClients as ln, isRetryableTransientError as lt, PRE_DELETE_SNAPSHOT_TYPES as m, ConfigError as mn, S3StateBackend as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, expectedOwnerParam as nn, requireConfigArray as nt, planFailedOps as o, clearBucketRegionCache as on, DiffCalculator as ot, ATOMIC_FINAL_SNAPSHOT_TYPES as p, CdkdError as pn, LockManager as pt, WAFv2WebACLProvider as q, resolveStateBucketWithDefaultAndSource as qt, DeployEngine as r, derivePartitionAndUrlSuffix as rn, requireConfigObject as rt, planRollback as s, resolveBucketRegion as sn, describeTypeWithThrottleRetry as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, uploadCfnTemplate as tn, replayWarn as tt, withResourceDeadline as u, resetAwsClients as un, isThrottlingError as ut, isFinalSnapshotError as v, LocalMigrateError as vn, stringifyValue as vt, isStatefulRecreateTargetSync as w, ProvisioningError as wn, AssetModeResolver as wt, makeCanonicalizePropertiesFn as x, MissingCdkCliError as xn, createAssetRedirectResolver as xt, refusesFinalSnapshot as y, LocalStartServiceError as yn, WorkGraph as yt, CloudControlProvider as z, synthesisStatusMessage as zt };
|
|
22602
|
-
//# sourceMappingURL=deploy-engine-
|
|
22730
|
+
//# sourceMappingURL=deploy-engine-DnvhlIW5.js.map
|