@go-to-k/cdkd 0.281.17 → 0.281.18
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-MpqWnvQI.js → asg-provider-CRgl7pV6.js} +2 -2
- package/dist/{asg-provider-MpqWnvQI.js.map → asg-provider-CRgl7pV6.js.map} +1 -1
- package/dist/cli.js +9 -7
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-B6DcyQpS.js → deploy-engine-D-0t_IlI.js} +150 -99
- package/dist/deploy-engine-D-0t_IlI.js.map +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-B6DcyQpS.js.map +0 -1
|
@@ -4176,11 +4176,70 @@ function cacheOptionToFlag(option) {
|
|
|
4176
4176
|
return flag;
|
|
4177
4177
|
}
|
|
4178
4178
|
|
|
4179
|
+
//#endregion
|
|
4180
|
+
//#region src/utils/aws-partition.ts
|
|
4181
|
+
/**
|
|
4182
|
+
* AWS partition / URL-suffix derivation, shared across layers.
|
|
4183
|
+
*
|
|
4184
|
+
* Lives in `src/utils/` because it has consumers in two different layers: the
|
|
4185
|
+
* `cdkd local *` command family (which passes a region in once to keep the STS
|
|
4186
|
+
* hop minimal) and the provisioning layer's `AppSyncProvider`, which rebuilds a
|
|
4187
|
+
* child resource's ARN when AWS did not report one.
|
|
4188
|
+
*
|
|
4189
|
+
* It was originally defined in `src/local/ecs-task-resolver.ts`, which
|
|
4190
|
+
* re-exports it so every existing call site is unchanged; a provisioning
|
|
4191
|
+
* provider importing from `src/local/**` would invert the layering.
|
|
4192
|
+
*
|
|
4193
|
+
* NOTE `getAccountInfo().partition`
|
|
4194
|
+
* (`src/deployment/intrinsic-function-resolver.ts`) was hardcoded to `'aws'`
|
|
4195
|
+
* until issue #1730, which made it derive through THIS helper — so the two now
|
|
4196
|
+
* agree and either spelling is correct. Prefer this one where a region is
|
|
4197
|
+
* already in hand, since it needs no STS round trip.
|
|
4198
|
+
*/
|
|
4199
|
+
/**
|
|
4200
|
+
* Derive the AWS partition / URL suffix for an AWS region. Same mapping
|
|
4201
|
+
* CloudFormation applies to `${AWS::Partition}` / `${AWS::URLSuffix}`.
|
|
4202
|
+
*/
|
|
4203
|
+
function derivePartitionAndUrlSuffix(region) {
|
|
4204
|
+
if (region.startsWith("cn-")) return {
|
|
4205
|
+
partition: "aws-cn",
|
|
4206
|
+
urlSuffix: "amazonaws.com.cn"
|
|
4207
|
+
};
|
|
4208
|
+
if (region.startsWith("us-gov-")) return {
|
|
4209
|
+
partition: "aws-us-gov",
|
|
4210
|
+
urlSuffix: "amazonaws.com"
|
|
4211
|
+
};
|
|
4212
|
+
if (region.startsWith("us-iso-")) return {
|
|
4213
|
+
partition: "aws-iso",
|
|
4214
|
+
urlSuffix: "c2s.ic.gov"
|
|
4215
|
+
};
|
|
4216
|
+
if (region.startsWith("us-isob-")) return {
|
|
4217
|
+
partition: "aws-iso-b",
|
|
4218
|
+
urlSuffix: "sc2s.sgov.gov"
|
|
4219
|
+
};
|
|
4220
|
+
return {
|
|
4221
|
+
partition: "aws",
|
|
4222
|
+
urlSuffix: "amazonaws.com"
|
|
4223
|
+
};
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4179
4226
|
//#endregion
|
|
4180
4227
|
//#region src/assets/docker-asset-publisher.ts
|
|
4181
4228
|
/**
|
|
4229
|
+
* The ECR registry host suffix for a region (issue #1745).
|
|
4230
|
+
*
|
|
4231
|
+
* Every registry URI here was hardcoded to `amazonaws.com`, so outside the
|
|
4232
|
+
* commercial partition cdkd built a hostname that does not resolve —
|
|
4233
|
+
* `aws-cn` registries live under `amazonaws.com.cn`, and `us-iso*` under
|
|
4234
|
+
* `c2s.ic.gov` / `sc2s.sgov.gov`. Commercial output is byte-identical, which is
|
|
4235
|
+
* what makes the change safe to ship without a non-commercial account.
|
|
4236
|
+
*/
|
|
4237
|
+
function ecrUrlSuffix(region) {
|
|
4238
|
+
return derivePartitionAndUrlSuffix(region).urlSuffix;
|
|
4239
|
+
}
|
|
4240
|
+
/**
|
|
4182
4241
|
* Registries this process has already logged in to, keyed by registry host
|
|
4183
|
-
* (`<accountId>.dkr.ecr.<region
|
|
4242
|
+
* (`<accountId>.dkr.ecr.<region>.<urlSuffix>`, which uniquely encodes the
|
|
4184
4243
|
* account + region credential context). ECR authorization tokens are valid
|
|
4185
4244
|
* for ~12h and a deploy process is short-lived, so a successful login is
|
|
4186
4245
|
* reused for the process lifetime — mirroring `cdk-assets`, which skips
|
|
@@ -4221,7 +4280,7 @@ var DockerAssetPublisher = class {
|
|
|
4221
4280
|
const repositoryName = this.resolvePlaceholders(dest.repositoryName, accountId, region);
|
|
4222
4281
|
const imageTag = this.resolvePlaceholders(dest.imageTag, accountId, region);
|
|
4223
4282
|
const destRegion = dest.region ? this.resolvePlaceholders(dest.region, accountId, region) : region;
|
|
4224
|
-
const ecrUri = `${accountId}.dkr.ecr.${destRegion}
|
|
4283
|
+
const ecrUri = `${accountId}.dkr.ecr.${destRegion}.${ecrUrlSuffix(destRegion)}/${repositoryName}:${imageTag}`;
|
|
4225
4284
|
this.logger.debug(`Publishing Docker image ${asset.displayName || assetHash} → ${ecrUri}`);
|
|
4226
4285
|
const client = new ECRClient({ region: destRegion });
|
|
4227
4286
|
try {
|
|
@@ -4231,8 +4290,7 @@ var DockerAssetPublisher = class {
|
|
|
4231
4290
|
}
|
|
4232
4291
|
const localTag = `cdkd-asset-${assetHash}`;
|
|
4233
4292
|
await this.buildImage(asset, cdkOutputDir, localTag);
|
|
4234
|
-
|
|
4235
|
-
await this.tagAndPushWithLazyLogin(client, localTag, fullUri, accountId, destRegion);
|
|
4293
|
+
await this.tagAndPushWithLazyLogin(client, localTag, ecrUri, accountId, destRegion);
|
|
4236
4294
|
this.logger.debug(`✅ Published: ${ecrUri}`);
|
|
4237
4295
|
} finally {
|
|
4238
4296
|
client.destroy();
|
|
@@ -4259,15 +4317,14 @@ var DockerAssetPublisher = class {
|
|
|
4259
4317
|
const repositoryName = this.resolvePlaceholders(dest.repositoryName, accountId, region);
|
|
4260
4318
|
const imageTag = this.resolvePlaceholders(dest.imageTag, accountId, region);
|
|
4261
4319
|
const destRegion = dest.region ? this.resolvePlaceholders(dest.region, accountId, region) : region;
|
|
4262
|
-
const ecrUri = `${accountId}.dkr.ecr.${destRegion}
|
|
4320
|
+
const ecrUri = `${accountId}.dkr.ecr.${destRegion}.${ecrUrlSuffix(destRegion)}/${repositoryName}:${imageTag}`;
|
|
4263
4321
|
const client = new ECRClient({ region: destRegion });
|
|
4264
4322
|
try {
|
|
4265
4323
|
if (await this.imageExists(client, repositoryName, imageTag)) {
|
|
4266
4324
|
this.logger.debug(`Image already exists, skipping: ${ecrUri}`);
|
|
4267
4325
|
continue;
|
|
4268
4326
|
}
|
|
4269
|
-
|
|
4270
|
-
await this.tagAndPushWithLazyLogin(client, localTag, fullUri, accountId, destRegion);
|
|
4327
|
+
await this.tagAndPushWithLazyLogin(client, localTag, ecrUri, accountId, destRegion);
|
|
4271
4328
|
this.logger.debug(`✅ Published: ${ecrUri}`);
|
|
4272
4329
|
} finally {
|
|
4273
4330
|
client.destroy();
|
|
@@ -4354,7 +4411,7 @@ var DockerAssetPublisher = class {
|
|
|
4354
4411
|
/**
|
|
4355
4412
|
* Authenticate with ECR via `docker login --password-stdin`.
|
|
4356
4413
|
*
|
|
4357
|
-
* The login is cached per registry (`<accountId>.dkr.ecr.<region>`) for the
|
|
4414
|
+
* The login is cached per registry (`<accountId>.dkr.ecr.<region>.<urlSuffix>`) for the
|
|
4358
4415
|
* process lifetime: a repeat publish to the same registry returns early
|
|
4359
4416
|
* without the `GetAuthorizationToken` call or the `docker login` subprocess
|
|
4360
4417
|
* (mirrors `cdk-assets`). ECR tokens are valid ~12h and a deploy process is
|
|
@@ -4366,7 +4423,7 @@ var DockerAssetPublisher = class {
|
|
|
4366
4423
|
* token that AWS has already expired.
|
|
4367
4424
|
*/
|
|
4368
4425
|
async ecrLogin(client, accountId, region, options = {}) {
|
|
4369
|
-
const registryKey = `${accountId}.dkr.ecr.${region}
|
|
4426
|
+
const registryKey = `${accountId}.dkr.ecr.${region}.${ecrUrlSuffix(region)}`;
|
|
4370
4427
|
if (!options.force && loggedInRegistries.has(registryKey)) {
|
|
4371
4428
|
this.logger.debug(`Reusing cached ECR login for ${registryKey}`);
|
|
4372
4429
|
return;
|
|
@@ -4375,7 +4432,7 @@ var DockerAssetPublisher = class {
|
|
|
4375
4432
|
if (!authData?.authorizationToken) throw new AssetError("Failed to get ECR authorization token");
|
|
4376
4433
|
const [username, password] = Buffer.from(authData.authorizationToken, "base64").toString().split(":");
|
|
4377
4434
|
if (!username || password === void 0) throw new AssetError("ECR authorization token has unexpected shape (missing username/password)");
|
|
4378
|
-
const endpoint = authData.proxyEndpoint || `https://${accountId}.dkr.ecr.${region}
|
|
4435
|
+
const endpoint = authData.proxyEndpoint || `https://${accountId}.dkr.ecr.${region}.${ecrUrlSuffix(region)}`;
|
|
4379
4436
|
try {
|
|
4380
4437
|
await runDockerStreaming([
|
|
4381
4438
|
"login",
|
|
@@ -4995,8 +5052,8 @@ function evaluatePseudoParam(name, map) {
|
|
|
4995
5052
|
switch (name) {
|
|
4996
5053
|
case "AWS::AccountId": return map.accountId;
|
|
4997
5054
|
case "AWS::Region": return map.region;
|
|
4998
|
-
case "AWS::Partition": return map.partition;
|
|
4999
|
-
case "AWS::URLSuffix": return
|
|
5055
|
+
case "AWS::Partition": return derivePartitionAndUrlSuffix(map.region).partition;
|
|
5056
|
+
case "AWS::URLSuffix": return derivePartitionAndUrlSuffix(map.region).urlSuffix;
|
|
5000
5057
|
default: throw new Error(`Not a foldable pseudo parameter: ${name}`);
|
|
5001
5058
|
}
|
|
5002
5059
|
}
|
|
@@ -9232,53 +9289,6 @@ async function applyRoleArnIfSet(opts) {
|
|
|
9232
9289
|
}
|
|
9233
9290
|
}
|
|
9234
9291
|
|
|
9235
|
-
//#endregion
|
|
9236
|
-
//#region src/utils/aws-partition.ts
|
|
9237
|
-
/**
|
|
9238
|
-
* AWS partition / URL-suffix derivation, shared across layers.
|
|
9239
|
-
*
|
|
9240
|
-
* Lives in `src/utils/` because it has consumers in two different layers: the
|
|
9241
|
-
* `cdkd local *` command family (which passes a region in once to keep the STS
|
|
9242
|
-
* hop minimal) and the provisioning layer's `AppSyncProvider`, which rebuilds a
|
|
9243
|
-
* child resource's ARN when AWS did not report one.
|
|
9244
|
-
*
|
|
9245
|
-
* It was originally defined in `src/local/ecs-task-resolver.ts`, which
|
|
9246
|
-
* re-exports it so every existing call site is unchanged; a provisioning
|
|
9247
|
-
* provider importing from `src/local/**` would invert the layering.
|
|
9248
|
-
*
|
|
9249
|
-
* NOTE `getAccountInfo().partition`
|
|
9250
|
-
* (`src/deployment/intrinsic-function-resolver.ts`) was hardcoded to `'aws'`
|
|
9251
|
-
* until issue #1730, which made it derive through THIS helper — so the two now
|
|
9252
|
-
* agree and either spelling is correct. Prefer this one where a region is
|
|
9253
|
-
* already in hand, since it needs no STS round trip.
|
|
9254
|
-
*/
|
|
9255
|
-
/**
|
|
9256
|
-
* Derive the AWS partition / URL suffix for an AWS region. Same mapping
|
|
9257
|
-
* CloudFormation applies to `${AWS::Partition}` / `${AWS::URLSuffix}`.
|
|
9258
|
-
*/
|
|
9259
|
-
function derivePartitionAndUrlSuffix(region) {
|
|
9260
|
-
if (region.startsWith("cn-")) return {
|
|
9261
|
-
partition: "aws-cn",
|
|
9262
|
-
urlSuffix: "amazonaws.com.cn"
|
|
9263
|
-
};
|
|
9264
|
-
if (region.startsWith("us-gov-")) return {
|
|
9265
|
-
partition: "aws-us-gov",
|
|
9266
|
-
urlSuffix: "amazonaws.com"
|
|
9267
|
-
};
|
|
9268
|
-
if (region.startsWith("us-iso-")) return {
|
|
9269
|
-
partition: "aws-iso",
|
|
9270
|
-
urlSuffix: "c2s.ic.gov"
|
|
9271
|
-
};
|
|
9272
|
-
if (region.startsWith("us-isob-")) return {
|
|
9273
|
-
partition: "aws-iso-b",
|
|
9274
|
-
urlSuffix: "sc2s.sgov.gov"
|
|
9275
|
-
};
|
|
9276
|
-
return {
|
|
9277
|
-
partition: "aws",
|
|
9278
|
-
urlSuffix: "amazonaws.com"
|
|
9279
|
-
};
|
|
9280
|
-
}
|
|
9281
|
-
|
|
9282
9292
|
//#endregion
|
|
9283
9293
|
//#region src/provisioning/config-shape.ts
|
|
9284
9294
|
/**
|
|
@@ -10767,7 +10777,7 @@ function buildUnknownIntrinsicError(key) {
|
|
|
10767
10777
|
const issueUrl = `https://github.com/go-to-k/cdkd/issues/new?title=${encodeURIComponent(title)}&labels=intrinsic-support`;
|
|
10768
10778
|
return /* @__PURE__ */ new Error(`Unsupported CloudFormation intrinsic function "${key}": cdkd does not support resolving it yet. Deploying this template would produce a broken value. Please request support by opening an issue: ${issueUrl}`);
|
|
10769
10779
|
}
|
|
10770
|
-
let
|
|
10780
|
+
let cachedAccountIdentity = null;
|
|
10771
10781
|
/**
|
|
10772
10782
|
* Cache for availability zones per region
|
|
10773
10783
|
*/
|
|
@@ -10786,18 +10796,30 @@ const cachedDynamicReferences = {};
|
|
|
10786
10796
|
*/
|
|
10787
10797
|
const cachedEc2InstanceAttributes = {};
|
|
10788
10798
|
/**
|
|
10789
|
-
*
|
|
10799
|
+
* The region this call answers for: the caller's override, else the ambient one.
|
|
10790
10800
|
*
|
|
10791
|
-
*
|
|
10792
|
-
* different
|
|
10793
|
-
* `arn:aws:...:cn-north-1:...` for a `cn-` override. Every return path that
|
|
10794
|
-
* swaps the region goes through here.
|
|
10801
|
+
* Kept as one helper so the cached and the freshly-resolved paths cannot pick
|
|
10802
|
+
* different defaults (issue #1746).
|
|
10795
10803
|
*/
|
|
10796
|
-
function
|
|
10804
|
+
function effectiveAccountInfoRegion(overrideRegion) {
|
|
10805
|
+
return overrideRegion || process.env["AWS_REGION"] || "us-east-1";
|
|
10806
|
+
}
|
|
10807
|
+
/**
|
|
10808
|
+
* Build the caller's full answer from the cached account identity (issue #1746).
|
|
10809
|
+
*
|
|
10810
|
+
* `partition` is a FUNCTION of `region`, so it is derived HERE — per call —
|
|
10811
|
+
* rather than carried alongside the account. This is what makes the cache safe
|
|
10812
|
+
* to share between callers with different regions: an `arn:aws:...:cn-north-1`
|
|
10813
|
+
* (or the inverse `arn:aws-cn:...:us-east-1`) is structurally valid, so nothing
|
|
10814
|
+
* downstream could catch it.
|
|
10815
|
+
*/
|
|
10816
|
+
function accountInfoFor(identity, overrideRegion) {
|
|
10817
|
+
const region = effectiveAccountInfoRegion(overrideRegion);
|
|
10797
10818
|
return {
|
|
10798
|
-
|
|
10819
|
+
accountId: identity.accountId,
|
|
10799
10820
|
region,
|
|
10800
|
-
partition: derivePartitionAndUrlSuffix(region).partition
|
|
10821
|
+
partition: derivePartitionAndUrlSuffix(region).partition,
|
|
10822
|
+
...identity.fabricated ? { fabricated: true } : {}
|
|
10801
10823
|
};
|
|
10802
10824
|
}
|
|
10803
10825
|
/**
|
|
@@ -10814,7 +10836,7 @@ function withOverrideRegion(info, region) {
|
|
|
10814
10836
|
const FABRICATED_ACCOUNT_INFO_TTL_MS = 1e4;
|
|
10815
10837
|
/** Test seam for {@link FABRICATED_ACCOUNT_INFO_TTL_MS} expiry. */
|
|
10816
10838
|
const accountInfoClock = { now: () => Date.now() };
|
|
10817
|
-
let
|
|
10839
|
+
let fabricatedAccountIdentity = null;
|
|
10818
10840
|
/**
|
|
10819
10841
|
* The single in-flight lookup, so N concurrent callers share ONE round trip.
|
|
10820
10842
|
*
|
|
@@ -10826,66 +10848,95 @@ let fabricatedAccountInfo = null;
|
|
|
10826
10848
|
*/
|
|
10827
10849
|
let accountInfoInFlight = null;
|
|
10828
10850
|
/**
|
|
10851
|
+
* Bumped by {@link resetAccountInfoCache}, so a lookup that was already in
|
|
10852
|
+
* flight cannot write the cache it was asked to forget.
|
|
10853
|
+
*
|
|
10854
|
+
* Without it the reset only cleared the SETTLED caches: an in-flight resolve
|
|
10855
|
+
* would land afterwards and re-populate `cachedAccountIdentity`, so the next
|
|
10856
|
+
* caller read the pre-reset account. That is the `*Once`-leak shape one layer
|
|
10857
|
+
* down — a later test silently inheriting an earlier one's answer — and the
|
|
10858
|
+
* reset's own comment already claimed to forget it.
|
|
10859
|
+
*/
|
|
10860
|
+
let accountInfoGeneration = 0;
|
|
10861
|
+
/**
|
|
10829
10862
|
* Get AWS account information from STS
|
|
10830
10863
|
*/
|
|
10831
10864
|
async function getAccountInfo(overrideRegion) {
|
|
10832
|
-
|
|
10833
|
-
if (
|
|
10834
|
-
if (
|
|
10835
|
-
|
|
10836
|
-
accountInfoInFlight =
|
|
10865
|
+
if (cachedAccountIdentity) return accountInfoFor(cachedAccountIdentity, overrideRegion);
|
|
10866
|
+
if (fabricatedAccountIdentity && accountInfoClock.now() < fabricatedAccountIdentity.expiresAt) return accountInfoFor(fabricatedAccountIdentity.identity, overrideRegion);
|
|
10867
|
+
if (accountInfoInFlight) return accountInfoFor(await accountInfoInFlight, overrideRegion);
|
|
10868
|
+
const inFlight = resolveAccountIdentity();
|
|
10869
|
+
accountInfoInFlight = inFlight;
|
|
10837
10870
|
try {
|
|
10838
|
-
return
|
|
10871
|
+
return accountInfoFor(await inFlight, overrideRegion);
|
|
10839
10872
|
} finally {
|
|
10840
|
-
accountInfoInFlight = null;
|
|
10873
|
+
if (accountInfoInFlight === inFlight) accountInfoInFlight = null;
|
|
10841
10874
|
}
|
|
10842
10875
|
}
|
|
10843
|
-
async function
|
|
10876
|
+
async function resolveAccountIdentity() {
|
|
10877
|
+
const generation = accountInfoGeneration;
|
|
10878
|
+
const stillCurrent = () => generation === accountInfoGeneration;
|
|
10844
10879
|
const logger = getLogger().child("IntrinsicFunctionResolver");
|
|
10845
10880
|
const stsClient = getAwsClients().sts;
|
|
10846
10881
|
try {
|
|
10847
10882
|
const response = await stsClient.send(new GetCallerIdentityCommand({}));
|
|
10848
10883
|
const accountId = response.Account || "123456789012";
|
|
10849
|
-
const region = overrideRegion || process.env["AWS_REGION"] || "us-east-1";
|
|
10850
|
-
const partition = derivePartitionAndUrlSuffix(region).partition;
|
|
10851
10884
|
const resolved = {
|
|
10852
10885
|
accountId,
|
|
10853
|
-
region,
|
|
10854
|
-
partition,
|
|
10855
10886
|
...response.Account ? {} : { fabricated: true }
|
|
10856
10887
|
};
|
|
10857
|
-
if (resolved.fabricated)
|
|
10858
|
-
|
|
10888
|
+
if (!stillCurrent()) {} else if (resolved.fabricated) fabricatedAccountIdentity = {
|
|
10889
|
+
identity: resolved,
|
|
10859
10890
|
expiresAt: accountInfoClock.now() + FABRICATED_ACCOUNT_INFO_TTL_MS
|
|
10860
10891
|
};
|
|
10861
10892
|
else {
|
|
10862
|
-
|
|
10863
|
-
|
|
10893
|
+
cachedAccountIdentity = resolved;
|
|
10894
|
+
fabricatedAccountIdentity = null;
|
|
10864
10895
|
}
|
|
10865
|
-
logger.debug(`Retrieved AWS account info: ${accountId}
|
|
10896
|
+
logger.debug(`Retrieved AWS account info: ${accountId}`);
|
|
10866
10897
|
return resolved;
|
|
10867
10898
|
} catch (error) {
|
|
10868
10899
|
logger.warn(`Failed to get AWS account info from STS: ${error instanceof Error ? error.message : String(error)}, using defaults`);
|
|
10869
|
-
const region = overrideRegion || process.env["AWS_REGION"] || "us-east-1";
|
|
10870
10900
|
const fallback = {
|
|
10871
10901
|
accountId: process.env["AWS_ACCOUNT_ID"] || "123456789012",
|
|
10872
|
-
region,
|
|
10873
|
-
partition: derivePartitionAndUrlSuffix(region).partition,
|
|
10874
10902
|
...process.env["AWS_ACCOUNT_ID"] ? {} : { fabricated: true }
|
|
10875
10903
|
};
|
|
10904
|
+
if (!stillCurrent()) return fallback;
|
|
10876
10905
|
if (fallback.fabricated) {
|
|
10877
|
-
if (!
|
|
10878
|
-
|
|
10906
|
+
if (!cachedAccountIdentity) fabricatedAccountIdentity = {
|
|
10907
|
+
identity: fallback,
|
|
10879
10908
|
expiresAt: accountInfoClock.now() + FABRICATED_ACCOUNT_INFO_TTL_MS
|
|
10880
10909
|
};
|
|
10881
10910
|
} else {
|
|
10882
|
-
|
|
10883
|
-
|
|
10911
|
+
cachedAccountIdentity = fallback;
|
|
10912
|
+
fabricatedAccountIdentity = null;
|
|
10884
10913
|
}
|
|
10885
10914
|
return fallback;
|
|
10886
10915
|
}
|
|
10887
10916
|
}
|
|
10888
10917
|
/**
|
|
10918
|
+
* Does a constructed `Fn::GetAtt` answer embed the placeholder account id?
|
|
10919
|
+
*
|
|
10920
|
+
* The guard in `constructGuardedAttribute` used to test
|
|
10921
|
+
* `typeof value === 'string'` directly (issue #1746). Every account-bearing
|
|
10922
|
+
* branch of `constructAttribute` returns a string today — the only non-string
|
|
10923
|
+
* returns are the EC2 IPv6 CIDR LISTS, which carry no account — so that was
|
|
10924
|
+
* complete as written, but a future list-valued attribute embedding an account
|
|
10925
|
+
* would have slipped past silently with no test failing. Walking string arrays
|
|
10926
|
+
* (one level, which is the shape `constructAttribute` actually produces) closes
|
|
10927
|
+
* it now rather than at the moment someone adds one. A non-string, non-array
|
|
10928
|
+
* value is not account-bearing by construction and is left alone.
|
|
10929
|
+
*
|
|
10930
|
+
* EXPORTED for its own test: no `constructAttribute` branch returns an
|
|
10931
|
+
* account-bearing array today, so the array arm is unreachable through the
|
|
10932
|
+
* public resolver API and would ship unexercised otherwise.
|
|
10933
|
+
*/
|
|
10934
|
+
function embedsAccountId(value, accountId) {
|
|
10935
|
+
if (typeof value === "string") return value.includes(accountId);
|
|
10936
|
+
if (Array.isArray(value)) return value.some((entry) => typeof entry === "string" && entry.includes(accountId));
|
|
10937
|
+
return false;
|
|
10938
|
+
}
|
|
10939
|
+
/**
|
|
10889
10940
|
* Collect every name referenced (Ref / Fn::Sub placeholder / other intrinsic
|
|
10890
10941
|
* argument) by the sections cdkd actually evaluates: Resources, Outputs, and
|
|
10891
10942
|
* Conditions. Deliberately excludes `Rules` (assertion-only, never evaluated
|
|
@@ -11349,7 +11400,7 @@ var IntrinsicFunctionResolver = class {
|
|
|
11349
11400
|
async constructGuardedAttribute(resource, attributeName, context, logicalId) {
|
|
11350
11401
|
const accountInfo = await getAccountInfo(this.resolverRegion);
|
|
11351
11402
|
const value = await this.constructAttribute(resource, attributeName, context, logicalId, accountInfo);
|
|
11352
|
-
if (accountInfo.fabricated &&
|
|
11403
|
+
if (accountInfo.fabricated && embedsAccountId(value, accountInfo.accountId)) throw new IntrinsicResolutionRefusalError(`Cannot resolve Fn::GetAtt [${logicalId}, ${attributeName}] for ${resource.resourceType}: STS did not report this deploy's account id, so cdkd would build the value from the placeholder account ${accountInfo.accountId} — structurally valid, naming a different account, and indistinguishable downstream from a real one. Fix the AWS credentials (or set AWS_ACCOUNT_ID to this deploy's account) and deploy again.`);
|
|
11353
11404
|
return value;
|
|
11354
11405
|
}
|
|
11355
11406
|
/**
|
|
@@ -13404,7 +13455,7 @@ var CloudControlProvider = class {
|
|
|
13404
13455
|
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);
|
|
13405
13456
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
13406
13457
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
13407
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
13458
|
+
const { ASGProvider } = await import("./asg-provider-CRgl7pV6.js").then((n) => n.n);
|
|
13408
13459
|
await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
|
|
13409
13460
|
return;
|
|
13410
13461
|
}
|
|
@@ -13554,7 +13605,7 @@ var CloudControlProvider = class {
|
|
|
13554
13605
|
* else's account, and the record heals on the resource's next update.
|
|
13555
13606
|
*/
|
|
13556
13607
|
async accountInfoForSynthesizedArn(resourceType, attributeName, physicalId) {
|
|
13557
|
-
const accountInfo = await getAccountInfo();
|
|
13608
|
+
const accountInfo = await getAccountInfo(await this.cloudControlClient.config.region());
|
|
13558
13609
|
if (accountInfo.fabricated) {
|
|
13559
13610
|
this.logger.warn(`Not enriching ${resourceType} ${attributeName} for ${physicalId}: STS did not report this deploy's account id, so the value would be built from a placeholder account and would be indistinguishable from a real one. Fix the credentials (or set AWS_ACCOUNT_ID) and deploy again — the record heals on the next update.`);
|
|
13560
13611
|
return;
|
|
@@ -20312,7 +20363,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
20312
20363
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
20313
20364
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
20314
20365
|
function getCdkdVersion() {
|
|
20315
|
-
return "0.281.
|
|
20366
|
+
return "0.281.18";
|
|
20316
20367
|
}
|
|
20317
20368
|
/**
|
|
20318
20369
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -22480,5 +22531,5 @@ var DeployEngine = class {
|
|
|
22480
22531
|
};
|
|
22481
22532
|
|
|
22482
22533
|
//#endregion
|
|
22483
|
-
export { replayWarn as $, findLargeInlineResources as $t, green as A, isCdkdError as An, buildDockerImage as At, slowCcOperationTimeoutMs as B, getLegacyStateBucketName as Bt, MULTI_REGION_RECREATE_BLOCKED_TYPES as C, ResourceTimeoutError as Cn,
|
|
22484
|
-
//# sourceMappingURL=deploy-engine-
|
|
22534
|
+
export { replayWarn as $, findLargeInlineResources as $t, green as A, isCdkdError as An, buildDockerImage as At, slowCcOperationTimeoutMs as B, getLegacyStateBucketName as Bt, MULTI_REGION_RECREATE_BLOCKED_TYPES as C, ResourceTimeoutError as Cn, BOOTSTRAP_MARKER_PREFIX as Ct, bold as D, StateError as Dn, validateAssetBucketName as Dt, formatResourceLine as E, StackTerminationProtectionError as En, parseBootstrapMarker as Et, clearOnUpdateRemoval as F, AssetManifestLoader as Ft, getAccountInfo as G, resolveStateBucketWithDefault as Gt, isTerminationProtectionPropagationError as H, resolveAutoAssetStorage as Ht, ProviderRegistry as I, getDockerImageBySourceHash as It, normalizeAwsTagsToCfn as J, stateBucketExistenceConfirmed as Jt, refStateLookupFromResource as K, resolveStateBucketWithDefaultAndSource as Kt, findActionableSilentDrops as L, Synthesizer as Lt, yellow as M, withErrorHandling as Mn, getDockerCmd as Mt, IAMRoleProvider as N, __exportAll as Nn, runDockerForeground as Nt, cyan as O, SynthesisError as On, validateContainerRepoName as Ot, collectInlinePolicyNamesManagedBySiblings as P, runDockerStreaming as Pt, readConfigString as Q, MIGRATE_TMP_PREFIX as Qt, findSilentDropProperties as R, synthesisStatusMessage as Rt, extractDeploymentEventError as S, ProvisioningError as Sn, AssetModeResolver as St, renderStatefulReason as T, StackHasActiveImportsError as Tn, getBootstrapMarkerKey as Tt, IntrinsicFunctionResolver as U, resolveCaptureObservedState as Ut, disableInstanceApiTermination as V, resolveApp as Vt, cfnRefValueFromPhysicalId as W, resolveSkipPrefix as Wt, assertRegionMatch as X, CFN_TEMPLATE_BODY_LIMIT as Xt, resolveExplicitPhysicalId as Y, warnDeprecatedNoPrefixCliFlag as Yt, configStringRefusal as Z, CFN_TEMPLATE_URL_LIMIT as Zt, createPreDeleteFinalSnapshot as _, LocalStartServiceError as _n, WorkGraph as _t, DeploymentEventsStore as a, resolveBucketRegion as an, describeTypeWithThrottleRetry as at, unsupportedFinalSnapshotError as b, NestedStackChildDirectDestroyError as bn, loadPublishableAssetManifest as bt, replayFailedOperations as c, resetAwsClients as cn, isThrottlingError as ct, IMPLICIT_DELETE_DEPENDENCIES as d, CdkdError as dn, LockManager as dt, uploadCfnTemplate as en, requireConfigArray as et, computeImplicitDeleteEdges as f, ConfigError as fn, S3StateBackend as ft, ccRoutedFinalSnapshotError as g, LocalMigrateError as gn, stringifyValue as gt, buildFinalSnapshotIdentifier as h, LocalInvokeBuildError as hn, AssetPublisher as ht, DeploymentEventsReader as i, clearBucketRegionCache as in, DiffCalculator as it, red as j, normalizeAwsError as jn, formatDockerLoginError as jt, gray as k, formatError as kn, derivePartitionAndUrlSuffix as kt, replayRollback as l, setAwsClients as ln, DagBuilder as lt, PRE_DELETE_SNAPSHOT_TYPES as m, DeployCancelledError as mn, shouldRetainResource as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, AssemblyReader as nn, requireConfigString as nt, planFailedOps as o, AwsClients as on, withRetry as ot, ATOMIC_FINAL_SNAPSHOT_TYPES as p, DependencyError as pn, rebuildClientForBucketRegion as pt, WAFv2WebACLProvider as q, resolveUseCdkBootstrapAssets as qt, DeployEngine as r, processStackMessages as rn, applyRoleArnIfSet as rt, planRollback as s, getAwsClients as sn, isRetryableTransientError as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, expectedOwnerParam as tn, requireConfigObject as tt, withResourceDeadline as u, AssetError as un, TemplateParser as ut, isFinalSnapshotError as v, LockError as vn, buildAssetRedirectMap as vt, isStatefulRecreateTargetSync as w, ResourceUpdateNotSupportedError as wn, ensureAssetStorage as wt, makeCanonicalizePropertiesFn as x, PartialFailureError as xn, rewriteTemplateAssetReferences as xt, refusesFinalSnapshot as y, MissingCdkCliError as yn, createAssetRedirectResolver as yt, CloudControlProvider as z, getDefaultStateBucketName as zt };
|
|
22535
|
+
//# sourceMappingURL=deploy-engine-D-0t_IlI.js.map
|