@go-to-k/cdkd 0.234.1 → 0.235.1
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/README.md +17 -4
- package/dist/{asg-provider-Dd9Xze-T.js → asg-provider-Dbl1_mwT.js} +3 -2
- package/dist/{asg-provider-Dd9Xze-T.js.map → asg-provider-Dbl1_mwT.js.map} +1 -1
- package/dist/{aws-clients-pjPwZz1r.js → aws-clients-B15NAPbL.js} +1 -1
- package/dist/{aws-clients-pjPwZz1r.js.map → aws-clients-B15NAPbL.js.map} +1 -1
- package/dist/cli.js +82 -13
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-CdAkyW9k.js → deploy-engine-iahWC4C1.js} +141 -11
- package/dist/deploy-engine-iahWC4C1.js.map +1 -0
- package/dist/{ec2-termination-protection-uvVnteGl.js → ec2-termination-protection-q-WGWgxa.js} +3 -827
- package/dist/ec2-termination-protection-q-WGWgxa.js.map +1 -0
- package/dist/expected-bucket-owner-BjEfUnkA.js +87 -0
- package/dist/expected-bucket-owner-BjEfUnkA.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/logger-BzO-joNR.js +828 -0
- package/dist/logger-BzO-joNR.js.map +1 -0
- package/package.json +1 -1
- package/dist/deploy-engine-CdAkyW9k.js.map +0 -1
- package/dist/ec2-termination-protection-uvVnteGl.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as getLiveRenderer, d as generateResourceNameWithFallback, l as applyDefaultNameForFallback, n as getLogger, p as withStackName, u as generateResourceName } from "./logger-BzO-joNR.js";
|
|
2
|
+
import { E as SynthesisError, S as ResourceUpdateNotSupportedError, T as StateError, a as normalizeAwsTagsToCfn, b as ProvisioningError, c as AssetError, d as DependencyError, g as MacroExpansionError, h as LockError, i as matchesCdkPath, k as normalizeAwsError, l as CdkdError, n as isTerminationProtectionPropagationError, o as resolveExplicitPhysicalId, s as assertRegionMatch, t as disableInstanceApiTermination, x as ResourceTimeoutError } from "./ec2-termination-protection-q-WGWgxa.js";
|
|
3
|
+
import { r as getAwsClients } from "./aws-clients-B15NAPbL.js";
|
|
4
|
+
import { t as expectedOwnerParam } from "./expected-bucket-owner-BjEfUnkA.js";
|
|
3
5
|
import { randomUUID } from "node:crypto";
|
|
4
6
|
import { CreateBucketCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, NoSuchKey, PutBucketEncryptionCommand, PutBucketPolicyCommand, PutObjectCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
5
7
|
import { CloudControlClient, CreateResourceCommand, DeleteResourceCommand, GetResourceCommand, GetResourceRequestStatusCommand, ListResourcesCommand, UpdateResourceCommand } from "@aws-sdk/client-cloudcontrol";
|
|
@@ -77,7 +79,11 @@ async function resolveBucketRegion(bucketName, opts = {}) {
|
|
|
77
79
|
...opts.credentials && { credentials: opts.credentials }
|
|
78
80
|
});
|
|
79
81
|
try {
|
|
80
|
-
|
|
82
|
+
const { expectedOwnerParam } = await import("./expected-bucket-owner-BjEfUnkA.js").then((n) => n.n);
|
|
83
|
+
return (await client.send(new GetBucketLocationCommand({
|
|
84
|
+
Bucket: bucketName,
|
|
85
|
+
...await expectedOwnerParam(client)
|
|
86
|
+
}))).LocationConstraint || "us-east-1";
|
|
81
87
|
} catch {
|
|
82
88
|
return opts.fallbackRegion ?? "us-east-1";
|
|
83
89
|
} finally {
|
|
@@ -1366,6 +1372,7 @@ async function uploadCfnTemplate(args) {
|
|
|
1366
1372
|
const key = `${MIGRATE_TMP_PREFIX}/${stackName}/${Date.now()}.${ext}`;
|
|
1367
1373
|
try {
|
|
1368
1374
|
await s3.send(new PutObjectCommand({
|
|
1375
|
+
...await expectedOwnerParam(s3),
|
|
1369
1376
|
Bucket: bucket,
|
|
1370
1377
|
Key: key,
|
|
1371
1378
|
Body: body,
|
|
@@ -1380,7 +1387,8 @@ async function uploadCfnTemplate(args) {
|
|
|
1380
1387
|
try {
|
|
1381
1388
|
await s3.send(new DeleteObjectCommand({
|
|
1382
1389
|
Bucket: bucket,
|
|
1383
|
-
Key: key
|
|
1390
|
+
Key: key,
|
|
1391
|
+
...await expectedOwnerParam(s3)
|
|
1384
1392
|
}));
|
|
1385
1393
|
} finally {
|
|
1386
1394
|
s3.destroy();
|
|
@@ -1790,6 +1798,23 @@ function resolveUseCdkBootstrapAssets(cliValue) {
|
|
|
1790
1798
|
return (loadCdkJson()?.context?.["cdkd"])?.["useCdkBootstrapAssets"] === true;
|
|
1791
1799
|
}
|
|
1792
1800
|
/**
|
|
1801
|
+
* Resolve the effective "auto-create cdkd asset storage on first deploy into
|
|
1802
|
+
* an un-opted-in region" value (issue #1007).
|
|
1803
|
+
*
|
|
1804
|
+
* Mirrors {@link resolveCaptureObservedState}'s `--no-X` shape: Commander
|
|
1805
|
+
* reports `--no-auto-asset-storage` as `autoAssetStorage: false`, and the
|
|
1806
|
+
* implicit default is `true` — so the cdk.json fallback
|
|
1807
|
+
* (`context.cdkd.autoAssetStorage`, boolean) only fires when the CLI value
|
|
1808
|
+
* is the implicit default. Priority: CLI `false` wins > cdk.json boolean >
|
|
1809
|
+
* default `true`.
|
|
1810
|
+
*/
|
|
1811
|
+
function resolveAutoAssetStorage(cliValue) {
|
|
1812
|
+
if (cliValue === false) return false;
|
|
1813
|
+
const v = (loadCdkJson()?.context?.["cdkd"])?.["autoAssetStorage"];
|
|
1814
|
+
if (typeof v === "boolean") return v;
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1793
1818
|
* Pre-parse argv walk that surfaces the deprecation warning when the
|
|
1794
1819
|
* user explicitly passes the legacy `--no-prefix-user-supplied-names`
|
|
1795
1820
|
* flag. Commander's auto-negation of `--prefix-user-supplied-names`
|
|
@@ -1911,7 +1936,7 @@ async function resolveStateBucketWithDefaultAndSource(cliBucket, region) {
|
|
|
1911
1936
|
logger.debug("No state bucket specified, resolving default from account...");
|
|
1912
1937
|
const { GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
|
|
1913
1938
|
const { S3Client } = await import("@aws-sdk/client-s3");
|
|
1914
|
-
const { getAwsClients } = await import("./aws-clients-
|
|
1939
|
+
const { getAwsClients } = await import("./aws-clients-B15NAPbL.js").then((n) => n.n);
|
|
1915
1940
|
const accountId = (await getAwsClients().sts.send(new GetCallerIdentityCommand({}))).Account;
|
|
1916
1941
|
const newName = getDefaultStateBucketName(accountId);
|
|
1917
1942
|
const legacyName = getLegacyStateBucketName(accountId, region);
|
|
@@ -1969,11 +1994,13 @@ async function resolveStateBucketWithDefaultAndSource(cliBucket, region) {
|
|
|
1969
1994
|
*/
|
|
1970
1995
|
async function bucketHasAnyState(client, bucketName) {
|
|
1971
1996
|
const { ListObjectsV2Command } = await import("@aws-sdk/client-s3");
|
|
1997
|
+
const { expectedOwnerParam } = await import("./expected-bucket-owner-BjEfUnkA.js").then((n) => n.n);
|
|
1972
1998
|
try {
|
|
1973
1999
|
return ((await client.send(new ListObjectsV2Command({
|
|
1974
2000
|
Bucket: bucketName,
|
|
1975
2001
|
Prefix: "cdkd/",
|
|
1976
|
-
MaxKeys: 1
|
|
2002
|
+
MaxKeys: 1,
|
|
2003
|
+
...await expectedOwnerParam(client)
|
|
1977
2004
|
}))).KeyCount ?? 0) > 0;
|
|
1978
2005
|
} catch {
|
|
1979
2006
|
return true;
|
|
@@ -1994,8 +2021,12 @@ async function bucketHasAnyState(client, bucketName) {
|
|
|
1994
2021
|
*/
|
|
1995
2022
|
async function bucketExists(client, bucketName) {
|
|
1996
2023
|
const { HeadBucketCommand } = await import("@aws-sdk/client-s3");
|
|
2024
|
+
const { expectedOwnerParam } = await import("./expected-bucket-owner-BjEfUnkA.js").then((n) => n.n);
|
|
1997
2025
|
try {
|
|
1998
|
-
await client.send(new HeadBucketCommand({
|
|
2026
|
+
await client.send(new HeadBucketCommand({
|
|
2027
|
+
Bucket: bucketName,
|
|
2028
|
+
...await expectedOwnerParam(client)
|
|
2029
|
+
}));
|
|
1999
2030
|
return true;
|
|
2000
2031
|
} catch (error) {
|
|
2001
2032
|
const err = error;
|
|
@@ -3183,12 +3214,14 @@ var AssetModeResolver = class {
|
|
|
3183
3214
|
profile;
|
|
3184
3215
|
useCdkBootstrapAssets;
|
|
3185
3216
|
suppressLegacyNotice;
|
|
3217
|
+
autoCreate;
|
|
3186
3218
|
constructor(stateBackend, accountId, opts = {}) {
|
|
3187
3219
|
this.stateBackend = stateBackend;
|
|
3188
3220
|
this.accountId = accountId;
|
|
3189
3221
|
this.profile = opts.profile;
|
|
3190
3222
|
this.useCdkBootstrapAssets = opts.useCdkBootstrapAssets ?? false;
|
|
3191
3223
|
this.suppressLegacyNotice = opts.suppressLegacyNotice ?? false;
|
|
3224
|
+
this.autoCreate = opts.autoCreate;
|
|
3192
3225
|
}
|
|
3193
3226
|
/**
|
|
3194
3227
|
* Resolve the asset mode for a deploy region. Concurrent callers for the
|
|
@@ -3209,6 +3242,10 @@ var AssetModeResolver = class {
|
|
|
3209
3242
|
const markerKey = getBootstrapMarkerKey(region);
|
|
3210
3243
|
const body = await this.stateBackend.getRawObject(markerKey);
|
|
3211
3244
|
if (body === null) {
|
|
3245
|
+
if (this.autoCreate) {
|
|
3246
|
+
const created = await this.tryAutoCreate(region, markerKey);
|
|
3247
|
+
if (created) return created;
|
|
3248
|
+
}
|
|
3212
3249
|
if (!this.legacyNoticeShownRegions.has(region) && !this.suppressLegacyNotice) {
|
|
3213
3250
|
this.legacyNoticeShownRegions.add(region);
|
|
3214
3251
|
this.logger.info(`Assets for region '${region}' are published to the CDK bootstrap bucket/repo, which 'cdk gc' may garbage-collect (cdkd-deployed stacks have no CloudFormation stack for gc to scan). Run 'cdkd bootstrap --region ${region}' to create cdkd-owned asset storage that 'cdk gc' never touches.`);
|
|
@@ -3223,6 +3260,59 @@ var AssetModeResolver = class {
|
|
|
3223
3260
|
marker
|
|
3224
3261
|
};
|
|
3225
3262
|
}
|
|
3263
|
+
/**
|
|
3264
|
+
* Issue #1007 — first deploy into an un-opted-in region: confirm, then
|
|
3265
|
+
* create the asset bucket + container repo + marker via the same
|
|
3266
|
+
* {@link ensureAssetStorage} `cdkd bootstrap` uses (squatting defense,
|
|
3267
|
+
* idempotent creation, marker-written-last all included). Returns `null`
|
|
3268
|
+
* (= stay legacy) when the user declines or creation fails — the caller
|
|
3269
|
+
* then shows the legacy notice, so the user still learns the exact
|
|
3270
|
+
* `cdkd bootstrap --region <r>` remediation.
|
|
3271
|
+
*/
|
|
3272
|
+
async tryAutoCreate(region, markerKey) {
|
|
3273
|
+
let confirmed;
|
|
3274
|
+
try {
|
|
3275
|
+
confirmed = await this.autoCreate.confirm(region);
|
|
3276
|
+
} catch {
|
|
3277
|
+
confirmed = false;
|
|
3278
|
+
}
|
|
3279
|
+
if (!confirmed) return null;
|
|
3280
|
+
let s3Client;
|
|
3281
|
+
let ecrClient;
|
|
3282
|
+
try {
|
|
3283
|
+
s3Client = new S3Client({
|
|
3284
|
+
region,
|
|
3285
|
+
...this.profile && { profile: this.profile }
|
|
3286
|
+
});
|
|
3287
|
+
ecrClient = new ECRClient({
|
|
3288
|
+
region,
|
|
3289
|
+
...this.profile && { profile: this.profile }
|
|
3290
|
+
});
|
|
3291
|
+
await ensureAssetStorage({
|
|
3292
|
+
s3Client,
|
|
3293
|
+
ecrClient,
|
|
3294
|
+
stateBackend: this.stateBackend,
|
|
3295
|
+
accountId: this.accountId,
|
|
3296
|
+
region,
|
|
3297
|
+
force: false
|
|
3298
|
+
});
|
|
3299
|
+
const body = await this.stateBackend.getRawObject(markerKey);
|
|
3300
|
+
if (body === null) throw new CdkdError(`bootstrap marker missing at '${markerKey}' right after creation`, "ASSET_STORAGE_MARKER_MISSING");
|
|
3301
|
+
const marker = parseBootstrapMarker(body, markerKey);
|
|
3302
|
+
this.logger.debug(`cdkd asset storage auto-created for region '${region}': ${marker.assetBucket} / ${marker.containerRepo}`);
|
|
3303
|
+
return {
|
|
3304
|
+
mode: "cdkd-assets",
|
|
3305
|
+
marker
|
|
3306
|
+
};
|
|
3307
|
+
} catch (error) {
|
|
3308
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3309
|
+
this.logger.warn(`Failed to auto-create cdkd asset storage for region '${region}': ${message} Falling back to the CDK bootstrap destinations for this run — run 'cdkd bootstrap --region ${region}' (with S3/ECR create permissions) to opt the region in.`);
|
|
3310
|
+
return null;
|
|
3311
|
+
} finally {
|
|
3312
|
+
s3Client?.destroy();
|
|
3313
|
+
ecrClient?.destroy();
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3226
3316
|
};
|
|
3227
3317
|
|
|
3228
3318
|
//#endregion
|
|
@@ -4095,10 +4185,24 @@ var S3StateBackend = class {
|
|
|
4095
4185
|
* synthetic `UnknownError` (e.g. cross-region HEAD) becomes a concrete
|
|
4096
4186
|
* "Bucket does not exist" / "Access denied" / "different region" message.
|
|
4097
4187
|
*/
|
|
4188
|
+
/**
|
|
4189
|
+
* `ExpectedBucketOwner` spread for every state-bucket S3 call — S3 itself
|
|
4190
|
+
* rejects the call (403) when the bucket is owned by another account,
|
|
4191
|
+
* closing the predictable-name squatting hole (a foreign bucket that
|
|
4192
|
+
* ALLOWS this account would otherwise silently receive state
|
|
4193
|
+
* reads/writes). Best-effort: resolves to an empty object for
|
|
4194
|
+
* non-standard clients (test doubles) — see expected-bucket-owner.ts.
|
|
4195
|
+
*/
|
|
4196
|
+
async ownerParam() {
|
|
4197
|
+
return expectedOwnerParam(this.s3Client);
|
|
4198
|
+
}
|
|
4098
4199
|
async verifyBucketExists() {
|
|
4099
4200
|
await this.ensureClientForBucket();
|
|
4100
4201
|
try {
|
|
4101
|
-
await this.s3Client.send(new HeadBucketCommand({
|
|
4202
|
+
await this.s3Client.send(new HeadBucketCommand({
|
|
4203
|
+
Bucket: this.config.bucket,
|
|
4204
|
+
...await this.ownerParam()
|
|
4205
|
+
}));
|
|
4102
4206
|
} catch (error) {
|
|
4103
4207
|
const name = error.name;
|
|
4104
4208
|
if (name === "NotFound" || name === "NoSuchBucket") throw new StateError(`State bucket '${this.config.bucket}' does not exist. Run 'cdkd bootstrap' to create it, or specify an existing bucket via --state-bucket, CDKD_STATE_BUCKET, or cdk.json context.cdkd.stateBucket.`);
|
|
@@ -4145,6 +4249,7 @@ var S3StateBackend = class {
|
|
|
4145
4249
|
this.logger.debug(`Getting state for stack: ${stackName} (${region})`);
|
|
4146
4250
|
const response = await this.s3Client.send(new GetObjectCommand({
|
|
4147
4251
|
Bucket: this.config.bucket,
|
|
4252
|
+
...await this.ownerParam(),
|
|
4148
4253
|
Key: newKey
|
|
4149
4254
|
}));
|
|
4150
4255
|
if (!response.Body) throw new StateError(`State file for stack '${stackName}' (${region}) has no body`);
|
|
@@ -4207,6 +4312,7 @@ var S3StateBackend = class {
|
|
|
4207
4312
|
const bodyString = JSON.stringify(body, null, 2);
|
|
4208
4313
|
const response = await this.s3Client.send(new PutObjectCommand({
|
|
4209
4314
|
Bucket: this.config.bucket,
|
|
4315
|
+
...await this.ownerParam(),
|
|
4210
4316
|
Key: newKey,
|
|
4211
4317
|
Body: bodyString,
|
|
4212
4318
|
ContentLength: Buffer.byteLength(bodyString),
|
|
@@ -4218,6 +4324,7 @@ var S3StateBackend = class {
|
|
|
4218
4324
|
if (migrateLegacy) try {
|
|
4219
4325
|
await this.s3Client.send(new DeleteObjectCommand({
|
|
4220
4326
|
Bucket: this.config.bucket,
|
|
4327
|
+
...await this.ownerParam(),
|
|
4221
4328
|
Key: this.getLegacyStateKey(stackName)
|
|
4222
4329
|
}));
|
|
4223
4330
|
this.logger.info(`Migrated state for stack '${stackName}' to region-scoped layout (${region})`);
|
|
@@ -4247,11 +4354,13 @@ var S3StateBackend = class {
|
|
|
4247
4354
|
this.logger.debug(`Deleting state: ${stackName} (${region})`);
|
|
4248
4355
|
await this.s3Client.send(new DeleteObjectCommand({
|
|
4249
4356
|
Bucket: this.config.bucket,
|
|
4357
|
+
...await this.ownerParam(),
|
|
4250
4358
|
Key: this.getStateKey(stackName, region)
|
|
4251
4359
|
}));
|
|
4252
4360
|
if (await this.legacyMatchesRegion(stackName, region)) {
|
|
4253
4361
|
await this.s3Client.send(new DeleteObjectCommand({
|
|
4254
4362
|
Bucket: this.config.bucket,
|
|
4363
|
+
...await this.ownerParam(),
|
|
4255
4364
|
Key: this.getLegacyStateKey(stackName)
|
|
4256
4365
|
}));
|
|
4257
4366
|
this.logger.debug(`Deleted legacy state for stack: ${stackName}`);
|
|
@@ -4290,6 +4399,7 @@ var S3StateBackend = class {
|
|
|
4290
4399
|
do {
|
|
4291
4400
|
const response = await this.s3Client.send(new ListObjectsV2Command({
|
|
4292
4401
|
Bucket: this.config.bucket,
|
|
4402
|
+
...await this.ownerParam(),
|
|
4293
4403
|
Prefix: prefix,
|
|
4294
4404
|
...continuationToken && { ContinuationToken: continuationToken }
|
|
4295
4405
|
}));
|
|
@@ -4349,6 +4459,7 @@ var S3StateBackend = class {
|
|
|
4349
4459
|
await this.ensureClientForBucket();
|
|
4350
4460
|
await this.s3Client.send(new PutObjectCommand({
|
|
4351
4461
|
Bucket: this.config.bucket,
|
|
4462
|
+
...await this.ownerParam(),
|
|
4352
4463
|
Key: key,
|
|
4353
4464
|
Body: body,
|
|
4354
4465
|
ContentLength: Buffer.byteLength(body),
|
|
@@ -4364,6 +4475,7 @@ var S3StateBackend = class {
|
|
|
4364
4475
|
try {
|
|
4365
4476
|
return await (await this.s3Client.send(new GetObjectCommand({
|
|
4366
4477
|
Bucket: this.config.bucket,
|
|
4478
|
+
...await this.ownerParam(),
|
|
4367
4479
|
Key: key
|
|
4368
4480
|
}))).Body?.transformToString() ?? null;
|
|
4369
4481
|
} catch (error) {
|
|
@@ -4383,6 +4495,7 @@ var S3StateBackend = class {
|
|
|
4383
4495
|
do {
|
|
4384
4496
|
const response = await this.s3Client.send(new ListObjectsV2Command({
|
|
4385
4497
|
Bucket: this.config.bucket,
|
|
4498
|
+
...await this.ownerParam(),
|
|
4386
4499
|
Prefix: keyPrefix,
|
|
4387
4500
|
...continuationToken && { ContinuationToken: continuationToken }
|
|
4388
4501
|
}));
|
|
@@ -4413,6 +4526,7 @@ var S3StateBackend = class {
|
|
|
4413
4526
|
const chunk = keys.slice(i, i + 1e3);
|
|
4414
4527
|
const response = await this.s3Client.send(new DeleteObjectsCommand({
|
|
4415
4528
|
Bucket: this.config.bucket,
|
|
4529
|
+
...await this.ownerParam(),
|
|
4416
4530
|
Delete: {
|
|
4417
4531
|
Objects: chunk.map((Key) => ({ Key })),
|
|
4418
4532
|
Quiet: true
|
|
@@ -4430,6 +4544,7 @@ var S3StateBackend = class {
|
|
|
4430
4544
|
try {
|
|
4431
4545
|
await this.s3Client.send(new HeadObjectCommand({
|
|
4432
4546
|
Bucket: this.config.bucket,
|
|
4547
|
+
...await this.ownerParam(),
|
|
4433
4548
|
Key: key
|
|
4434
4549
|
}));
|
|
4435
4550
|
return true;
|
|
@@ -4447,6 +4562,7 @@ var S3StateBackend = class {
|
|
|
4447
4562
|
try {
|
|
4448
4563
|
const response = await this.s3Client.send(new GetObjectCommand({
|
|
4449
4564
|
Bucket: this.config.bucket,
|
|
4565
|
+
...await this.ownerParam(),
|
|
4450
4566
|
Key: this.getLegacyStateKey(stackName)
|
|
4451
4567
|
}));
|
|
4452
4568
|
if (!response.Body) return void 0;
|
|
@@ -4470,6 +4586,7 @@ var S3StateBackend = class {
|
|
|
4470
4586
|
try {
|
|
4471
4587
|
const response = await this.s3Client.send(new GetObjectCommand({
|
|
4472
4588
|
Bucket: this.config.bucket,
|
|
4589
|
+
...await this.ownerParam(),
|
|
4473
4590
|
Key: this.getLegacyStateKey(stackName)
|
|
4474
4591
|
}));
|
|
4475
4592
|
if (!response.Body || !response.ETag) return null;
|
|
@@ -4567,6 +4684,14 @@ var LockManager = class {
|
|
|
4567
4684
|
* so when the state backend has already resolved the same bucket this
|
|
4568
4685
|
* incurs no additional `GetBucketLocation` call.
|
|
4569
4686
|
*/
|
|
4687
|
+
/**
|
|
4688
|
+
* `ExpectedBucketOwner` spread for every state-bucket S3 call (squatting
|
|
4689
|
+
* hardening — see src/utils/expected-bucket-owner.ts). Best-effort:
|
|
4690
|
+
* resolves to an empty object for non-standard clients (test doubles).
|
|
4691
|
+
*/
|
|
4692
|
+
async ownerParam() {
|
|
4693
|
+
return expectedOwnerParam(this.s3Client);
|
|
4694
|
+
}
|
|
4570
4695
|
async ensureClientForBucket() {
|
|
4571
4696
|
if (this.clientResolved) return;
|
|
4572
4697
|
if (this.resolveInFlight) return this.resolveInFlight;
|
|
@@ -4656,6 +4781,7 @@ var LockManager = class {
|
|
|
4656
4781
|
const lockBody = JSON.stringify(lockInfo, null, 2);
|
|
4657
4782
|
await this.s3Client.send(new PutObjectCommand({
|
|
4658
4783
|
Bucket: this.config.bucket,
|
|
4784
|
+
...await this.ownerParam(),
|
|
4659
4785
|
Key: key,
|
|
4660
4786
|
Body: lockBody,
|
|
4661
4787
|
ContentLength: Buffer.byteLength(lockBody),
|
|
@@ -4675,6 +4801,7 @@ var LockManager = class {
|
|
|
4675
4801
|
const retryBody = JSON.stringify(lockInfo, null, 2);
|
|
4676
4802
|
await this.s3Client.send(new PutObjectCommand({
|
|
4677
4803
|
Bucket: this.config.bucket,
|
|
4804
|
+
...await this.ownerParam(),
|
|
4678
4805
|
Key: key,
|
|
4679
4806
|
Body: retryBody,
|
|
4680
4807
|
ContentLength: Buffer.byteLength(retryBody),
|
|
@@ -4710,6 +4837,7 @@ var LockManager = class {
|
|
|
4710
4837
|
this.logger.debug(`Getting lock info for stack: ${stackName}`);
|
|
4711
4838
|
const response = await this.s3Client.send(new GetObjectCommand({
|
|
4712
4839
|
Bucket: this.config.bucket,
|
|
4840
|
+
...await this.ownerParam(),
|
|
4713
4841
|
Key: key
|
|
4714
4842
|
}));
|
|
4715
4843
|
if (!response.Body) throw new LockError(`Lock file for stack '${stackName}' has no body`);
|
|
@@ -4747,6 +4875,7 @@ var LockManager = class {
|
|
|
4747
4875
|
this.logger.debug(`Releasing lock for stack: ${stackName} (${region})`);
|
|
4748
4876
|
await this.s3Client.send(new DeleteObjectCommand({
|
|
4749
4877
|
Bucket: this.config.bucket,
|
|
4878
|
+
...await this.ownerParam(),
|
|
4750
4879
|
Key: key
|
|
4751
4880
|
}));
|
|
4752
4881
|
this.logger.debug(`Lock released for stack: ${stackName} (${region})`);
|
|
@@ -4780,6 +4909,7 @@ var LockManager = class {
|
|
|
4780
4909
|
const key = this.getLockKey(stackName, region);
|
|
4781
4910
|
await this.s3Client.send(new DeleteObjectCommand({
|
|
4782
4911
|
Bucket: this.config.bucket,
|
|
4912
|
+
...await this.ownerParam(),
|
|
4783
4913
|
Key: key
|
|
4784
4914
|
}));
|
|
4785
4915
|
}
|
|
@@ -9451,7 +9581,7 @@ var CloudControlProvider = class {
|
|
|
9451
9581
|
this.logger.debug(`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
|
|
9452
9582
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
9453
9583
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
9454
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
9584
|
+
const { ASGProvider } = await import("./asg-provider-Dbl1_mwT.js").then((n) => n.n);
|
|
9455
9585
|
await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
|
|
9456
9586
|
return;
|
|
9457
9587
|
}
|
|
@@ -15767,5 +15897,5 @@ var DeployEngine = class {
|
|
|
15767
15897
|
};
|
|
15768
15898
|
|
|
15769
15899
|
//#endregion
|
|
15770
|
-
export { AssetManifestLoader as $, DiffCalculator as A, buildAssetRedirectMap as B, findActionableSilentDrops as C, refStateLookupFromResource as D, cfnRefValueFromPhysicalId as E, rebuildClientForBucketRegion as F, BOOTSTRAP_MARKER_PREFIX as G, loadPublishableAssetManifest as H, shouldRetainResource as I, buildDockerImage as J, ensureAssetStorage as K, AssetPublisher as L, TemplateParser as M, LockManager as N, WAFv2WebACLProvider as O, S3StateBackend as P, runDockerStreaming as Q, stringifyValue as R, ProviderRegistry as S, IntrinsicFunctionResolver as T, rewriteTemplateAssetReferences as U, createAssetRedirectResolver as V, AssetModeResolver as W, getDockerCmd as X, formatDockerLoginError as Y, runDockerForeground as Z, green as _,
|
|
15771
|
-
//# sourceMappingURL=deploy-engine-
|
|
15900
|
+
export { AssetManifestLoader as $, DiffCalculator as A, buildAssetRedirectMap as B, findActionableSilentDrops as C, refStateLookupFromResource as D, cfnRefValueFromPhysicalId as E, rebuildClientForBucketRegion as F, BOOTSTRAP_MARKER_PREFIX as G, loadPublishableAssetManifest as H, shouldRetainResource as I, buildDockerImage as J, ensureAssetStorage as K, AssetPublisher as L, TemplateParser as M, LockManager as N, WAFv2WebACLProvider as O, S3StateBackend as P, runDockerStreaming as Q, stringifyValue as R, ProviderRegistry as S, IntrinsicFunctionResolver as T, rewriteTemplateAssetReferences as U, createAssetRedirectResolver as V, AssetModeResolver as W, getDockerCmd as X, formatDockerLoginError as Y, runDockerForeground as Z, green as _, uploadCfnTemplate as _t, withRetry as a, resolveApp as at, IAMRoleProvider as b, resolveBucketRegion as bt, computeImplicitDeleteEdges as c, resolveSkipPrefix as ct, isStatefulRecreateTargetSync as d, resolveUseCdkBootstrapAssets as dt, getDockerImageBySourceHash as et, renderStatefulReason as f, warnDeprecatedNoPrefixCliFlag as ft, gray as g, findLargeInlineResources as gt, cyan as h, MIGRATE_TMP_PREFIX as ht, withResourceDeadline as i, getLegacyStateBucketName as it, DagBuilder as j, applyRoleArnIfSet as k, extractDeploymentEventError as l, resolveStateBucketWithDefault as lt, bold as m, CFN_TEMPLATE_URL_LIMIT as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, synthesisStatusMessage as nt, isRetryableTransientError as o, resolveAutoAssetStorage as ot, formatResourceLine as p, CFN_TEMPLATE_BODY_LIMIT as pt, parseBootstrapMarker as q, DeployEngine as r, getDefaultStateBucketName as rt, IMPLICIT_DELETE_DEPENDENCIES as s, resolveCaptureObservedState as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, Synthesizer as tt, MULTI_REGION_RECREATE_BLOCKED_TYPES as u, resolveStateBucketWithDefaultAndSource as ut, red as v, AssemblyReader as vt, CloudControlProvider as w, collectInlinePolicyNamesManagedBySiblings as x, yellow as y, clearBucketRegionCache as yt, WorkGraph as z };
|
|
15901
|
+
//# sourceMappingURL=deploy-engine-iahWC4C1.js.map
|