@go-to-k/cdkd 0.8.0 → 0.10.0
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/cli.js +1200 -196
- package/dist/cli.js.map +4 -4
- package/dist/go-to-k-cdkd-0.10.0.tgz +0 -0
- package/dist/index.js +214 -22
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.8.0.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -885,6 +885,40 @@ function withErrorHandling(fn) {
|
|
|
885
885
|
}
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
|
+
function normalizeAwsError(err, context = {}) {
|
|
889
|
+
if (!(err instanceof Error)) {
|
|
890
|
+
return new Error(String(err));
|
|
891
|
+
}
|
|
892
|
+
const isUnknown = err.name === "Unknown" || err.message === "UnknownError";
|
|
893
|
+
if (!isUnknown)
|
|
894
|
+
return err;
|
|
895
|
+
const meta = err.$metadata;
|
|
896
|
+
const status = meta?.httpStatusCode;
|
|
897
|
+
const bucket = context.bucket ?? "<unknown bucket>";
|
|
898
|
+
const operation = context.operation ?? "operation";
|
|
899
|
+
switch (status) {
|
|
900
|
+
case 301: {
|
|
901
|
+
const responseHeaders = err.$response?.headers;
|
|
902
|
+
const region = responseHeaders?.["x-amz-bucket-region"] ?? responseHeaders?.["X-Amz-Bucket-Region"];
|
|
903
|
+
const where = region ? ` (in ${region})` : "";
|
|
904
|
+
return new Error(
|
|
905
|
+
`Bucket '${bucket}'${where} is in a different region than the client. cdkd resolves this automatically; if you see this message, please report it.`
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
case 403:
|
|
909
|
+
return new Error(
|
|
910
|
+
`Access denied to bucket '${bucket}'. Verify credentials and bucket policy.`
|
|
911
|
+
);
|
|
912
|
+
case 404:
|
|
913
|
+
return new Error(`Bucket '${bucket}' does not exist.`);
|
|
914
|
+
default: {
|
|
915
|
+
const statusStr = status !== void 0 ? `HTTP ${status}` : "unknown HTTP status";
|
|
916
|
+
return new Error(
|
|
917
|
+
`S3 error during ${operation} on '${bucket}' (${statusStr}). See CloudTrail for details.`
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
888
922
|
|
|
889
923
|
// src/cli/commands/bootstrap.ts
|
|
890
924
|
init_aws_clients();
|
|
@@ -995,7 +1029,7 @@ async function bootstrapCommand(options) {
|
|
|
995
1029
|
if (err.name === "NotFound" || err.name === "NoSuchBucket") {
|
|
996
1030
|
logger.debug(`Bucket ${bucketName} does not exist, will create`);
|
|
997
1031
|
} else {
|
|
998
|
-
throw error;
|
|
1032
|
+
throw normalizeAwsError(error, { bucket: bucketName, operation: "HeadBucket" });
|
|
999
1033
|
}
|
|
1000
1034
|
}
|
|
1001
1035
|
if (bucketExists) {
|
|
@@ -3197,6 +3231,7 @@ var AssetPublisher = class {
|
|
|
3197
3231
|
|
|
3198
3232
|
// src/state/s3-state-backend.ts
|
|
3199
3233
|
import {
|
|
3234
|
+
S3Client as S3Client4,
|
|
3200
3235
|
GetObjectCommand,
|
|
3201
3236
|
PutObjectCommand as PutObjectCommand2,
|
|
3202
3237
|
DeleteObjectCommand,
|
|
@@ -3210,15 +3245,44 @@ import {
|
|
|
3210
3245
|
var STATE_SCHEMA_VERSION_LEGACY = 1;
|
|
3211
3246
|
var STATE_SCHEMA_VERSION_CURRENT = 2;
|
|
3212
3247
|
|
|
3248
|
+
// src/utils/aws-region-resolver.ts
|
|
3249
|
+
import { GetBucketLocationCommand, S3Client as S3Client3 } from "@aws-sdk/client-s3";
|
|
3250
|
+
var cache = /* @__PURE__ */ new Map();
|
|
3251
|
+
async function resolveBucketRegion(bucketName, opts = {}) {
|
|
3252
|
+
const cached = cache.get(bucketName);
|
|
3253
|
+
if (cached)
|
|
3254
|
+
return cached;
|
|
3255
|
+
const promise = (async () => {
|
|
3256
|
+
const client = new S3Client3({
|
|
3257
|
+
region: "us-east-1",
|
|
3258
|
+
...opts.profile && { profile: opts.profile },
|
|
3259
|
+
...opts.credentials && { credentials: opts.credentials }
|
|
3260
|
+
});
|
|
3261
|
+
try {
|
|
3262
|
+
const response = await client.send(new GetBucketLocationCommand({ Bucket: bucketName }));
|
|
3263
|
+
return response.LocationConstraint || "us-east-1";
|
|
3264
|
+
} catch {
|
|
3265
|
+
return opts.fallbackRegion ?? "us-east-1";
|
|
3266
|
+
} finally {
|
|
3267
|
+
client.destroy();
|
|
3268
|
+
}
|
|
3269
|
+
})();
|
|
3270
|
+
cache.set(bucketName, promise);
|
|
3271
|
+
return promise;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3213
3274
|
// src/state/s3-state-backend.ts
|
|
3214
3275
|
var LEGACY_KEY_DEPTH = 2;
|
|
3215
3276
|
var NEW_KEY_DEPTH = 3;
|
|
3216
3277
|
var S3StateBackend = class {
|
|
3217
|
-
constructor(s3Client, config) {
|
|
3278
|
+
constructor(s3Client, config, clientOpts = {}) {
|
|
3218
3279
|
this.s3Client = s3Client;
|
|
3219
3280
|
this.config = config;
|
|
3281
|
+
this.clientOpts = clientOpts;
|
|
3220
3282
|
}
|
|
3221
3283
|
logger = getLogger().child("S3StateBackend");
|
|
3284
|
+
clientResolved = false;
|
|
3285
|
+
resolveInFlight = null;
|
|
3222
3286
|
/**
|
|
3223
3287
|
* Get the new (region-scoped) S3 key for a stack's state file.
|
|
3224
3288
|
*/
|
|
@@ -3232,13 +3296,73 @@ var S3StateBackend = class {
|
|
|
3232
3296
|
getLegacyStateKey(stackName) {
|
|
3233
3297
|
return `${this.config.prefix}/${stackName}/state.json`;
|
|
3234
3298
|
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Resolve the state bucket's actual region and, if it differs from the
|
|
3301
|
+
* client's currently-configured region, replace the S3Client with one
|
|
3302
|
+
* pointed at the bucket's region.
|
|
3303
|
+
*
|
|
3304
|
+
* This is idempotent: subsequent calls return immediately. Concurrent
|
|
3305
|
+
* callers (e.g. when several public methods race during a parallel deploy)
|
|
3306
|
+
* share a single in-flight resolution promise so we never issue more than
|
|
3307
|
+
* one `GetBucketLocation` per backend.
|
|
3308
|
+
*
|
|
3309
|
+
* Errors from `GetBucketLocation` are deliberately swallowed by
|
|
3310
|
+
* `resolveBucketRegion` — the resolver returns `fallbackRegion` so the
|
|
3311
|
+
* caller can surface the more actionable downstream error (e.g. the
|
|
3312
|
+
* `HeadBucket` 404 routed via `normalizeAwsError`).
|
|
3313
|
+
*/
|
|
3314
|
+
async ensureClientForBucket() {
|
|
3315
|
+
if (this.clientResolved)
|
|
3316
|
+
return;
|
|
3317
|
+
if (this.resolveInFlight)
|
|
3318
|
+
return this.resolveInFlight;
|
|
3319
|
+
this.resolveInFlight = (async () => {
|
|
3320
|
+
try {
|
|
3321
|
+
const currentRegion = await this.s3Client.config.region();
|
|
3322
|
+
const fallbackRegion = typeof currentRegion === "string" ? currentRegion : void 0;
|
|
3323
|
+
const bucketRegion = await resolveBucketRegion(this.config.bucket, {
|
|
3324
|
+
...this.clientOpts.profile && { profile: this.clientOpts.profile },
|
|
3325
|
+
...this.clientOpts.credentials && { credentials: this.clientOpts.credentials },
|
|
3326
|
+
...fallbackRegion && { fallbackRegion }
|
|
3327
|
+
});
|
|
3328
|
+
if (bucketRegion !== currentRegion) {
|
|
3329
|
+
this.logger.debug(
|
|
3330
|
+
`State bucket '${this.config.bucket}' is in '${bucketRegion}' (client was '${currentRegion}'); rebuilding S3 client.`
|
|
3331
|
+
);
|
|
3332
|
+
const oldClient = this.s3Client;
|
|
3333
|
+
this.s3Client = new S3Client4({
|
|
3334
|
+
region: bucketRegion,
|
|
3335
|
+
...this.clientOpts.profile && { profile: this.clientOpts.profile },
|
|
3336
|
+
...this.clientOpts.credentials && { credentials: this.clientOpts.credentials },
|
|
3337
|
+
// Suppress "Are you using a Stream of unknown length" warning,
|
|
3338
|
+
// matching the suppression in AwsClients.
|
|
3339
|
+
logger: { debug: () => {
|
|
3340
|
+
}, info: () => {
|
|
3341
|
+
}, warn: () => {
|
|
3342
|
+
}, error: () => {
|
|
3343
|
+
} }
|
|
3344
|
+
});
|
|
3345
|
+
oldClient.destroy();
|
|
3346
|
+
}
|
|
3347
|
+
this.clientResolved = true;
|
|
3348
|
+
} finally {
|
|
3349
|
+
this.resolveInFlight = null;
|
|
3350
|
+
}
|
|
3351
|
+
})();
|
|
3352
|
+
return this.resolveInFlight;
|
|
3353
|
+
}
|
|
3235
3354
|
/**
|
|
3236
3355
|
* Verify that the configured state bucket exists.
|
|
3237
3356
|
*
|
|
3238
3357
|
* Called early in deploy/destroy to fail fast before expensive work
|
|
3239
3358
|
* (asset publishing, Docker builds) runs against a missing bucket.
|
|
3359
|
+
*
|
|
3360
|
+
* Errors are routed through {@link normalizeAwsError} so the AWS SDK v3
|
|
3361
|
+
* synthetic `UnknownError` (e.g. cross-region HEAD) becomes a concrete
|
|
3362
|
+
* "Bucket does not exist" / "Access denied" / "different region" message.
|
|
3240
3363
|
*/
|
|
3241
3364
|
async verifyBucketExists() {
|
|
3365
|
+
await this.ensureClientForBucket();
|
|
3242
3366
|
try {
|
|
3243
3367
|
await this.s3Client.send(new HeadBucketCommand2({ Bucket: this.config.bucket }));
|
|
3244
3368
|
} catch (error) {
|
|
@@ -3248,9 +3372,13 @@ var S3StateBackend = class {
|
|
|
3248
3372
|
`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.`
|
|
3249
3373
|
);
|
|
3250
3374
|
}
|
|
3375
|
+
const normalized = normalizeAwsError(error, {
|
|
3376
|
+
bucket: this.config.bucket,
|
|
3377
|
+
operation: "HeadBucket"
|
|
3378
|
+
});
|
|
3251
3379
|
throw new StateError(
|
|
3252
|
-
`Failed to verify state bucket '${this.config.bucket}': ${
|
|
3253
|
-
|
|
3380
|
+
`Failed to verify state bucket '${this.config.bucket}': ${normalized.message}`,
|
|
3381
|
+
normalized
|
|
3254
3382
|
);
|
|
3255
3383
|
}
|
|
3256
3384
|
}
|
|
@@ -3263,6 +3391,7 @@ var S3StateBackend = class {
|
|
|
3263
3391
|
* state without forcing a write-through migration first.
|
|
3264
3392
|
*/
|
|
3265
3393
|
async stateExists(stackName, region) {
|
|
3394
|
+
await this.ensureClientForBucket();
|
|
3266
3395
|
const newKey = this.getStateKey(stackName, region);
|
|
3267
3396
|
if (await this.headObject(newKey)) {
|
|
3268
3397
|
return true;
|
|
@@ -3285,6 +3414,7 @@ var S3StateBackend = class {
|
|
|
3285
3414
|
* preserve the quotes — they are required for `IfMatch` conditions.
|
|
3286
3415
|
*/
|
|
3287
3416
|
async getState(stackName, region) {
|
|
3417
|
+
await this.ensureClientForBucket();
|
|
3288
3418
|
const newKey = this.getStateKey(stackName, region);
|
|
3289
3419
|
try {
|
|
3290
3420
|
this.logger.debug(`Getting state for stack: ${stackName} (${region})`);
|
|
@@ -3344,6 +3474,7 @@ var S3StateBackend = class {
|
|
|
3344
3474
|
* @returns New ETag (with quotes, e.g., `"abc123"`)
|
|
3345
3475
|
*/
|
|
3346
3476
|
async saveState(stackName, region, state, options = {}) {
|
|
3477
|
+
await this.ensureClientForBucket();
|
|
3347
3478
|
const newKey = this.getStateKey(stackName, region);
|
|
3348
3479
|
const { expectedEtag, migrateLegacy } = options;
|
|
3349
3480
|
const body = {
|
|
@@ -3399,9 +3530,13 @@ var S3StateBackend = class {
|
|
|
3399
3530
|
`State has been modified by another process. Expected ETag: ${expectedEtag}, but state has changed.`
|
|
3400
3531
|
);
|
|
3401
3532
|
}
|
|
3533
|
+
const normalized = normalizeAwsError(error, {
|
|
3534
|
+
bucket: this.config.bucket,
|
|
3535
|
+
operation: "PutObject"
|
|
3536
|
+
});
|
|
3402
3537
|
throw new StateError(
|
|
3403
|
-
`Failed to save state for stack '${stackName}' (${region}): ${
|
|
3404
|
-
|
|
3538
|
+
`Failed to save state for stack '${stackName}' (${region}): ${normalized.message}`,
|
|
3539
|
+
normalized
|
|
3405
3540
|
);
|
|
3406
3541
|
}
|
|
3407
3542
|
}
|
|
@@ -3413,6 +3548,7 @@ var S3StateBackend = class {
|
|
|
3413
3548
|
* field is left alone.
|
|
3414
3549
|
*/
|
|
3415
3550
|
async deleteState(stackName, region) {
|
|
3551
|
+
await this.ensureClientForBucket();
|
|
3416
3552
|
try {
|
|
3417
3553
|
this.logger.debug(`Deleting state: ${stackName} (${region})`);
|
|
3418
3554
|
await this.s3Client.send(
|
|
@@ -3432,9 +3568,13 @@ var S3StateBackend = class {
|
|
|
3432
3568
|
}
|
|
3433
3569
|
this.logger.debug(`State deleted: ${stackName} (${region})`);
|
|
3434
3570
|
} catch (error) {
|
|
3571
|
+
const normalized = normalizeAwsError(error, {
|
|
3572
|
+
bucket: this.config.bucket,
|
|
3573
|
+
operation: "DeleteObject"
|
|
3574
|
+
});
|
|
3435
3575
|
throw new StateError(
|
|
3436
|
-
`Failed to delete state for stack '${stackName}' (${region}): ${
|
|
3437
|
-
|
|
3576
|
+
`Failed to delete state for stack '${stackName}' (${region}): ${normalized.message}`,
|
|
3577
|
+
normalized
|
|
3438
3578
|
);
|
|
3439
3579
|
}
|
|
3440
3580
|
}
|
|
@@ -3453,6 +3593,7 @@ var S3StateBackend = class {
|
|
|
3453
3593
|
* shows up exactly once.
|
|
3454
3594
|
*/
|
|
3455
3595
|
async listStacks() {
|
|
3596
|
+
await this.ensureClientForBucket();
|
|
3456
3597
|
try {
|
|
3457
3598
|
this.logger.debug("Listing all stacks");
|
|
3458
3599
|
const prefix = `${this.config.prefix}/`;
|
|
@@ -3503,10 +3644,11 @@ var S3StateBackend = class {
|
|
|
3503
3644
|
this.logger.debug(`Found ${refs.length} stack(s) across regions`);
|
|
3504
3645
|
return refs;
|
|
3505
3646
|
} catch (error) {
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
);
|
|
3647
|
+
const normalized = normalizeAwsError(error, {
|
|
3648
|
+
bucket: this.config.bucket,
|
|
3649
|
+
operation: "ListObjectsV2"
|
|
3650
|
+
});
|
|
3651
|
+
throw new StateError(`Failed to list stacks: ${normalized.message}`, normalized);
|
|
3510
3652
|
}
|
|
3511
3653
|
}
|
|
3512
3654
|
/**
|
|
@@ -6196,6 +6338,29 @@ var JsonPatchGenerator = class {
|
|
|
6196
6338
|
}
|
|
6197
6339
|
};
|
|
6198
6340
|
|
|
6341
|
+
// src/provisioning/region-check.ts
|
|
6342
|
+
function assertRegionMatch(clientRegion, expectedRegion, resourceType, logicalId, physicalId) {
|
|
6343
|
+
if (!expectedRegion) {
|
|
6344
|
+
return;
|
|
6345
|
+
}
|
|
6346
|
+
if (!clientRegion) {
|
|
6347
|
+
throw new ProvisioningError(
|
|
6348
|
+
`Refusing to treat NotFound as idempotent delete success for ${logicalId} (${resourceType}): AWS client region is unknown but stack state expects ${expectedRegion}. The resource may exist in ${expectedRegion} and would be silently removed from state if this NotFound were trusted.`,
|
|
6349
|
+
resourceType,
|
|
6350
|
+
logicalId,
|
|
6351
|
+
physicalId
|
|
6352
|
+
);
|
|
6353
|
+
}
|
|
6354
|
+
if (clientRegion !== expectedRegion) {
|
|
6355
|
+
throw new ProvisioningError(
|
|
6356
|
+
`Refusing to treat NotFound as idempotent delete success for ${logicalId} (${resourceType}): AWS client region ${clientRegion} does not match stack state region ${expectedRegion}. The resource likely still exists in ${expectedRegion}; rerun the destroy with the correct region (e.g. --region ${expectedRegion}).`,
|
|
6357
|
+
resourceType,
|
|
6358
|
+
logicalId,
|
|
6359
|
+
physicalId
|
|
6360
|
+
);
|
|
6361
|
+
}
|
|
6362
|
+
}
|
|
6363
|
+
|
|
6199
6364
|
// src/provisioning/cloud-control-provider.ts
|
|
6200
6365
|
var JSON_STRING_PROPERTIES = {
|
|
6201
6366
|
"AWS::Events::Rule": /* @__PURE__ */ new Set(["EventPattern"])
|
|
@@ -6371,7 +6536,7 @@ var CloudControlProvider = class {
|
|
|
6371
6536
|
/**
|
|
6372
6537
|
* Delete a resource using Cloud Control API
|
|
6373
6538
|
*/
|
|
6374
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
6539
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
6375
6540
|
this.logger.debug(
|
|
6376
6541
|
`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`
|
|
6377
6542
|
);
|
|
@@ -6398,6 +6563,14 @@ var CloudControlProvider = class {
|
|
|
6398
6563
|
} catch (error) {
|
|
6399
6564
|
const err = error;
|
|
6400
6565
|
if (err.name === "ResourceNotFoundException" || err.message?.includes("does not exist") || err.message?.includes("not found") || err.message?.includes("NotFound")) {
|
|
6566
|
+
const clientRegion = await this.cloudControlClient.config.region();
|
|
6567
|
+
assertRegionMatch(
|
|
6568
|
+
clientRegion,
|
|
6569
|
+
context?.expectedRegion,
|
|
6570
|
+
resourceType,
|
|
6571
|
+
logicalId,
|
|
6572
|
+
physicalId
|
|
6573
|
+
);
|
|
6401
6574
|
this.logger.debug(`Resource ${logicalId} already deleted (not found), treating as success`);
|
|
6402
6575
|
return;
|
|
6403
6576
|
}
|
|
@@ -6773,7 +6946,7 @@ Error: ${err.message || "Unknown error"}`,
|
|
|
6773
6946
|
import { InvokeCommand } from "@aws-sdk/client-lambda";
|
|
6774
6947
|
import { PublishCommand } from "@aws-sdk/client-sns";
|
|
6775
6948
|
import {
|
|
6776
|
-
S3Client as
|
|
6949
|
+
S3Client as S3Client6,
|
|
6777
6950
|
PutObjectCommand as PutObjectCommand4,
|
|
6778
6951
|
GetObjectCommand as GetObjectCommand3,
|
|
6779
6952
|
DeleteObjectCommand as DeleteObjectCommand3
|
|
@@ -6842,7 +7015,7 @@ var CustomResourceProvider = class _CustomResourceProvider {
|
|
|
6842
7015
|
setResponseBucket(bucket, bucketRegion) {
|
|
6843
7016
|
this.responseBucket = bucket;
|
|
6844
7017
|
if (bucketRegion) {
|
|
6845
|
-
this.s3Client = new
|
|
7018
|
+
this.s3Client = new S3Client6(bucketRegion ? { region: bucketRegion } : {});
|
|
6846
7019
|
}
|
|
6847
7020
|
}
|
|
6848
7021
|
/**
|
|
@@ -6962,7 +7135,7 @@ var CustomResourceProvider = class _CustomResourceProvider {
|
|
|
6962
7135
|
/**
|
|
6963
7136
|
* Delete a custom resource by invoking its Lambda handler
|
|
6964
7137
|
*/
|
|
6965
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
7138
|
+
async delete(logicalId, physicalId, resourceType, properties, _context) {
|
|
6966
7139
|
this.logger.debug(`Deleting custom resource ${logicalId}: ${physicalId} (${resourceType})`);
|
|
6967
7140
|
if (!properties) {
|
|
6968
7141
|
this.logger.warn(
|
|
@@ -7784,13 +7957,21 @@ var IAMRoleProvider = class {
|
|
|
7784
7957
|
* 3. Remove role from all instance profiles
|
|
7785
7958
|
* 4. Delete the role itself
|
|
7786
7959
|
*/
|
|
7787
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
7960
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
7788
7961
|
this.logger.debug(`Deleting IAM role ${logicalId}: ${physicalId}`);
|
|
7789
7962
|
try {
|
|
7790
7963
|
try {
|
|
7791
7964
|
await this.iamClient.send(new GetRoleCommand({ RoleName: physicalId }));
|
|
7792
7965
|
} catch (error) {
|
|
7793
7966
|
if (error instanceof NoSuchEntityException) {
|
|
7967
|
+
const clientRegion = await this.iamClient.config.region();
|
|
7968
|
+
assertRegionMatch(
|
|
7969
|
+
clientRegion,
|
|
7970
|
+
context?.expectedRegion,
|
|
7971
|
+
resourceType,
|
|
7972
|
+
logicalId,
|
|
7973
|
+
physicalId
|
|
7974
|
+
);
|
|
7794
7975
|
this.logger.debug(`Role ${physicalId} does not exist, skipping deletion`);
|
|
7795
7976
|
return;
|
|
7796
7977
|
}
|
|
@@ -8285,13 +8466,23 @@ var IAMPolicyProvider = class {
|
|
|
8285
8466
|
/**
|
|
8286
8467
|
* Delete an IAM inline policy
|
|
8287
8468
|
*/
|
|
8288
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
8469
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
8289
8470
|
this.logger.debug(`Deleting IAM policy ${logicalId}: ${physicalId}`);
|
|
8290
8471
|
const policyName = physicalId.includes(":") ? physicalId.split(":")[0] : physicalId;
|
|
8291
8472
|
if (!policyName) {
|
|
8292
8473
|
this.logger.warn(`Invalid physical ID format: ${physicalId}, skipping deletion`);
|
|
8293
8474
|
return;
|
|
8294
8475
|
}
|
|
8476
|
+
const onNotFound = async (target) => {
|
|
8477
|
+
const clientRegion = await this.iamClient.config.region();
|
|
8478
|
+
assertRegionMatch(
|
|
8479
|
+
clientRegion,
|
|
8480
|
+
context?.expectedRegion,
|
|
8481
|
+
resourceType,
|
|
8482
|
+
logicalId,
|
|
8483
|
+
`${physicalId} (${target})`
|
|
8484
|
+
);
|
|
8485
|
+
};
|
|
8295
8486
|
try {
|
|
8296
8487
|
const roles = properties?.["Roles"];
|
|
8297
8488
|
const groups = properties?.["Groups"];
|
|
@@ -8308,7 +8499,9 @@ var IAMPolicyProvider = class {
|
|
|
8308
8499
|
);
|
|
8309
8500
|
this.logger.debug(`Deleted inline policy ${policyName} from role ${firstRole}`);
|
|
8310
8501
|
} catch (error) {
|
|
8311
|
-
if (
|
|
8502
|
+
if (error instanceof NoSuchEntityException2) {
|
|
8503
|
+
await onNotFound(`role ${firstRole}`);
|
|
8504
|
+
} else {
|
|
8312
8505
|
throw error;
|
|
8313
8506
|
}
|
|
8314
8507
|
}
|
|
@@ -8325,7 +8518,9 @@ var IAMPolicyProvider = class {
|
|
|
8325
8518
|
);
|
|
8326
8519
|
this.logger.debug(`Deleted inline policy ${policyName} from role ${roleName}`);
|
|
8327
8520
|
} catch (error) {
|
|
8328
|
-
if (
|
|
8521
|
+
if (error instanceof NoSuchEntityException2) {
|
|
8522
|
+
await onNotFound(`role ${roleName}`);
|
|
8523
|
+
} else {
|
|
8329
8524
|
throw error;
|
|
8330
8525
|
}
|
|
8331
8526
|
}
|
|
@@ -8342,7 +8537,9 @@ var IAMPolicyProvider = class {
|
|
|
8342
8537
|
);
|
|
8343
8538
|
this.logger.debug(`Deleted inline policy ${policyName} from group ${groupName}`);
|
|
8344
8539
|
} catch (error) {
|
|
8345
|
-
if (
|
|
8540
|
+
if (error instanceof NoSuchEntityException2) {
|
|
8541
|
+
await onNotFound(`group ${groupName}`);
|
|
8542
|
+
} else {
|
|
8346
8543
|
throw error;
|
|
8347
8544
|
}
|
|
8348
8545
|
}
|
|
@@ -8359,7 +8556,9 @@ var IAMPolicyProvider = class {
|
|
|
8359
8556
|
);
|
|
8360
8557
|
this.logger.debug(`Deleted inline policy ${policyName} from user ${userName}`);
|
|
8361
8558
|
} catch (error) {
|
|
8362
|
-
if (
|
|
8559
|
+
if (error instanceof NoSuchEntityException2) {
|
|
8560
|
+
await onNotFound(`user ${userName}`);
|
|
8561
|
+
} else {
|
|
8363
8562
|
throw error;
|
|
8364
8563
|
}
|
|
8365
8564
|
}
|
|
@@ -8517,7 +8716,7 @@ var IAMInstanceProfileProvider = class {
|
|
|
8517
8716
|
*
|
|
8518
8717
|
* Before deleting, removes all roles from the instance profile.
|
|
8519
8718
|
*/
|
|
8520
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
8719
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
8521
8720
|
this.logger.debug(`Deleting IAM instance profile ${logicalId}: ${physicalId}`);
|
|
8522
8721
|
try {
|
|
8523
8722
|
let roles = [];
|
|
@@ -8530,6 +8729,14 @@ var IAMInstanceProfileProvider = class {
|
|
|
8530
8729
|
) || [];
|
|
8531
8730
|
} catch (error) {
|
|
8532
8731
|
if (error instanceof NoSuchEntityException3) {
|
|
8732
|
+
const clientRegion = await this.iamClient.config.region();
|
|
8733
|
+
assertRegionMatch(
|
|
8734
|
+
clientRegion,
|
|
8735
|
+
context?.expectedRegion,
|
|
8736
|
+
resourceType,
|
|
8737
|
+
logicalId,
|
|
8738
|
+
physicalId
|
|
8739
|
+
);
|
|
8533
8740
|
this.logger.debug(`Instance profile ${physicalId} does not exist, skipping deletion`);
|
|
8534
8741
|
return;
|
|
8535
8742
|
}
|
|
@@ -8556,6 +8763,14 @@ var IAMInstanceProfileProvider = class {
|
|
|
8556
8763
|
this.logger.debug(`Successfully deleted IAM instance profile ${logicalId}`);
|
|
8557
8764
|
} catch (error) {
|
|
8558
8765
|
if (error instanceof NoSuchEntityException3) {
|
|
8766
|
+
const clientRegion = await this.iamClient.config.region();
|
|
8767
|
+
assertRegionMatch(
|
|
8768
|
+
clientRegion,
|
|
8769
|
+
context?.expectedRegion,
|
|
8770
|
+
resourceType,
|
|
8771
|
+
logicalId,
|
|
8772
|
+
physicalId
|
|
8773
|
+
);
|
|
8559
8774
|
this.logger.debug(`Instance profile ${physicalId} does not exist, skipping deletion`);
|
|
8560
8775
|
return;
|
|
8561
8776
|
}
|
|
@@ -8675,14 +8890,20 @@ var IAMUserGroupProvider = class {
|
|
|
8675
8890
|
);
|
|
8676
8891
|
}
|
|
8677
8892
|
}
|
|
8678
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
8893
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
8679
8894
|
switch (resourceType) {
|
|
8680
8895
|
case "AWS::IAM::User":
|
|
8681
|
-
return this.deleteUser(logicalId, physicalId, resourceType);
|
|
8896
|
+
return this.deleteUser(logicalId, physicalId, resourceType, context);
|
|
8682
8897
|
case "AWS::IAM::Group":
|
|
8683
|
-
return this.deleteGroup(logicalId, physicalId, resourceType);
|
|
8898
|
+
return this.deleteGroup(logicalId, physicalId, resourceType, context);
|
|
8684
8899
|
case "AWS::IAM::UserToGroupAddition":
|
|
8685
|
-
return this.deleteUserToGroupAddition(
|
|
8900
|
+
return this.deleteUserToGroupAddition(
|
|
8901
|
+
logicalId,
|
|
8902
|
+
physicalId,
|
|
8903
|
+
resourceType,
|
|
8904
|
+
properties,
|
|
8905
|
+
context
|
|
8906
|
+
);
|
|
8686
8907
|
default:
|
|
8687
8908
|
throw new ProvisioningError(
|
|
8688
8909
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -8885,13 +9106,21 @@ var IAMUserGroupProvider = class {
|
|
|
8885
9106
|
);
|
|
8886
9107
|
}
|
|
8887
9108
|
}
|
|
8888
|
-
async deleteUser(logicalId, physicalId, resourceType) {
|
|
9109
|
+
async deleteUser(logicalId, physicalId, resourceType, context) {
|
|
8889
9110
|
this.logger.debug(`Deleting IAM user ${logicalId}: ${physicalId}`);
|
|
8890
9111
|
try {
|
|
8891
9112
|
try {
|
|
8892
9113
|
await this.iamClient.send(new GetUserCommand({ UserName: physicalId }));
|
|
8893
9114
|
} catch (error) {
|
|
8894
9115
|
if (error instanceof NoSuchEntityException4) {
|
|
9116
|
+
const clientRegion = await this.iamClient.config.region();
|
|
9117
|
+
assertRegionMatch(
|
|
9118
|
+
clientRegion,
|
|
9119
|
+
context?.expectedRegion,
|
|
9120
|
+
resourceType,
|
|
9121
|
+
logicalId,
|
|
9122
|
+
physicalId
|
|
9123
|
+
);
|
|
8895
9124
|
this.logger.debug(`User ${physicalId} does not exist, skipping deletion`);
|
|
8896
9125
|
return;
|
|
8897
9126
|
}
|
|
@@ -9231,7 +9460,7 @@ var IAMUserGroupProvider = class {
|
|
|
9231
9460
|
);
|
|
9232
9461
|
}
|
|
9233
9462
|
}
|
|
9234
|
-
async deleteGroup(logicalId, physicalId, resourceType) {
|
|
9463
|
+
async deleteGroup(logicalId, physicalId, resourceType, context) {
|
|
9235
9464
|
this.logger.debug(`Deleting IAM group ${logicalId}: ${physicalId}`);
|
|
9236
9465
|
try {
|
|
9237
9466
|
await this.detachAllGroupPolicies(physicalId);
|
|
@@ -9241,6 +9470,14 @@ var IAMUserGroupProvider = class {
|
|
|
9241
9470
|
this.logger.debug(`Successfully deleted IAM group ${logicalId}`);
|
|
9242
9471
|
} catch (error) {
|
|
9243
9472
|
if (error instanceof NoSuchEntityException4) {
|
|
9473
|
+
const clientRegion = await this.iamClient.config.region();
|
|
9474
|
+
assertRegionMatch(
|
|
9475
|
+
clientRegion,
|
|
9476
|
+
context?.expectedRegion,
|
|
9477
|
+
resourceType,
|
|
9478
|
+
logicalId,
|
|
9479
|
+
physicalId
|
|
9480
|
+
);
|
|
9244
9481
|
this.logger.debug(`Group ${physicalId} does not exist, skipping deletion`);
|
|
9245
9482
|
return;
|
|
9246
9483
|
}
|
|
@@ -9515,7 +9752,7 @@ var IAMUserGroupProvider = class {
|
|
|
9515
9752
|
);
|
|
9516
9753
|
}
|
|
9517
9754
|
}
|
|
9518
|
-
async deleteUserToGroupAddition(logicalId, physicalId, resourceType, properties) {
|
|
9755
|
+
async deleteUserToGroupAddition(logicalId, physicalId, resourceType, properties, _context) {
|
|
9519
9756
|
this.logger.debug(`Deleting IAM UserToGroupAddition ${logicalId}`);
|
|
9520
9757
|
if (!properties) {
|
|
9521
9758
|
this.logger.debug(`No properties for UserToGroupAddition ${logicalId}, skipping deletion`);
|
|
@@ -10389,12 +10626,20 @@ var S3BucketProvider = class {
|
|
|
10389
10626
|
*
|
|
10390
10627
|
* Note: The bucket must be empty before deletion.
|
|
10391
10628
|
*/
|
|
10392
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
10629
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
10393
10630
|
this.logger.debug(`Deleting S3 bucket ${logicalId}: ${physicalId}`);
|
|
10394
10631
|
try {
|
|
10395
10632
|
await this.deleteBucketWithEmptyRetry(logicalId, physicalId);
|
|
10396
10633
|
} catch (error) {
|
|
10397
10634
|
if (error instanceof NoSuchBucket) {
|
|
10635
|
+
const clientRegion = await this.s3Client.config.region();
|
|
10636
|
+
assertRegionMatch(
|
|
10637
|
+
clientRegion,
|
|
10638
|
+
context?.expectedRegion,
|
|
10639
|
+
resourceType,
|
|
10640
|
+
logicalId,
|
|
10641
|
+
physicalId
|
|
10642
|
+
);
|
|
10398
10643
|
this.logger.debug(`Bucket ${physicalId} does not exist, skipping deletion`);
|
|
10399
10644
|
return;
|
|
10400
10645
|
}
|
|
@@ -10589,7 +10834,7 @@ var S3BucketPolicyProvider = class {
|
|
|
10589
10834
|
/**
|
|
10590
10835
|
* Delete an S3 bucket policy
|
|
10591
10836
|
*/
|
|
10592
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
10837
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
10593
10838
|
this.logger.debug(`Deleting S3 bucket policy ${logicalId}: ${physicalId}`);
|
|
10594
10839
|
try {
|
|
10595
10840
|
try {
|
|
@@ -10601,10 +10846,26 @@ var S3BucketPolicyProvider = class {
|
|
|
10601
10846
|
this.logger.debug(`Successfully deleted S3 bucket policy ${logicalId}`);
|
|
10602
10847
|
} catch (error) {
|
|
10603
10848
|
if (error instanceof NoSuchBucket2) {
|
|
10849
|
+
const clientRegion = await this.s3Client.config.region();
|
|
10850
|
+
assertRegionMatch(
|
|
10851
|
+
clientRegion,
|
|
10852
|
+
context?.expectedRegion,
|
|
10853
|
+
resourceType,
|
|
10854
|
+
logicalId,
|
|
10855
|
+
physicalId
|
|
10856
|
+
);
|
|
10604
10857
|
this.logger.debug(`Bucket ${physicalId} does not exist, skipping policy deletion`);
|
|
10605
10858
|
return;
|
|
10606
10859
|
}
|
|
10607
10860
|
if (error instanceof Error && (error.name === "NoSuchBucketPolicy" || error.message.includes("does not have"))) {
|
|
10861
|
+
const clientRegion = await this.s3Client.config.region();
|
|
10862
|
+
assertRegionMatch(
|
|
10863
|
+
clientRegion,
|
|
10864
|
+
context?.expectedRegion,
|
|
10865
|
+
resourceType,
|
|
10866
|
+
logicalId,
|
|
10867
|
+
physicalId
|
|
10868
|
+
);
|
|
10608
10869
|
this.logger.debug(`Bucket policy for ${physicalId} does not exist, skipping`);
|
|
10609
10870
|
return;
|
|
10610
10871
|
}
|
|
@@ -10794,13 +11055,21 @@ var SQSQueueProvider = class {
|
|
|
10794
11055
|
/**
|
|
10795
11056
|
* Delete an SQS queue
|
|
10796
11057
|
*/
|
|
10797
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
11058
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
10798
11059
|
this.logger.debug(`Deleting SQS queue ${logicalId}: ${physicalId}`);
|
|
10799
11060
|
try {
|
|
10800
11061
|
await this.sqsClient.send(new DeleteQueueCommand({ QueueUrl: physicalId }));
|
|
10801
11062
|
this.logger.debug(`Successfully deleted SQS queue ${logicalId}`);
|
|
10802
11063
|
} catch (error) {
|
|
10803
11064
|
if (error instanceof QueueDoesNotExist) {
|
|
11065
|
+
const clientRegion = await this.sqsClient.config.region();
|
|
11066
|
+
assertRegionMatch(
|
|
11067
|
+
clientRegion,
|
|
11068
|
+
context?.expectedRegion,
|
|
11069
|
+
resourceType,
|
|
11070
|
+
logicalId,
|
|
11071
|
+
physicalId
|
|
11072
|
+
);
|
|
10804
11073
|
this.logger.debug(`SQS queue ${physicalId} does not exist, skipping deletion`);
|
|
10805
11074
|
return;
|
|
10806
11075
|
}
|
|
@@ -10949,7 +11218,7 @@ var SQSQueuePolicyProvider = class {
|
|
|
10949
11218
|
/**
|
|
10950
11219
|
* Delete an SQS queue policy
|
|
10951
11220
|
*/
|
|
10952
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
11221
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
10953
11222
|
this.logger.debug(`Deleting SQS queue policy ${logicalId}: ${physicalId}`);
|
|
10954
11223
|
try {
|
|
10955
11224
|
await this.sqsClient.send(
|
|
@@ -10963,6 +11232,14 @@ var SQSQueuePolicyProvider = class {
|
|
|
10963
11232
|
this.logger.debug(`Successfully deleted SQS queue policy ${logicalId}`);
|
|
10964
11233
|
} catch (error) {
|
|
10965
11234
|
if (error instanceof Error && (error.name === "QueueDoesNotExist" || error.message.includes("does not exist"))) {
|
|
11235
|
+
const clientRegion = await this.sqsClient.config.region();
|
|
11236
|
+
assertRegionMatch(
|
|
11237
|
+
clientRegion,
|
|
11238
|
+
context?.expectedRegion,
|
|
11239
|
+
resourceType,
|
|
11240
|
+
logicalId,
|
|
11241
|
+
physicalId
|
|
11242
|
+
);
|
|
10966
11243
|
this.logger.debug(`Queue ${physicalId} does not exist, skipping policy deletion`);
|
|
10967
11244
|
return;
|
|
10968
11245
|
}
|
|
@@ -11243,13 +11520,21 @@ var SNSTopicProvider = class {
|
|
|
11243
11520
|
/**
|
|
11244
11521
|
* Delete an SNS topic
|
|
11245
11522
|
*/
|
|
11246
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
11523
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
11247
11524
|
this.logger.debug(`Deleting SNS topic ${logicalId}: ${physicalId}`);
|
|
11248
11525
|
try {
|
|
11249
11526
|
await this.snsClient.send(new DeleteTopicCommand({ TopicArn: physicalId }));
|
|
11250
11527
|
this.logger.debug(`Successfully deleted SNS topic ${logicalId}`);
|
|
11251
11528
|
} catch (error) {
|
|
11252
11529
|
if (error instanceof NotFoundException) {
|
|
11530
|
+
const clientRegion = await this.snsClient.config.region();
|
|
11531
|
+
assertRegionMatch(
|
|
11532
|
+
clientRegion,
|
|
11533
|
+
context?.expectedRegion,
|
|
11534
|
+
resourceType,
|
|
11535
|
+
logicalId,
|
|
11536
|
+
physicalId
|
|
11537
|
+
);
|
|
11253
11538
|
this.logger.debug(`SNS topic ${physicalId} does not exist, skipping deletion`);
|
|
11254
11539
|
return;
|
|
11255
11540
|
}
|
|
@@ -11368,7 +11653,7 @@ var SNSSubscriptionProvider = class {
|
|
|
11368
11653
|
/**
|
|
11369
11654
|
* Delete an SNS subscription
|
|
11370
11655
|
*/
|
|
11371
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
11656
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
11372
11657
|
this.logger.debug(`Deleting SNS subscription ${logicalId}: ${physicalId}`);
|
|
11373
11658
|
try {
|
|
11374
11659
|
await this.snsClient.send(
|
|
@@ -11379,6 +11664,14 @@ var SNSSubscriptionProvider = class {
|
|
|
11379
11664
|
this.logger.debug(`Successfully deleted SNS subscription ${logicalId}`);
|
|
11380
11665
|
} catch (error) {
|
|
11381
11666
|
if (error instanceof NotFoundException2) {
|
|
11667
|
+
const clientRegion = await this.snsClient.config.region();
|
|
11668
|
+
assertRegionMatch(
|
|
11669
|
+
clientRegion,
|
|
11670
|
+
context?.expectedRegion,
|
|
11671
|
+
resourceType,
|
|
11672
|
+
logicalId,
|
|
11673
|
+
physicalId
|
|
11674
|
+
);
|
|
11382
11675
|
this.logger.debug(`Subscription ${physicalId} does not exist, skipping deletion`);
|
|
11383
11676
|
return;
|
|
11384
11677
|
}
|
|
@@ -11499,7 +11792,7 @@ var SNSTopicPolicyProvider = class {
|
|
|
11499
11792
|
*
|
|
11500
11793
|
* Removes the policy from each topic by setting an empty policy.
|
|
11501
11794
|
*/
|
|
11502
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
11795
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
11503
11796
|
this.logger.debug(`Deleting SNS topic policy ${logicalId}: ${physicalId}`);
|
|
11504
11797
|
const topicArns = physicalId.split(",");
|
|
11505
11798
|
for (const topicArn of topicArns) {
|
|
@@ -11508,6 +11801,14 @@ var SNSTopicPolicyProvider = class {
|
|
|
11508
11801
|
this.logger.debug(`Removed policy from topic ${topicArn}`);
|
|
11509
11802
|
} catch (error) {
|
|
11510
11803
|
if (error instanceof Error && (error.name === "NotFoundException" || error.name === "NotFound" || error.message.includes("not found") || error.message.includes("does not exist") || error.message.includes("Invalid parameter"))) {
|
|
11804
|
+
const clientRegion = await getAwsClients().sns.config.region();
|
|
11805
|
+
assertRegionMatch(
|
|
11806
|
+
clientRegion,
|
|
11807
|
+
context?.expectedRegion,
|
|
11808
|
+
resourceType,
|
|
11809
|
+
logicalId,
|
|
11810
|
+
topicArn
|
|
11811
|
+
);
|
|
11511
11812
|
this.logger.debug(`Topic ${topicArn} not found or policy already removed, skipping`);
|
|
11512
11813
|
continue;
|
|
11513
11814
|
}
|
|
@@ -11772,7 +12073,7 @@ var LambdaFunctionProvider = class {
|
|
|
11772
12073
|
* security groups, we poll DescribeNetworkInterfaces for the function's
|
|
11773
12074
|
* managed ENIs and only return once they are gone (or the timeout elapses).
|
|
11774
12075
|
*/
|
|
11775
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
12076
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
11776
12077
|
this.logger.debug(`Deleting Lambda function ${logicalId}: ${physicalId}`);
|
|
11777
12078
|
const hasVpcConfig = this.hasVpcConfig(properties?.["VpcConfig"]);
|
|
11778
12079
|
if (hasVpcConfig) {
|
|
@@ -11786,6 +12087,14 @@ var LambdaFunctionProvider = class {
|
|
|
11786
12087
|
this.logger.debug(`Detached VPC config from Lambda ${physicalId} before deletion`);
|
|
11787
12088
|
} catch (error) {
|
|
11788
12089
|
if (error instanceof ResourceNotFoundException) {
|
|
12090
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
12091
|
+
assertRegionMatch(
|
|
12092
|
+
clientRegion,
|
|
12093
|
+
context?.expectedRegion,
|
|
12094
|
+
resourceType,
|
|
12095
|
+
logicalId,
|
|
12096
|
+
physicalId
|
|
12097
|
+
);
|
|
11789
12098
|
return;
|
|
11790
12099
|
}
|
|
11791
12100
|
this.logger.warn(
|
|
@@ -11799,6 +12108,14 @@ var LambdaFunctionProvider = class {
|
|
|
11799
12108
|
this.logger.debug(`Successfully deleted Lambda function ${logicalId}`);
|
|
11800
12109
|
} catch (error) {
|
|
11801
12110
|
if (error instanceof ResourceNotFoundException) {
|
|
12111
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
12112
|
+
assertRegionMatch(
|
|
12113
|
+
clientRegion,
|
|
12114
|
+
context?.expectedRegion,
|
|
12115
|
+
resourceType,
|
|
12116
|
+
logicalId,
|
|
12117
|
+
physicalId
|
|
12118
|
+
);
|
|
11802
12119
|
this.logger.debug(`Lambda function ${physicalId} does not exist, skipping deletion`);
|
|
11803
12120
|
return;
|
|
11804
12121
|
}
|
|
@@ -12265,7 +12582,7 @@ var LambdaPermissionProvider = class {
|
|
|
12265
12582
|
/**
|
|
12266
12583
|
* Delete a Lambda permission
|
|
12267
12584
|
*/
|
|
12268
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
12585
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
12269
12586
|
this.logger.debug(`Deleting Lambda permission ${logicalId}: ${physicalId}`);
|
|
12270
12587
|
const functionName = properties?.["FunctionName"];
|
|
12271
12588
|
if (!functionName) {
|
|
@@ -12288,6 +12605,14 @@ var LambdaPermissionProvider = class {
|
|
|
12288
12605
|
this.logger.debug(`Successfully deleted Lambda permission ${logicalId}`);
|
|
12289
12606
|
} catch (error) {
|
|
12290
12607
|
if (error instanceof ResourceNotFoundException2) {
|
|
12608
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
12609
|
+
assertRegionMatch(
|
|
12610
|
+
clientRegion,
|
|
12611
|
+
context?.expectedRegion,
|
|
12612
|
+
resourceType,
|
|
12613
|
+
logicalId,
|
|
12614
|
+
physicalId
|
|
12615
|
+
);
|
|
12291
12616
|
this.logger.debug(`Lambda permission ${physicalId} does not exist, skipping deletion`);
|
|
12292
12617
|
return;
|
|
12293
12618
|
}
|
|
@@ -12404,7 +12729,7 @@ var LambdaUrlProvider = class {
|
|
|
12404
12729
|
/**
|
|
12405
12730
|
* Delete a Lambda Function URL
|
|
12406
12731
|
*/
|
|
12407
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
12732
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
12408
12733
|
this.logger.debug(`Deleting Lambda URL ${logicalId}: ${physicalId}`);
|
|
12409
12734
|
try {
|
|
12410
12735
|
await this.lambdaClient.send(
|
|
@@ -12413,6 +12738,14 @@ var LambdaUrlProvider = class {
|
|
|
12413
12738
|
this.logger.debug(`Successfully deleted Lambda URL ${logicalId}`);
|
|
12414
12739
|
} catch (error) {
|
|
12415
12740
|
if (error instanceof ResourceNotFoundException3) {
|
|
12741
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
12742
|
+
assertRegionMatch(
|
|
12743
|
+
clientRegion,
|
|
12744
|
+
context?.expectedRegion,
|
|
12745
|
+
resourceType,
|
|
12746
|
+
logicalId,
|
|
12747
|
+
physicalId
|
|
12748
|
+
);
|
|
12416
12749
|
this.logger.debug(`Lambda URL ${physicalId} does not exist, skipping deletion`);
|
|
12417
12750
|
return;
|
|
12418
12751
|
}
|
|
@@ -12623,13 +12956,21 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
12623
12956
|
/**
|
|
12624
12957
|
* Delete a Lambda Event Source Mapping
|
|
12625
12958
|
*/
|
|
12626
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
12959
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
12627
12960
|
this.logger.debug(`Deleting event source mapping ${logicalId}: ${physicalId}`);
|
|
12628
12961
|
try {
|
|
12629
12962
|
try {
|
|
12630
12963
|
await this.lambdaClient.send(new GetEventSourceMappingCommand({ UUID: physicalId }));
|
|
12631
12964
|
} catch (error) {
|
|
12632
12965
|
if (error instanceof ResourceNotFoundException4) {
|
|
12966
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
12967
|
+
assertRegionMatch(
|
|
12968
|
+
clientRegion,
|
|
12969
|
+
context?.expectedRegion,
|
|
12970
|
+
resourceType,
|
|
12971
|
+
logicalId,
|
|
12972
|
+
physicalId
|
|
12973
|
+
);
|
|
12633
12974
|
this.logger.debug(`Event source mapping ${physicalId} does not exist, skipping deletion`);
|
|
12634
12975
|
return;
|
|
12635
12976
|
}
|
|
@@ -12639,6 +12980,14 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
12639
12980
|
this.logger.debug(`Successfully deleted event source mapping ${logicalId}`);
|
|
12640
12981
|
} catch (error) {
|
|
12641
12982
|
if (error instanceof ResourceNotFoundException4) {
|
|
12983
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
12984
|
+
assertRegionMatch(
|
|
12985
|
+
clientRegion,
|
|
12986
|
+
context?.expectedRegion,
|
|
12987
|
+
resourceType,
|
|
12988
|
+
logicalId,
|
|
12989
|
+
physicalId
|
|
12990
|
+
);
|
|
12642
12991
|
this.logger.debug(`Event source mapping ${physicalId} does not exist, skipping deletion`);
|
|
12643
12992
|
return;
|
|
12644
12993
|
}
|
|
@@ -12752,7 +13101,7 @@ var LambdaLayerVersionProvider = class {
|
|
|
12752
13101
|
/**
|
|
12753
13102
|
* Delete a Lambda layer version
|
|
12754
13103
|
*/
|
|
12755
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
13104
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
12756
13105
|
this.logger.debug(`Deleting Lambda layer version ${logicalId}: ${physicalId}`);
|
|
12757
13106
|
const arnParts = physicalId.split(":");
|
|
12758
13107
|
if (arnParts.length < 8) {
|
|
@@ -12775,6 +13124,14 @@ var LambdaLayerVersionProvider = class {
|
|
|
12775
13124
|
this.logger.debug(`Successfully deleted Lambda layer version ${logicalId}`);
|
|
12776
13125
|
} catch (error) {
|
|
12777
13126
|
if (error instanceof ResourceNotFoundException5) {
|
|
13127
|
+
const clientRegion = await this.lambdaClient.config.region();
|
|
13128
|
+
assertRegionMatch(
|
|
13129
|
+
clientRegion,
|
|
13130
|
+
context?.expectedRegion,
|
|
13131
|
+
resourceType,
|
|
13132
|
+
logicalId,
|
|
13133
|
+
physicalId
|
|
13134
|
+
);
|
|
12778
13135
|
this.logger.debug(`Lambda layer version ${physicalId} does not exist, skipping deletion`);
|
|
12779
13136
|
return;
|
|
12780
13137
|
}
|
|
@@ -12951,13 +13308,21 @@ var DynamoDBTableProvider = class {
|
|
|
12951
13308
|
/**
|
|
12952
13309
|
* Delete a DynamoDB table
|
|
12953
13310
|
*/
|
|
12954
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
13311
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
12955
13312
|
this.logger.debug(`Deleting DynamoDB table ${logicalId}: ${physicalId}`);
|
|
12956
13313
|
try {
|
|
12957
13314
|
await this.dynamoDBClient.send(new DeleteTableCommand({ TableName: physicalId }));
|
|
12958
13315
|
this.logger.debug(`Successfully deleted DynamoDB table ${logicalId}`);
|
|
12959
13316
|
} catch (error) {
|
|
12960
13317
|
if (error instanceof ResourceNotFoundException6) {
|
|
13318
|
+
const clientRegion = await this.dynamoDBClient.config.region();
|
|
13319
|
+
assertRegionMatch(
|
|
13320
|
+
clientRegion,
|
|
13321
|
+
context?.expectedRegion,
|
|
13322
|
+
resourceType,
|
|
13323
|
+
logicalId,
|
|
13324
|
+
physicalId
|
|
13325
|
+
);
|
|
12961
13326
|
this.logger.debug(`DynamoDB table ${physicalId} does not exist, skipping deletion`);
|
|
12962
13327
|
return;
|
|
12963
13328
|
}
|
|
@@ -13186,13 +13551,21 @@ var LogsLogGroupProvider = class {
|
|
|
13186
13551
|
/**
|
|
13187
13552
|
* Delete a CloudWatch Logs log group
|
|
13188
13553
|
*/
|
|
13189
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
13554
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
13190
13555
|
this.logger.debug(`Deleting log group ${logicalId}: ${physicalId}`);
|
|
13191
13556
|
try {
|
|
13192
13557
|
await this.logsClient.send(new DeleteLogGroupCommand({ logGroupName: physicalId }));
|
|
13193
13558
|
this.logger.debug(`Successfully deleted log group ${logicalId}`);
|
|
13194
13559
|
} catch (error) {
|
|
13195
13560
|
if (error instanceof ResourceNotFoundException7) {
|
|
13561
|
+
const clientRegion = await this.logsClient.config.region();
|
|
13562
|
+
assertRegionMatch(
|
|
13563
|
+
clientRegion,
|
|
13564
|
+
context?.expectedRegion,
|
|
13565
|
+
resourceType,
|
|
13566
|
+
logicalId,
|
|
13567
|
+
physicalId
|
|
13568
|
+
);
|
|
13196
13569
|
this.logger.debug(`Log group ${physicalId} does not exist, skipping deletion`);
|
|
13197
13570
|
return;
|
|
13198
13571
|
}
|
|
@@ -13323,7 +13696,7 @@ var CloudWatchAlarmProvider = class {
|
|
|
13323
13696
|
/**
|
|
13324
13697
|
* Delete a CloudWatch alarm
|
|
13325
13698
|
*/
|
|
13326
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
13699
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
13327
13700
|
this.logger.debug(`Deleting CloudWatch alarm ${logicalId}: ${physicalId}`);
|
|
13328
13701
|
try {
|
|
13329
13702
|
await this.cloudWatchClient.send(
|
|
@@ -13334,6 +13707,14 @@ var CloudWatchAlarmProvider = class {
|
|
|
13334
13707
|
this.logger.debug(`Successfully deleted CloudWatch alarm ${logicalId}`);
|
|
13335
13708
|
} catch (error) {
|
|
13336
13709
|
if (error instanceof Error && error.name === "ResourceNotFound") {
|
|
13710
|
+
const clientRegion = await this.cloudWatchClient.config.region();
|
|
13711
|
+
assertRegionMatch(
|
|
13712
|
+
clientRegion,
|
|
13713
|
+
context?.expectedRegion,
|
|
13714
|
+
resourceType,
|
|
13715
|
+
logicalId,
|
|
13716
|
+
physicalId
|
|
13717
|
+
);
|
|
13337
13718
|
this.logger.debug(`Alarm ${physicalId} does not exist, skipping deletion`);
|
|
13338
13719
|
return;
|
|
13339
13720
|
}
|
|
@@ -13627,7 +14008,7 @@ var SecretsManagerSecretProvider = class {
|
|
|
13627
14008
|
/**
|
|
13628
14009
|
* Delete a Secrets Manager secret
|
|
13629
14010
|
*/
|
|
13630
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
14011
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
13631
14012
|
this.logger.debug(`Deleting secret ${logicalId}: ${physicalId}`);
|
|
13632
14013
|
try {
|
|
13633
14014
|
await this.smClient.send(
|
|
@@ -13639,6 +14020,14 @@ var SecretsManagerSecretProvider = class {
|
|
|
13639
14020
|
this.logger.debug(`Successfully deleted secret ${logicalId}`);
|
|
13640
14021
|
} catch (error) {
|
|
13641
14022
|
if (error instanceof ResourceNotFoundException8) {
|
|
14023
|
+
const clientRegion = await this.smClient.config.region();
|
|
14024
|
+
assertRegionMatch(
|
|
14025
|
+
clientRegion,
|
|
14026
|
+
context?.expectedRegion,
|
|
14027
|
+
resourceType,
|
|
14028
|
+
logicalId,
|
|
14029
|
+
physicalId
|
|
14030
|
+
);
|
|
13642
14031
|
this.logger.debug(`Secret ${physicalId} does not exist, skipping deletion`);
|
|
13643
14032
|
return;
|
|
13644
14033
|
}
|
|
@@ -13883,7 +14272,7 @@ var SSMParameterProvider = class {
|
|
|
13883
14272
|
/**
|
|
13884
14273
|
* Delete an SSM parameter
|
|
13885
14274
|
*/
|
|
13886
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
14275
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
13887
14276
|
this.logger.debug(`Deleting SSM parameter ${logicalId}: ${physicalId}`);
|
|
13888
14277
|
try {
|
|
13889
14278
|
await this.ssmClient.send(
|
|
@@ -13894,6 +14283,14 @@ var SSMParameterProvider = class {
|
|
|
13894
14283
|
this.logger.debug(`Successfully deleted SSM parameter ${logicalId}`);
|
|
13895
14284
|
} catch (error) {
|
|
13896
14285
|
if (error instanceof ParameterNotFound) {
|
|
14286
|
+
const clientRegion = await this.ssmClient.config.region();
|
|
14287
|
+
assertRegionMatch(
|
|
14288
|
+
clientRegion,
|
|
14289
|
+
context?.expectedRegion,
|
|
14290
|
+
resourceType,
|
|
14291
|
+
logicalId,
|
|
14292
|
+
physicalId
|
|
14293
|
+
);
|
|
13897
14294
|
this.logger.debug(`Parameter ${physicalId} does not exist, skipping deletion`);
|
|
13898
14295
|
return;
|
|
13899
14296
|
}
|
|
@@ -14112,7 +14509,7 @@ var EventBridgeRuleProvider = class {
|
|
|
14112
14509
|
*
|
|
14113
14510
|
* Before deleting, removes all targets (required by EventBridge API).
|
|
14114
14511
|
*/
|
|
14115
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
14512
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
14116
14513
|
this.logger.debug(`Deleting EventBridge rule ${logicalId}: ${physicalId}`);
|
|
14117
14514
|
const ruleName = this.extractRuleNameFromArn(physicalId);
|
|
14118
14515
|
try {
|
|
@@ -14124,6 +14521,14 @@ var EventBridgeRuleProvider = class {
|
|
|
14124
14521
|
targetIds = (targetsResponse.Targets || []).map((t) => t.Id).filter((id) => id !== void 0);
|
|
14125
14522
|
} catch (error) {
|
|
14126
14523
|
if (error instanceof ResourceNotFoundException9) {
|
|
14524
|
+
const clientRegion = await this.eventBridgeClient.config.region();
|
|
14525
|
+
assertRegionMatch(
|
|
14526
|
+
clientRegion,
|
|
14527
|
+
context?.expectedRegion,
|
|
14528
|
+
resourceType,
|
|
14529
|
+
logicalId,
|
|
14530
|
+
physicalId
|
|
14531
|
+
);
|
|
14127
14532
|
this.logger.debug(`Rule ${ruleName} does not exist, skipping deletion`);
|
|
14128
14533
|
return;
|
|
14129
14534
|
}
|
|
@@ -14142,6 +14547,14 @@ var EventBridgeRuleProvider = class {
|
|
|
14142
14547
|
this.logger.debug(`Successfully deleted EventBridge rule ${logicalId}`);
|
|
14143
14548
|
} catch (error) {
|
|
14144
14549
|
if (error instanceof ResourceNotFoundException9) {
|
|
14550
|
+
const clientRegion = await this.eventBridgeClient.config.region();
|
|
14551
|
+
assertRegionMatch(
|
|
14552
|
+
clientRegion,
|
|
14553
|
+
context?.expectedRegion,
|
|
14554
|
+
resourceType,
|
|
14555
|
+
logicalId,
|
|
14556
|
+
physicalId
|
|
14557
|
+
);
|
|
14145
14558
|
this.logger.debug(`Rule ${ruleName} does not exist, skipping deletion`);
|
|
14146
14559
|
return;
|
|
14147
14560
|
}
|
|
@@ -14327,7 +14740,7 @@ var EventBridgeBusProvider = class {
|
|
|
14327
14740
|
}
|
|
14328
14741
|
return { physicalId, wasReplaced: false, attributes: {} };
|
|
14329
14742
|
}
|
|
14330
|
-
async delete(logicalId, physicalId, resourceType) {
|
|
14743
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
14331
14744
|
this.logger.debug(`Deleting EventBus ${logicalId}: ${physicalId}`);
|
|
14332
14745
|
try {
|
|
14333
14746
|
await this.cleanupRulesOnBus(physicalId);
|
|
@@ -14335,11 +14748,27 @@ var EventBridgeBusProvider = class {
|
|
|
14335
14748
|
this.logger.debug(`Successfully deleted EventBus ${logicalId}`);
|
|
14336
14749
|
} catch (error) {
|
|
14337
14750
|
if (error instanceof ResourceNotFoundException10) {
|
|
14751
|
+
const clientRegion = await this.eventBridgeClient.config.region();
|
|
14752
|
+
assertRegionMatch(
|
|
14753
|
+
clientRegion,
|
|
14754
|
+
context?.expectedRegion,
|
|
14755
|
+
resourceType,
|
|
14756
|
+
logicalId,
|
|
14757
|
+
physicalId
|
|
14758
|
+
);
|
|
14338
14759
|
this.logger.debug(`EventBus ${physicalId} does not exist, skipping`);
|
|
14339
14760
|
return;
|
|
14340
14761
|
}
|
|
14341
14762
|
const msg = error instanceof Error ? error.message : String(error);
|
|
14342
14763
|
if (msg.includes("does not exist")) {
|
|
14764
|
+
const clientRegion = await this.eventBridgeClient.config.region();
|
|
14765
|
+
assertRegionMatch(
|
|
14766
|
+
clientRegion,
|
|
14767
|
+
context?.expectedRegion,
|
|
14768
|
+
resourceType,
|
|
14769
|
+
logicalId,
|
|
14770
|
+
physicalId
|
|
14771
|
+
);
|
|
14343
14772
|
this.logger.debug(`EventBus ${physicalId} does not exist, skipping`);
|
|
14344
14773
|
return;
|
|
14345
14774
|
}
|
|
@@ -14639,32 +15068,38 @@ var EC2Provider = class {
|
|
|
14639
15068
|
);
|
|
14640
15069
|
}
|
|
14641
15070
|
}
|
|
14642
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
15071
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
14643
15072
|
switch (resourceType) {
|
|
14644
15073
|
case "AWS::EC2::VPC":
|
|
14645
|
-
return this.deleteVpc(logicalId, physicalId, resourceType);
|
|
15074
|
+
return this.deleteVpc(logicalId, physicalId, resourceType, context);
|
|
14646
15075
|
case "AWS::EC2::Subnet":
|
|
14647
|
-
return this.deleteSubnet(logicalId, physicalId, resourceType);
|
|
15076
|
+
return this.deleteSubnet(logicalId, physicalId, resourceType, context);
|
|
14648
15077
|
case "AWS::EC2::InternetGateway":
|
|
14649
|
-
return this.deleteInternetGateway(logicalId, physicalId, resourceType);
|
|
15078
|
+
return this.deleteInternetGateway(logicalId, physicalId, resourceType, context);
|
|
14650
15079
|
case "AWS::EC2::VPCGatewayAttachment":
|
|
14651
|
-
return this.deleteVpcGatewayAttachment(logicalId, physicalId, resourceType);
|
|
15080
|
+
return this.deleteVpcGatewayAttachment(logicalId, physicalId, resourceType, context);
|
|
14652
15081
|
case "AWS::EC2::RouteTable":
|
|
14653
|
-
return this.deleteRouteTable(logicalId, physicalId, resourceType);
|
|
15082
|
+
return this.deleteRouteTable(logicalId, physicalId, resourceType, context);
|
|
14654
15083
|
case "AWS::EC2::Route":
|
|
14655
|
-
return this.deleteRoute(logicalId, physicalId, resourceType);
|
|
15084
|
+
return this.deleteRoute(logicalId, physicalId, resourceType, context);
|
|
14656
15085
|
case "AWS::EC2::SubnetRouteTableAssociation":
|
|
14657
|
-
return this.deleteSubnetRouteTableAssociation(logicalId, physicalId, resourceType);
|
|
15086
|
+
return this.deleteSubnetRouteTableAssociation(logicalId, physicalId, resourceType, context);
|
|
14658
15087
|
case "AWS::EC2::SecurityGroup":
|
|
14659
|
-
return this.deleteSecurityGroup(logicalId, physicalId, resourceType);
|
|
15088
|
+
return this.deleteSecurityGroup(logicalId, physicalId, resourceType, context);
|
|
14660
15089
|
case "AWS::EC2::SecurityGroupIngress":
|
|
14661
|
-
return this.deleteSecurityGroupIngress(
|
|
15090
|
+
return this.deleteSecurityGroupIngress(
|
|
15091
|
+
logicalId,
|
|
15092
|
+
physicalId,
|
|
15093
|
+
resourceType,
|
|
15094
|
+
properties,
|
|
15095
|
+
context
|
|
15096
|
+
);
|
|
14662
15097
|
case "AWS::EC2::Instance":
|
|
14663
|
-
return this.deleteInstance(logicalId, physicalId, resourceType);
|
|
15098
|
+
return this.deleteInstance(logicalId, physicalId, resourceType, context);
|
|
14664
15099
|
case "AWS::EC2::NetworkAcl":
|
|
14665
|
-
return this.deleteNetworkAcl(logicalId, physicalId, resourceType);
|
|
15100
|
+
return this.deleteNetworkAcl(logicalId, physicalId, resourceType, context);
|
|
14666
15101
|
case "AWS::EC2::NetworkAclEntry":
|
|
14667
|
-
return this.deleteNetworkAclEntry(logicalId, physicalId, resourceType);
|
|
15102
|
+
return this.deleteNetworkAclEntry(logicalId, physicalId, resourceType, context);
|
|
14668
15103
|
case "AWS::EC2::SubnetNetworkAclAssociation":
|
|
14669
15104
|
this.logger.debug(`SubnetNetworkAclAssociation ${logicalId} delete is a no-op`);
|
|
14670
15105
|
return;
|
|
@@ -14805,7 +15240,7 @@ var EC2Provider = class {
|
|
|
14805
15240
|
);
|
|
14806
15241
|
}
|
|
14807
15242
|
}
|
|
14808
|
-
async deleteVpc(logicalId, physicalId, resourceType) {
|
|
15243
|
+
async deleteVpc(logicalId, physicalId, resourceType, context) {
|
|
14809
15244
|
this.logger.debug(`Deleting VPC ${logicalId}: ${physicalId}`);
|
|
14810
15245
|
const maxAttempts = 10;
|
|
14811
15246
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
@@ -14815,6 +15250,14 @@ var EC2Provider = class {
|
|
|
14815
15250
|
return;
|
|
14816
15251
|
} catch (error) {
|
|
14817
15252
|
if (this.isNotFoundError(error)) {
|
|
15253
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15254
|
+
assertRegionMatch(
|
|
15255
|
+
clientRegion,
|
|
15256
|
+
context?.expectedRegion,
|
|
15257
|
+
resourceType,
|
|
15258
|
+
logicalId,
|
|
15259
|
+
physicalId
|
|
15260
|
+
);
|
|
14818
15261
|
this.logger.debug(`VPC ${physicalId} does not exist, skipping deletion`);
|
|
14819
15262
|
return;
|
|
14820
15263
|
}
|
|
@@ -14920,7 +15363,7 @@ var EC2Provider = class {
|
|
|
14920
15363
|
this.logger.debug(`Updating Subnet ${logicalId}: ${physicalId} (no-op, immutable properties)`);
|
|
14921
15364
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
14922
15365
|
}
|
|
14923
|
-
async deleteSubnet(logicalId, physicalId, resourceType) {
|
|
15366
|
+
async deleteSubnet(logicalId, physicalId, resourceType, context) {
|
|
14924
15367
|
this.logger.debug(`Deleting Subnet ${logicalId}: ${physicalId}`);
|
|
14925
15368
|
const maxAttempts = 10;
|
|
14926
15369
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
@@ -14930,6 +15373,14 @@ var EC2Provider = class {
|
|
|
14930
15373
|
return;
|
|
14931
15374
|
} catch (error) {
|
|
14932
15375
|
if (this.isNotFoundError(error)) {
|
|
15376
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15377
|
+
assertRegionMatch(
|
|
15378
|
+
clientRegion,
|
|
15379
|
+
context?.expectedRegion,
|
|
15380
|
+
resourceType,
|
|
15381
|
+
logicalId,
|
|
15382
|
+
physicalId
|
|
15383
|
+
);
|
|
14933
15384
|
this.logger.debug(`Subnet ${physicalId} does not exist, skipping deletion`);
|
|
14934
15385
|
return;
|
|
14935
15386
|
}
|
|
@@ -15048,7 +15499,7 @@ var EC2Provider = class {
|
|
|
15048
15499
|
this.logger.debug(`Updating InternetGateway ${logicalId}: ${physicalId} (no-op)`);
|
|
15049
15500
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
15050
15501
|
}
|
|
15051
|
-
async deleteInternetGateway(logicalId, physicalId, resourceType) {
|
|
15502
|
+
async deleteInternetGateway(logicalId, physicalId, resourceType, context) {
|
|
15052
15503
|
this.logger.debug(`Deleting InternetGateway ${logicalId}: ${physicalId}`);
|
|
15053
15504
|
try {
|
|
15054
15505
|
await this.ec2Client.send(
|
|
@@ -15057,6 +15508,14 @@ var EC2Provider = class {
|
|
|
15057
15508
|
this.logger.debug(`Successfully deleted InternetGateway ${logicalId}`);
|
|
15058
15509
|
} catch (error) {
|
|
15059
15510
|
if (this.isNotFoundError(error)) {
|
|
15511
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15512
|
+
assertRegionMatch(
|
|
15513
|
+
clientRegion,
|
|
15514
|
+
context?.expectedRegion,
|
|
15515
|
+
resourceType,
|
|
15516
|
+
logicalId,
|
|
15517
|
+
physicalId
|
|
15518
|
+
);
|
|
15060
15519
|
this.logger.debug(`InternetGateway ${physicalId} does not exist, skipping deletion`);
|
|
15061
15520
|
return;
|
|
15062
15521
|
}
|
|
@@ -15110,7 +15569,7 @@ var EC2Provider = class {
|
|
|
15110
15569
|
this.logger.debug(`Updating VPCGatewayAttachment ${logicalId}: ${physicalId} (no-op)`);
|
|
15111
15570
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
15112
15571
|
}
|
|
15113
|
-
async deleteVpcGatewayAttachment(logicalId, physicalId, resourceType) {
|
|
15572
|
+
async deleteVpcGatewayAttachment(logicalId, physicalId, resourceType, context) {
|
|
15114
15573
|
this.logger.debug(`Deleting VPCGatewayAttachment ${logicalId}: ${physicalId}`);
|
|
15115
15574
|
const parts = physicalId.split("|");
|
|
15116
15575
|
if (parts.length !== 2) {
|
|
@@ -15132,6 +15591,14 @@ var EC2Provider = class {
|
|
|
15132
15591
|
this.logger.debug(`Successfully deleted VPCGatewayAttachment ${logicalId}`);
|
|
15133
15592
|
} catch (error) {
|
|
15134
15593
|
if (this.isNotFoundError(error)) {
|
|
15594
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15595
|
+
assertRegionMatch(
|
|
15596
|
+
clientRegion,
|
|
15597
|
+
context?.expectedRegion,
|
|
15598
|
+
resourceType,
|
|
15599
|
+
logicalId,
|
|
15600
|
+
physicalId
|
|
15601
|
+
);
|
|
15135
15602
|
this.logger.debug(`VPCGatewayAttachment ${physicalId} does not exist, skipping deletion`);
|
|
15136
15603
|
return;
|
|
15137
15604
|
}
|
|
@@ -15182,13 +15649,21 @@ var EC2Provider = class {
|
|
|
15182
15649
|
this.logger.debug(`Updating RouteTable ${logicalId}: ${physicalId} (no-op)`);
|
|
15183
15650
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
15184
15651
|
}
|
|
15185
|
-
async deleteRouteTable(logicalId, physicalId, resourceType) {
|
|
15652
|
+
async deleteRouteTable(logicalId, physicalId, resourceType, context) {
|
|
15186
15653
|
this.logger.debug(`Deleting RouteTable ${logicalId}: ${physicalId}`);
|
|
15187
15654
|
try {
|
|
15188
15655
|
await this.ec2Client.send(new DeleteRouteTableCommand({ RouteTableId: physicalId }));
|
|
15189
15656
|
this.logger.debug(`Successfully deleted RouteTable ${logicalId}`);
|
|
15190
15657
|
} catch (error) {
|
|
15191
15658
|
if (this.isNotFoundError(error)) {
|
|
15659
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15660
|
+
assertRegionMatch(
|
|
15661
|
+
clientRegion,
|
|
15662
|
+
context?.expectedRegion,
|
|
15663
|
+
resourceType,
|
|
15664
|
+
logicalId,
|
|
15665
|
+
physicalId
|
|
15666
|
+
);
|
|
15192
15667
|
this.logger.debug(`RouteTable ${physicalId} does not exist, skipping deletion`);
|
|
15193
15668
|
return;
|
|
15194
15669
|
}
|
|
@@ -15268,7 +15743,7 @@ var EC2Provider = class {
|
|
|
15268
15743
|
);
|
|
15269
15744
|
}
|
|
15270
15745
|
}
|
|
15271
|
-
async deleteRoute(logicalId, physicalId, resourceType) {
|
|
15746
|
+
async deleteRoute(logicalId, physicalId, resourceType, context) {
|
|
15272
15747
|
this.logger.debug(`Deleting Route ${logicalId}: ${physicalId}`);
|
|
15273
15748
|
const parts = physicalId.split("|");
|
|
15274
15749
|
if (parts.length !== 2) {
|
|
@@ -15291,6 +15766,14 @@ var EC2Provider = class {
|
|
|
15291
15766
|
this.logger.debug(`Successfully deleted Route ${logicalId}`);
|
|
15292
15767
|
} catch (error) {
|
|
15293
15768
|
if (this.isNotFoundError(error)) {
|
|
15769
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15770
|
+
assertRegionMatch(
|
|
15771
|
+
clientRegion,
|
|
15772
|
+
context?.expectedRegion,
|
|
15773
|
+
resourceType,
|
|
15774
|
+
logicalId,
|
|
15775
|
+
physicalId
|
|
15776
|
+
);
|
|
15294
15777
|
this.logger.debug(`Route ${physicalId} does not exist, skipping deletion`);
|
|
15295
15778
|
return;
|
|
15296
15779
|
}
|
|
@@ -15348,13 +15831,21 @@ var EC2Provider = class {
|
|
|
15348
15831
|
);
|
|
15349
15832
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
15350
15833
|
}
|
|
15351
|
-
async deleteSubnetRouteTableAssociation(logicalId, physicalId, resourceType) {
|
|
15834
|
+
async deleteSubnetRouteTableAssociation(logicalId, physicalId, resourceType, context) {
|
|
15352
15835
|
this.logger.debug(`Deleting SubnetRouteTableAssociation ${logicalId}: ${physicalId}`);
|
|
15353
15836
|
try {
|
|
15354
15837
|
await this.ec2Client.send(new DisassociateRouteTableCommand({ AssociationId: physicalId }));
|
|
15355
15838
|
this.logger.debug(`Successfully deleted SubnetRouteTableAssociation ${logicalId}`);
|
|
15356
15839
|
} catch (error) {
|
|
15357
15840
|
if (this.isNotFoundError(error)) {
|
|
15841
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15842
|
+
assertRegionMatch(
|
|
15843
|
+
clientRegion,
|
|
15844
|
+
context?.expectedRegion,
|
|
15845
|
+
resourceType,
|
|
15846
|
+
logicalId,
|
|
15847
|
+
physicalId
|
|
15848
|
+
);
|
|
15358
15849
|
this.logger.debug(
|
|
15359
15850
|
`SubnetRouteTableAssociation ${physicalId} does not exist, skipping deletion`
|
|
15360
15851
|
);
|
|
@@ -15485,7 +15976,7 @@ var EC2Provider = class {
|
|
|
15485
15976
|
);
|
|
15486
15977
|
}
|
|
15487
15978
|
}
|
|
15488
|
-
async deleteSecurityGroup(logicalId, physicalId, resourceType) {
|
|
15979
|
+
async deleteSecurityGroup(logicalId, physicalId, resourceType, context) {
|
|
15489
15980
|
this.logger.debug(`Deleting SecurityGroup ${logicalId}: ${physicalId}`);
|
|
15490
15981
|
const maxAttempts = 10;
|
|
15491
15982
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
@@ -15495,6 +15986,14 @@ var EC2Provider = class {
|
|
|
15495
15986
|
return;
|
|
15496
15987
|
} catch (error) {
|
|
15497
15988
|
if (this.isNotFoundError(error)) {
|
|
15989
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
15990
|
+
assertRegionMatch(
|
|
15991
|
+
clientRegion,
|
|
15992
|
+
context?.expectedRegion,
|
|
15993
|
+
resourceType,
|
|
15994
|
+
logicalId,
|
|
15995
|
+
physicalId
|
|
15996
|
+
);
|
|
15498
15997
|
this.logger.debug(`SecurityGroup ${physicalId} does not exist, skipping deletion`);
|
|
15499
15998
|
return;
|
|
15500
15999
|
}
|
|
@@ -15652,7 +16151,7 @@ var EC2Provider = class {
|
|
|
15652
16151
|
);
|
|
15653
16152
|
}
|
|
15654
16153
|
}
|
|
15655
|
-
async deleteSecurityGroupIngress(logicalId, physicalId, resourceType, properties) {
|
|
16154
|
+
async deleteSecurityGroupIngress(logicalId, physicalId, resourceType, properties, context) {
|
|
15656
16155
|
this.logger.debug(`Deleting SecurityGroupIngress ${logicalId}: ${physicalId}`);
|
|
15657
16156
|
const parts = physicalId.split("|");
|
|
15658
16157
|
if (parts.length !== 4) {
|
|
@@ -15679,6 +16178,14 @@ var EC2Provider = class {
|
|
|
15679
16178
|
this.logger.debug(`Successfully deleted SecurityGroupIngress ${logicalId}`);
|
|
15680
16179
|
} catch (error) {
|
|
15681
16180
|
if (this.isNotFoundError(error)) {
|
|
16181
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
16182
|
+
assertRegionMatch(
|
|
16183
|
+
clientRegion,
|
|
16184
|
+
context?.expectedRegion,
|
|
16185
|
+
resourceType,
|
|
16186
|
+
logicalId,
|
|
16187
|
+
physicalId
|
|
16188
|
+
);
|
|
15682
16189
|
this.logger.debug(`SecurityGroupIngress ${physicalId} does not exist, skipping deletion`);
|
|
15683
16190
|
return;
|
|
15684
16191
|
}
|
|
@@ -15795,7 +16302,7 @@ var EC2Provider = class {
|
|
|
15795
16302
|
);
|
|
15796
16303
|
}
|
|
15797
16304
|
}
|
|
15798
|
-
async deleteInstance(logicalId, physicalId, resourceType) {
|
|
16305
|
+
async deleteInstance(logicalId, physicalId, resourceType, context) {
|
|
15799
16306
|
this.logger.debug(`Terminating EC2 Instance ${logicalId}: ${physicalId}`);
|
|
15800
16307
|
try {
|
|
15801
16308
|
await this.ec2Client.send(new TerminateInstancesCommand({ InstanceIds: [physicalId] }));
|
|
@@ -15807,6 +16314,14 @@ var EC2Provider = class {
|
|
|
15807
16314
|
this.logger.debug(`EC2 Instance ${logicalId} terminated: ${physicalId}`);
|
|
15808
16315
|
} catch (error) {
|
|
15809
16316
|
if (this.isNotFoundError(error)) {
|
|
16317
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
16318
|
+
assertRegionMatch(
|
|
16319
|
+
clientRegion,
|
|
16320
|
+
context?.expectedRegion,
|
|
16321
|
+
resourceType,
|
|
16322
|
+
logicalId,
|
|
16323
|
+
physicalId
|
|
16324
|
+
);
|
|
15810
16325
|
this.logger.debug(
|
|
15811
16326
|
`EC2 Instance ${physicalId} already terminated (not found), treating as success`
|
|
15812
16327
|
);
|
|
@@ -16042,13 +16557,21 @@ var EC2Provider = class {
|
|
|
16042
16557
|
);
|
|
16043
16558
|
}
|
|
16044
16559
|
}
|
|
16045
|
-
async deleteNetworkAcl(logicalId, physicalId, resourceType) {
|
|
16560
|
+
async deleteNetworkAcl(logicalId, physicalId, resourceType, context) {
|
|
16046
16561
|
this.logger.debug(`Deleting NetworkAcl ${logicalId}: ${physicalId}`);
|
|
16047
16562
|
try {
|
|
16048
16563
|
await this.ec2Client.send(new DeleteNetworkAclCommand({ NetworkAclId: physicalId }));
|
|
16049
16564
|
this.logger.debug(`Successfully deleted NetworkAcl ${logicalId}`);
|
|
16050
16565
|
} catch (error) {
|
|
16051
16566
|
if (this.isNotFoundError(error)) {
|
|
16567
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
16568
|
+
assertRegionMatch(
|
|
16569
|
+
clientRegion,
|
|
16570
|
+
context?.expectedRegion,
|
|
16571
|
+
resourceType,
|
|
16572
|
+
logicalId,
|
|
16573
|
+
physicalId
|
|
16574
|
+
);
|
|
16052
16575
|
this.logger.debug(`NetworkAcl ${physicalId} does not exist, skipping deletion`);
|
|
16053
16576
|
return;
|
|
16054
16577
|
}
|
|
@@ -16118,7 +16641,7 @@ var EC2Provider = class {
|
|
|
16118
16641
|
);
|
|
16119
16642
|
}
|
|
16120
16643
|
}
|
|
16121
|
-
async deleteNetworkAclEntry(logicalId, physicalId, resourceType) {
|
|
16644
|
+
async deleteNetworkAclEntry(logicalId, physicalId, resourceType, context) {
|
|
16122
16645
|
this.logger.debug(`Deleting NetworkAclEntry ${logicalId}: ${physicalId}`);
|
|
16123
16646
|
const parts = physicalId.split("|");
|
|
16124
16647
|
if (parts.length < 3) {
|
|
@@ -16139,6 +16662,14 @@ var EC2Provider = class {
|
|
|
16139
16662
|
this.logger.debug(`Successfully deleted NetworkAclEntry ${logicalId}`);
|
|
16140
16663
|
} catch (error) {
|
|
16141
16664
|
if (this.isNotFoundError(error)) {
|
|
16665
|
+
const clientRegion = await this.ec2Client.config.region();
|
|
16666
|
+
assertRegionMatch(
|
|
16667
|
+
clientRegion,
|
|
16668
|
+
context?.expectedRegion,
|
|
16669
|
+
resourceType,
|
|
16670
|
+
logicalId,
|
|
16671
|
+
physicalId
|
|
16672
|
+
);
|
|
16142
16673
|
this.logger.debug(`NetworkAclEntry ${physicalId} does not exist, skipping deletion`);
|
|
16143
16674
|
return;
|
|
16144
16675
|
}
|
|
@@ -16381,20 +16912,20 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16381
16912
|
/**
|
|
16382
16913
|
* Delete a resource
|
|
16383
16914
|
*/
|
|
16384
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
16915
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
16385
16916
|
switch (resourceType) {
|
|
16386
16917
|
case "AWS::ApiGateway::Account":
|
|
16387
16918
|
return this.deleteAccount(logicalId, physicalId, resourceType);
|
|
16388
16919
|
case "AWS::ApiGateway::Authorizer":
|
|
16389
|
-
return this.deleteAuthorizer(logicalId, physicalId, resourceType, properties);
|
|
16920
|
+
return this.deleteAuthorizer(logicalId, physicalId, resourceType, properties, context);
|
|
16390
16921
|
case "AWS::ApiGateway::Resource":
|
|
16391
|
-
return this.deleteResource(logicalId, physicalId, resourceType, properties);
|
|
16922
|
+
return this.deleteResource(logicalId, physicalId, resourceType, properties, context);
|
|
16392
16923
|
case "AWS::ApiGateway::Deployment":
|
|
16393
|
-
return this.deleteDeployment(logicalId, physicalId, resourceType, properties);
|
|
16924
|
+
return this.deleteDeployment(logicalId, physicalId, resourceType, properties, context);
|
|
16394
16925
|
case "AWS::ApiGateway::Stage":
|
|
16395
|
-
return this.deleteStage(logicalId, physicalId, resourceType, properties);
|
|
16926
|
+
return this.deleteStage(logicalId, physicalId, resourceType, properties, context);
|
|
16396
16927
|
case "AWS::ApiGateway::Method":
|
|
16397
|
-
return this.deleteMethod(logicalId, physicalId, resourceType);
|
|
16928
|
+
return this.deleteMethod(logicalId, physicalId, resourceType, context);
|
|
16398
16929
|
default:
|
|
16399
16930
|
throw new ProvisioningError(
|
|
16400
16931
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -16616,7 +17147,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16616
17147
|
/**
|
|
16617
17148
|
* Delete an API Gateway Authorizer
|
|
16618
17149
|
*/
|
|
16619
|
-
async deleteAuthorizer(logicalId, physicalId, resourceType, properties) {
|
|
17150
|
+
async deleteAuthorizer(logicalId, physicalId, resourceType, properties, context) {
|
|
16620
17151
|
this.logger.debug(`Deleting API Gateway Authorizer ${logicalId}: ${physicalId}`);
|
|
16621
17152
|
const restApiId = properties?.["RestApiId"];
|
|
16622
17153
|
if (!restApiId) {
|
|
@@ -16637,6 +17168,14 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16637
17168
|
this.logger.debug(`Successfully deleted API Gateway Authorizer ${logicalId}`);
|
|
16638
17169
|
} catch (error) {
|
|
16639
17170
|
if (error instanceof NotFoundException3) {
|
|
17171
|
+
const clientRegion = await this.apiGatewayClient.config.region();
|
|
17172
|
+
assertRegionMatch(
|
|
17173
|
+
clientRegion,
|
|
17174
|
+
context?.expectedRegion,
|
|
17175
|
+
resourceType,
|
|
17176
|
+
logicalId,
|
|
17177
|
+
physicalId
|
|
17178
|
+
);
|
|
16640
17179
|
this.logger.debug(`API Gateway Authorizer ${physicalId} does not exist, skipping deletion`);
|
|
16641
17180
|
return;
|
|
16642
17181
|
}
|
|
@@ -16741,7 +17280,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16741
17280
|
/**
|
|
16742
17281
|
* Delete an API Gateway Resource
|
|
16743
17282
|
*/
|
|
16744
|
-
async deleteResource(logicalId, physicalId, resourceType, properties) {
|
|
17283
|
+
async deleteResource(logicalId, physicalId, resourceType, properties, context) {
|
|
16745
17284
|
this.logger.debug(`Deleting API Gateway Resource ${logicalId}: ${physicalId}`);
|
|
16746
17285
|
const restApiId = properties?.["RestApiId"];
|
|
16747
17286
|
if (!restApiId) {
|
|
@@ -16762,6 +17301,14 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16762
17301
|
this.logger.debug(`Successfully deleted API Gateway Resource ${logicalId}`);
|
|
16763
17302
|
} catch (error) {
|
|
16764
17303
|
if (error instanceof NotFoundException3) {
|
|
17304
|
+
const clientRegion = await this.apiGatewayClient.config.region();
|
|
17305
|
+
assertRegionMatch(
|
|
17306
|
+
clientRegion,
|
|
17307
|
+
context?.expectedRegion,
|
|
17308
|
+
resourceType,
|
|
17309
|
+
logicalId,
|
|
17310
|
+
physicalId
|
|
17311
|
+
);
|
|
16765
17312
|
this.logger.debug(`API Gateway Resource ${physicalId} does not exist, skipping deletion`);
|
|
16766
17313
|
return;
|
|
16767
17314
|
}
|
|
@@ -16845,7 +17392,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16845
17392
|
/**
|
|
16846
17393
|
* Delete an API Gateway Deployment
|
|
16847
17394
|
*/
|
|
16848
|
-
async deleteDeployment(logicalId, physicalId, resourceType, properties) {
|
|
17395
|
+
async deleteDeployment(logicalId, physicalId, resourceType, properties, context) {
|
|
16849
17396
|
this.logger.debug(`Deleting API Gateway Deployment ${logicalId}: ${physicalId}`);
|
|
16850
17397
|
const restApiId = properties?.["RestApiId"];
|
|
16851
17398
|
if (!restApiId) {
|
|
@@ -16866,6 +17413,14 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
16866
17413
|
this.logger.debug(`Successfully deleted API Gateway Deployment ${logicalId}`);
|
|
16867
17414
|
} catch (error) {
|
|
16868
17415
|
if (error instanceof NotFoundException3) {
|
|
17416
|
+
const clientRegion = await this.apiGatewayClient.config.region();
|
|
17417
|
+
assertRegionMatch(
|
|
17418
|
+
clientRegion,
|
|
17419
|
+
context?.expectedRegion,
|
|
17420
|
+
resourceType,
|
|
17421
|
+
logicalId,
|
|
17422
|
+
physicalId
|
|
17423
|
+
);
|
|
16869
17424
|
this.logger.debug(`API Gateway Deployment ${physicalId} does not exist, skipping deletion`);
|
|
16870
17425
|
return;
|
|
16871
17426
|
}
|
|
@@ -17003,7 +17558,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
17003
17558
|
/**
|
|
17004
17559
|
* Delete an API Gateway Stage
|
|
17005
17560
|
*/
|
|
17006
|
-
async deleteStage(logicalId, physicalId, resourceType, properties) {
|
|
17561
|
+
async deleteStage(logicalId, physicalId, resourceType, properties, context) {
|
|
17007
17562
|
this.logger.debug(`Deleting API Gateway Stage ${logicalId}: ${physicalId}`);
|
|
17008
17563
|
const restApiId = properties?.["RestApiId"];
|
|
17009
17564
|
if (!restApiId) {
|
|
@@ -17024,6 +17579,14 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
17024
17579
|
this.logger.debug(`Successfully deleted API Gateway Stage ${logicalId}`);
|
|
17025
17580
|
} catch (error) {
|
|
17026
17581
|
if (error instanceof NotFoundException3) {
|
|
17582
|
+
const clientRegion = await this.apiGatewayClient.config.region();
|
|
17583
|
+
assertRegionMatch(
|
|
17584
|
+
clientRegion,
|
|
17585
|
+
context?.expectedRegion,
|
|
17586
|
+
resourceType,
|
|
17587
|
+
logicalId,
|
|
17588
|
+
physicalId
|
|
17589
|
+
);
|
|
17027
17590
|
this.logger.debug(`API Gateway Stage ${physicalId} does not exist, skipping deletion`);
|
|
17028
17591
|
return;
|
|
17029
17592
|
}
|
|
@@ -17143,7 +17706,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
17143
17706
|
* Parses the composite physicalId (`restApiId|resourceId|httpMethod`) and
|
|
17144
17707
|
* calls DeleteMethodCommand. Handles NotFoundException gracefully.
|
|
17145
17708
|
*/
|
|
17146
|
-
async deleteMethod(logicalId, physicalId, resourceType) {
|
|
17709
|
+
async deleteMethod(logicalId, physicalId, resourceType, context) {
|
|
17147
17710
|
this.logger.debug(`Deleting API Gateway Method ${logicalId}: ${physicalId}`);
|
|
17148
17711
|
const parts = physicalId.split("|");
|
|
17149
17712
|
if (parts.length !== 3) {
|
|
@@ -17166,6 +17729,14 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
17166
17729
|
this.logger.debug(`Successfully deleted API Gateway Method ${logicalId}`);
|
|
17167
17730
|
} catch (error) {
|
|
17168
17731
|
if (error instanceof NotFoundException3) {
|
|
17732
|
+
const clientRegion = await this.apiGatewayClient.config.region();
|
|
17733
|
+
assertRegionMatch(
|
|
17734
|
+
clientRegion,
|
|
17735
|
+
context?.expectedRegion,
|
|
17736
|
+
resourceType,
|
|
17737
|
+
logicalId,
|
|
17738
|
+
physicalId
|
|
17739
|
+
);
|
|
17169
17740
|
this.logger.debug(`API Gateway Method ${physicalId} does not exist, skipping deletion`);
|
|
17170
17741
|
return;
|
|
17171
17742
|
}
|
|
@@ -17306,18 +17877,18 @@ var ApiGatewayV2Provider = class {
|
|
|
17306
17877
|
attributes: {}
|
|
17307
17878
|
});
|
|
17308
17879
|
}
|
|
17309
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
17880
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
17310
17881
|
switch (resourceType) {
|
|
17311
17882
|
case "AWS::ApiGatewayV2::Api":
|
|
17312
|
-
return this.deleteApi(logicalId, physicalId, resourceType);
|
|
17883
|
+
return this.deleteApi(logicalId, physicalId, resourceType, context);
|
|
17313
17884
|
case "AWS::ApiGatewayV2::Stage":
|
|
17314
|
-
return this.deleteStage(logicalId, physicalId, resourceType, properties);
|
|
17885
|
+
return this.deleteStage(logicalId, physicalId, resourceType, properties, context);
|
|
17315
17886
|
case "AWS::ApiGatewayV2::Integration":
|
|
17316
|
-
return this.deleteIntegration(logicalId, physicalId, resourceType, properties);
|
|
17887
|
+
return this.deleteIntegration(logicalId, physicalId, resourceType, properties, context);
|
|
17317
17888
|
case "AWS::ApiGatewayV2::Route":
|
|
17318
|
-
return this.deleteRoute(logicalId, physicalId, resourceType, properties);
|
|
17889
|
+
return this.deleteRoute(logicalId, physicalId, resourceType, properties, context);
|
|
17319
17890
|
case "AWS::ApiGatewayV2::Authorizer":
|
|
17320
|
-
return this.deleteAuthorizer(logicalId, physicalId, resourceType, properties);
|
|
17891
|
+
return this.deleteAuthorizer(logicalId, physicalId, resourceType, properties, context);
|
|
17321
17892
|
default:
|
|
17322
17893
|
throw new ProvisioningError(
|
|
17323
17894
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -17388,13 +17959,21 @@ var ApiGatewayV2Provider = class {
|
|
|
17388
17959
|
);
|
|
17389
17960
|
}
|
|
17390
17961
|
}
|
|
17391
|
-
async deleteApi(logicalId, physicalId, resourceType) {
|
|
17962
|
+
async deleteApi(logicalId, physicalId, resourceType, context) {
|
|
17392
17963
|
this.logger.debug(`Deleting API Gateway V2 Api ${logicalId}: ${physicalId}`);
|
|
17393
17964
|
try {
|
|
17394
17965
|
await this.getClient().send(new DeleteApiCommand({ ApiId: physicalId }));
|
|
17395
17966
|
this.logger.debug(`Successfully deleted API Gateway V2 Api ${logicalId}`);
|
|
17396
17967
|
} catch (error) {
|
|
17397
17968
|
if (error instanceof NotFoundException4) {
|
|
17969
|
+
const clientRegion = await this.getClient().config.region();
|
|
17970
|
+
assertRegionMatch(
|
|
17971
|
+
clientRegion,
|
|
17972
|
+
context?.expectedRegion,
|
|
17973
|
+
resourceType,
|
|
17974
|
+
logicalId,
|
|
17975
|
+
physicalId
|
|
17976
|
+
);
|
|
17398
17977
|
this.logger.debug(`API Gateway V2 Api ${physicalId} does not exist, skipping deletion`);
|
|
17399
17978
|
return;
|
|
17400
17979
|
}
|
|
@@ -17451,7 +18030,7 @@ var ApiGatewayV2Provider = class {
|
|
|
17451
18030
|
);
|
|
17452
18031
|
}
|
|
17453
18032
|
}
|
|
17454
|
-
async deleteStage(logicalId, physicalId, resourceType, properties) {
|
|
18033
|
+
async deleteStage(logicalId, physicalId, resourceType, properties, context) {
|
|
17455
18034
|
this.logger.debug(`Deleting API Gateway V2 Stage ${logicalId}: ${physicalId}`);
|
|
17456
18035
|
const apiId = properties?.["ApiId"];
|
|
17457
18036
|
if (!apiId) {
|
|
@@ -17467,6 +18046,14 @@ var ApiGatewayV2Provider = class {
|
|
|
17467
18046
|
this.logger.debug(`Successfully deleted API Gateway V2 Stage ${logicalId}`);
|
|
17468
18047
|
} catch (error) {
|
|
17469
18048
|
if (error instanceof NotFoundException4) {
|
|
18049
|
+
const clientRegion = await this.getClient().config.region();
|
|
18050
|
+
assertRegionMatch(
|
|
18051
|
+
clientRegion,
|
|
18052
|
+
context?.expectedRegion,
|
|
18053
|
+
resourceType,
|
|
18054
|
+
logicalId,
|
|
18055
|
+
physicalId
|
|
18056
|
+
);
|
|
17470
18057
|
this.logger.debug(`API Gateway V2 Stage ${physicalId} does not exist, skipping deletion`);
|
|
17471
18058
|
return;
|
|
17472
18059
|
}
|
|
@@ -17528,7 +18115,7 @@ var ApiGatewayV2Provider = class {
|
|
|
17528
18115
|
);
|
|
17529
18116
|
}
|
|
17530
18117
|
}
|
|
17531
|
-
async deleteIntegration(logicalId, physicalId, resourceType, properties) {
|
|
18118
|
+
async deleteIntegration(logicalId, physicalId, resourceType, properties, context) {
|
|
17532
18119
|
this.logger.debug(`Deleting API Gateway V2 Integration ${logicalId}: ${physicalId}`);
|
|
17533
18120
|
const apiId = properties?.["ApiId"];
|
|
17534
18121
|
if (!apiId) {
|
|
@@ -17546,6 +18133,14 @@ var ApiGatewayV2Provider = class {
|
|
|
17546
18133
|
this.logger.debug(`Successfully deleted API Gateway V2 Integration ${logicalId}`);
|
|
17547
18134
|
} catch (error) {
|
|
17548
18135
|
if (error instanceof NotFoundException4) {
|
|
18136
|
+
const clientRegion = await this.getClient().config.region();
|
|
18137
|
+
assertRegionMatch(
|
|
18138
|
+
clientRegion,
|
|
18139
|
+
context?.expectedRegion,
|
|
18140
|
+
resourceType,
|
|
18141
|
+
logicalId,
|
|
18142
|
+
physicalId
|
|
18143
|
+
);
|
|
17549
18144
|
this.logger.debug(
|
|
17550
18145
|
`API Gateway V2 Integration ${physicalId} does not exist, skipping deletion`
|
|
17551
18146
|
);
|
|
@@ -17607,7 +18202,7 @@ var ApiGatewayV2Provider = class {
|
|
|
17607
18202
|
);
|
|
17608
18203
|
}
|
|
17609
18204
|
}
|
|
17610
|
-
async deleteRoute(logicalId, physicalId, resourceType, properties) {
|
|
18205
|
+
async deleteRoute(logicalId, physicalId, resourceType, properties, context) {
|
|
17611
18206
|
this.logger.debug(`Deleting API Gateway V2 Route ${logicalId}: ${physicalId}`);
|
|
17612
18207
|
const apiId = properties?.["ApiId"];
|
|
17613
18208
|
if (!apiId) {
|
|
@@ -17623,6 +18218,14 @@ var ApiGatewayV2Provider = class {
|
|
|
17623
18218
|
this.logger.debug(`Successfully deleted API Gateway V2 Route ${logicalId}`);
|
|
17624
18219
|
} catch (error) {
|
|
17625
18220
|
if (error instanceof NotFoundException4) {
|
|
18221
|
+
const clientRegion = await this.getClient().config.region();
|
|
18222
|
+
assertRegionMatch(
|
|
18223
|
+
clientRegion,
|
|
18224
|
+
context?.expectedRegion,
|
|
18225
|
+
resourceType,
|
|
18226
|
+
logicalId,
|
|
18227
|
+
physicalId
|
|
18228
|
+
);
|
|
17626
18229
|
this.logger.debug(`API Gateway V2 Route ${physicalId} does not exist, skipping deletion`);
|
|
17627
18230
|
return;
|
|
17628
18231
|
}
|
|
@@ -17687,7 +18290,7 @@ var ApiGatewayV2Provider = class {
|
|
|
17687
18290
|
);
|
|
17688
18291
|
}
|
|
17689
18292
|
}
|
|
17690
|
-
async deleteAuthorizer(logicalId, physicalId, resourceType, properties) {
|
|
18293
|
+
async deleteAuthorizer(logicalId, physicalId, resourceType, properties, context) {
|
|
17691
18294
|
this.logger.debug(`Deleting API Gateway V2 Authorizer ${logicalId}: ${physicalId}`);
|
|
17692
18295
|
const apiId = properties?.["ApiId"];
|
|
17693
18296
|
if (!apiId) {
|
|
@@ -17705,6 +18308,14 @@ var ApiGatewayV2Provider = class {
|
|
|
17705
18308
|
this.logger.debug(`Successfully deleted API Gateway V2 Authorizer ${logicalId}`);
|
|
17706
18309
|
} catch (error) {
|
|
17707
18310
|
if (error instanceof NotFoundException4) {
|
|
18311
|
+
const clientRegion = await this.getClient().config.region();
|
|
18312
|
+
assertRegionMatch(
|
|
18313
|
+
clientRegion,
|
|
18314
|
+
context?.expectedRegion,
|
|
18315
|
+
resourceType,
|
|
18316
|
+
logicalId,
|
|
18317
|
+
physicalId
|
|
18318
|
+
);
|
|
17708
18319
|
this.logger.debug(
|
|
17709
18320
|
`API Gateway V2 Authorizer ${physicalId} does not exist, skipping deletion`
|
|
17710
18321
|
);
|
|
@@ -17812,7 +18423,7 @@ var CloudFrontOAIProvider = class {
|
|
|
17812
18423
|
*
|
|
17813
18424
|
* Requires fetching the ETag first, then passing it as IfMatch for deletion.
|
|
17814
18425
|
*/
|
|
17815
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
18426
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
17816
18427
|
this.logger.debug(`Deleting CloudFront OAI ${logicalId}: ${physicalId}`);
|
|
17817
18428
|
try {
|
|
17818
18429
|
let etag;
|
|
@@ -17823,6 +18434,14 @@ var CloudFrontOAIProvider = class {
|
|
|
17823
18434
|
etag = getResponse.ETag;
|
|
17824
18435
|
} catch (error) {
|
|
17825
18436
|
if (error instanceof NoSuchCloudFrontOriginAccessIdentity) {
|
|
18437
|
+
const clientRegion = await this.cloudFrontClient.config.region();
|
|
18438
|
+
assertRegionMatch(
|
|
18439
|
+
clientRegion,
|
|
18440
|
+
context?.expectedRegion,
|
|
18441
|
+
resourceType,
|
|
18442
|
+
logicalId,
|
|
18443
|
+
physicalId
|
|
18444
|
+
);
|
|
17826
18445
|
this.logger.debug(`OAI ${physicalId} does not exist, skipping deletion`);
|
|
17827
18446
|
return;
|
|
17828
18447
|
}
|
|
@@ -17837,6 +18456,14 @@ var CloudFrontOAIProvider = class {
|
|
|
17837
18456
|
this.logger.debug(`Successfully deleted CloudFront OAI ${logicalId}`);
|
|
17838
18457
|
} catch (error) {
|
|
17839
18458
|
if (error instanceof NoSuchCloudFrontOriginAccessIdentity) {
|
|
18459
|
+
const clientRegion = await this.cloudFrontClient.config.region();
|
|
18460
|
+
assertRegionMatch(
|
|
18461
|
+
clientRegion,
|
|
18462
|
+
context?.expectedRegion,
|
|
18463
|
+
resourceType,
|
|
18464
|
+
logicalId,
|
|
18465
|
+
physicalId
|
|
18466
|
+
);
|
|
17840
18467
|
this.logger.debug(`OAI ${physicalId} does not exist, skipping deletion`);
|
|
17841
18468
|
return;
|
|
17842
18469
|
}
|
|
@@ -18010,7 +18637,7 @@ var CloudFrontDistributionProvider = class {
|
|
|
18010
18637
|
* 2. If Enabled, update to Enabled=false and wait
|
|
18011
18638
|
* 3. Delete with the latest ETag
|
|
18012
18639
|
*/
|
|
18013
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
18640
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
18014
18641
|
this.logger.debug(`Deleting CloudFront Distribution ${logicalId}: ${physicalId}`);
|
|
18015
18642
|
try {
|
|
18016
18643
|
let etag;
|
|
@@ -18023,6 +18650,14 @@ var CloudFrontDistributionProvider = class {
|
|
|
18023
18650
|
config = getConfigResponse.DistributionConfig;
|
|
18024
18651
|
} catch (error) {
|
|
18025
18652
|
if (error instanceof NoSuchDistribution) {
|
|
18653
|
+
const clientRegion = await this.cloudFrontClient.config.region();
|
|
18654
|
+
assertRegionMatch(
|
|
18655
|
+
clientRegion,
|
|
18656
|
+
context?.expectedRegion,
|
|
18657
|
+
resourceType,
|
|
18658
|
+
logicalId,
|
|
18659
|
+
physicalId
|
|
18660
|
+
);
|
|
18026
18661
|
this.logger.debug(`Distribution ${physicalId} does not exist, skipping deletion`);
|
|
18027
18662
|
return;
|
|
18028
18663
|
}
|
|
@@ -18054,6 +18689,14 @@ var CloudFrontDistributionProvider = class {
|
|
|
18054
18689
|
this.logger.debug(`Successfully deleted CloudFront Distribution ${logicalId}`);
|
|
18055
18690
|
} catch (error) {
|
|
18056
18691
|
if (error instanceof NoSuchDistribution) {
|
|
18692
|
+
const clientRegion = await this.cloudFrontClient.config.region();
|
|
18693
|
+
assertRegionMatch(
|
|
18694
|
+
clientRegion,
|
|
18695
|
+
context?.expectedRegion,
|
|
18696
|
+
resourceType,
|
|
18697
|
+
logicalId,
|
|
18698
|
+
physicalId
|
|
18699
|
+
);
|
|
18057
18700
|
this.logger.debug(`Distribution ${physicalId} does not exist, skipping deletion`);
|
|
18058
18701
|
return;
|
|
18059
18702
|
}
|
|
@@ -18473,7 +19116,7 @@ var AgentCoreRuntimeProvider = class {
|
|
|
18473
19116
|
/**
|
|
18474
19117
|
* Delete a BedrockAgentCore Runtime
|
|
18475
19118
|
*/
|
|
18476
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
19119
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
18477
19120
|
this.logger.debug(`Deleting BedrockAgentCore Runtime ${logicalId}: ${physicalId}`);
|
|
18478
19121
|
try {
|
|
18479
19122
|
await this.client.send(
|
|
@@ -18484,6 +19127,14 @@ var AgentCoreRuntimeProvider = class {
|
|
|
18484
19127
|
this.logger.debug(`Successfully deleted BedrockAgentCore Runtime ${logicalId}`);
|
|
18485
19128
|
} catch (error) {
|
|
18486
19129
|
if (error instanceof ResourceNotFoundException11) {
|
|
19130
|
+
const clientRegion = await this.client.config.region();
|
|
19131
|
+
assertRegionMatch(
|
|
19132
|
+
clientRegion,
|
|
19133
|
+
context?.expectedRegion,
|
|
19134
|
+
resourceType,
|
|
19135
|
+
logicalId,
|
|
19136
|
+
physicalId
|
|
19137
|
+
);
|
|
18487
19138
|
this.logger.debug(`Runtime ${physicalId} does not exist, skipping deletion`);
|
|
18488
19139
|
return;
|
|
18489
19140
|
}
|
|
@@ -18679,13 +19330,21 @@ var StepFunctionsProvider = class {
|
|
|
18679
19330
|
/**
|
|
18680
19331
|
* Delete a Step Functions state machine
|
|
18681
19332
|
*/
|
|
18682
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
19333
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
18683
19334
|
this.logger.debug(`Deleting Step Functions state machine ${logicalId}: ${physicalId}`);
|
|
18684
19335
|
try {
|
|
18685
19336
|
await this.getClient().send(new DeleteStateMachineCommand({ stateMachineArn: physicalId }));
|
|
18686
19337
|
this.logger.debug(`Successfully deleted Step Functions state machine ${logicalId}`);
|
|
18687
19338
|
} catch (error) {
|
|
18688
19339
|
if (error instanceof StateMachineDoesNotExist) {
|
|
19340
|
+
const clientRegion = await this.getClient().config.region();
|
|
19341
|
+
assertRegionMatch(
|
|
19342
|
+
clientRegion,
|
|
19343
|
+
context?.expectedRegion,
|
|
19344
|
+
resourceType,
|
|
19345
|
+
logicalId,
|
|
19346
|
+
physicalId
|
|
19347
|
+
);
|
|
18689
19348
|
this.logger.debug(
|
|
18690
19349
|
`Step Functions state machine ${physicalId} does not exist, skipping deletion`
|
|
18691
19350
|
);
|
|
@@ -18852,14 +19511,14 @@ var ECSProvider = class {
|
|
|
18852
19511
|
);
|
|
18853
19512
|
}
|
|
18854
19513
|
}
|
|
18855
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
19514
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
18856
19515
|
switch (resourceType) {
|
|
18857
19516
|
case "AWS::ECS::Cluster":
|
|
18858
|
-
return this.deleteCluster(logicalId, physicalId, resourceType);
|
|
19517
|
+
return this.deleteCluster(logicalId, physicalId, resourceType, context);
|
|
18859
19518
|
case "AWS::ECS::TaskDefinition":
|
|
18860
|
-
return this.deleteTaskDefinition(logicalId, physicalId, resourceType);
|
|
19519
|
+
return this.deleteTaskDefinition(logicalId, physicalId, resourceType, context);
|
|
18861
19520
|
case "AWS::ECS::Service":
|
|
18862
|
-
return this.deleteService(logicalId, physicalId, resourceType, properties);
|
|
19521
|
+
return this.deleteService(logicalId, physicalId, resourceType, properties, context);
|
|
18863
19522
|
default:
|
|
18864
19523
|
throw new ProvisioningError(
|
|
18865
19524
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -18960,7 +19619,7 @@ var ECSProvider = class {
|
|
|
18960
19619
|
);
|
|
18961
19620
|
}
|
|
18962
19621
|
}
|
|
18963
|
-
async deleteCluster(logicalId, physicalId, resourceType) {
|
|
19622
|
+
async deleteCluster(logicalId, physicalId, resourceType, context) {
|
|
18964
19623
|
this.logger.debug(`Deleting ECS cluster ${logicalId}: ${physicalId}`);
|
|
18965
19624
|
const client = this.getClient();
|
|
18966
19625
|
try {
|
|
@@ -18968,6 +19627,14 @@ var ECSProvider = class {
|
|
|
18968
19627
|
this.logger.debug(`Successfully deleted ECS cluster ${logicalId}`);
|
|
18969
19628
|
} catch (error) {
|
|
18970
19629
|
if (this.isClusterNotFoundException(error)) {
|
|
19630
|
+
const clientRegion = await client.config.region();
|
|
19631
|
+
assertRegionMatch(
|
|
19632
|
+
clientRegion,
|
|
19633
|
+
context?.expectedRegion,
|
|
19634
|
+
resourceType,
|
|
19635
|
+
logicalId,
|
|
19636
|
+
physicalId
|
|
19637
|
+
);
|
|
18971
19638
|
this.logger.debug(`ECS cluster ${physicalId} not found, skipping deletion`);
|
|
18972
19639
|
return;
|
|
18973
19640
|
}
|
|
@@ -19067,7 +19734,7 @@ var ECSProvider = class {
|
|
|
19067
19734
|
attributes: result.attributes ?? {}
|
|
19068
19735
|
};
|
|
19069
19736
|
}
|
|
19070
|
-
async deleteTaskDefinition(logicalId, physicalId, resourceType) {
|
|
19737
|
+
async deleteTaskDefinition(logicalId, physicalId, resourceType, context) {
|
|
19071
19738
|
this.logger.debug(`Deleting ECS task definition ${logicalId}: ${physicalId}`);
|
|
19072
19739
|
const client = this.getClient();
|
|
19073
19740
|
try {
|
|
@@ -19075,6 +19742,14 @@ var ECSProvider = class {
|
|
|
19075
19742
|
this.logger.debug(`Successfully deregistered ECS task definition ${logicalId}`);
|
|
19076
19743
|
} catch (error) {
|
|
19077
19744
|
if (this.isNotFoundException(error)) {
|
|
19745
|
+
const clientRegion = await client.config.region();
|
|
19746
|
+
assertRegionMatch(
|
|
19747
|
+
clientRegion,
|
|
19748
|
+
context?.expectedRegion,
|
|
19749
|
+
resourceType,
|
|
19750
|
+
logicalId,
|
|
19751
|
+
physicalId
|
|
19752
|
+
);
|
|
19078
19753
|
this.logger.debug(`ECS task definition ${physicalId} not found, skipping deletion`);
|
|
19079
19754
|
return;
|
|
19080
19755
|
}
|
|
@@ -19213,7 +19888,7 @@ var ECSProvider = class {
|
|
|
19213
19888
|
);
|
|
19214
19889
|
}
|
|
19215
19890
|
}
|
|
19216
|
-
async deleteService(logicalId, physicalId, resourceType, properties) {
|
|
19891
|
+
async deleteService(logicalId, physicalId, resourceType, properties, context) {
|
|
19217
19892
|
this.logger.debug(`Deleting ECS service ${logicalId}: ${physicalId}`);
|
|
19218
19893
|
const client = this.getClient();
|
|
19219
19894
|
const cluster = properties?.["Cluster"];
|
|
@@ -19229,6 +19904,14 @@ var ECSProvider = class {
|
|
|
19229
19904
|
this.logger.debug(`Scaled down ECS service ${physicalId} to 0`);
|
|
19230
19905
|
} catch (error) {
|
|
19231
19906
|
if (this.isServiceNotFoundException(error)) {
|
|
19907
|
+
const clientRegion = await client.config.region();
|
|
19908
|
+
assertRegionMatch(
|
|
19909
|
+
clientRegion,
|
|
19910
|
+
context?.expectedRegion,
|
|
19911
|
+
resourceType,
|
|
19912
|
+
logicalId,
|
|
19913
|
+
physicalId
|
|
19914
|
+
);
|
|
19232
19915
|
this.logger.debug(
|
|
19233
19916
|
`ECS service ${physicalId} not found during scale down, skipping deletion`
|
|
19234
19917
|
);
|
|
@@ -19246,6 +19929,14 @@ var ECSProvider = class {
|
|
|
19246
19929
|
this.logger.debug(`Successfully deleted ECS service ${logicalId}`);
|
|
19247
19930
|
} catch (error) {
|
|
19248
19931
|
if (this.isServiceNotFoundException(error)) {
|
|
19932
|
+
const clientRegion = await client.config.region();
|
|
19933
|
+
assertRegionMatch(
|
|
19934
|
+
clientRegion,
|
|
19935
|
+
context?.expectedRegion,
|
|
19936
|
+
resourceType,
|
|
19937
|
+
logicalId,
|
|
19938
|
+
physicalId
|
|
19939
|
+
);
|
|
19249
19940
|
this.logger.debug(`ECS service ${physicalId} not found, skipping deletion`);
|
|
19250
19941
|
return;
|
|
19251
19942
|
}
|
|
@@ -19544,14 +20235,14 @@ var ELBv2Provider = class {
|
|
|
19544
20235
|
);
|
|
19545
20236
|
}
|
|
19546
20237
|
}
|
|
19547
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
20238
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
19548
20239
|
switch (resourceType) {
|
|
19549
20240
|
case "AWS::ElasticLoadBalancingV2::LoadBalancer":
|
|
19550
|
-
return this.deleteLoadBalancer(logicalId, physicalId, resourceType);
|
|
20241
|
+
return this.deleteLoadBalancer(logicalId, physicalId, resourceType, context);
|
|
19551
20242
|
case "AWS::ElasticLoadBalancingV2::TargetGroup":
|
|
19552
|
-
return this.deleteTargetGroup(logicalId, physicalId, resourceType);
|
|
20243
|
+
return this.deleteTargetGroup(logicalId, physicalId, resourceType, context);
|
|
19553
20244
|
case "AWS::ElasticLoadBalancingV2::Listener":
|
|
19554
|
-
return this.deleteListener(logicalId, physicalId, resourceType);
|
|
20245
|
+
return this.deleteListener(logicalId, physicalId, resourceType, context);
|
|
19555
20246
|
default:
|
|
19556
20247
|
throw new ProvisioningError(
|
|
19557
20248
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -19652,13 +20343,21 @@ var ELBv2Provider = class {
|
|
|
19652
20343
|
);
|
|
19653
20344
|
}
|
|
19654
20345
|
}
|
|
19655
|
-
async deleteLoadBalancer(logicalId, physicalId, resourceType) {
|
|
20346
|
+
async deleteLoadBalancer(logicalId, physicalId, resourceType, context) {
|
|
19656
20347
|
this.logger.debug(`Deleting LoadBalancer ${logicalId}: ${physicalId}`);
|
|
19657
20348
|
try {
|
|
19658
20349
|
await this.getClient().send(new DeleteLoadBalancerCommand({ LoadBalancerArn: physicalId }));
|
|
19659
20350
|
this.logger.debug(`Successfully deleted LoadBalancer ${logicalId}`);
|
|
19660
20351
|
} catch (error) {
|
|
19661
20352
|
if (this.isNotFoundError(error)) {
|
|
20353
|
+
const clientRegion = await this.getClient().config.region();
|
|
20354
|
+
assertRegionMatch(
|
|
20355
|
+
clientRegion,
|
|
20356
|
+
context?.expectedRegion,
|
|
20357
|
+
resourceType,
|
|
20358
|
+
logicalId,
|
|
20359
|
+
physicalId
|
|
20360
|
+
);
|
|
19662
20361
|
this.logger.debug(`LoadBalancer ${physicalId} does not exist, skipping deletion`);
|
|
19663
20362
|
return;
|
|
19664
20363
|
}
|
|
@@ -19768,13 +20467,21 @@ var ELBv2Provider = class {
|
|
|
19768
20467
|
);
|
|
19769
20468
|
}
|
|
19770
20469
|
}
|
|
19771
|
-
async deleteTargetGroup(logicalId, physicalId, resourceType) {
|
|
20470
|
+
async deleteTargetGroup(logicalId, physicalId, resourceType, context) {
|
|
19772
20471
|
this.logger.debug(`Deleting TargetGroup ${logicalId}: ${physicalId}`);
|
|
19773
20472
|
try {
|
|
19774
20473
|
await this.getClient().send(new DeleteTargetGroupCommand({ TargetGroupArn: physicalId }));
|
|
19775
20474
|
this.logger.debug(`Successfully deleted TargetGroup ${logicalId}`);
|
|
19776
20475
|
} catch (error) {
|
|
19777
20476
|
if (this.isNotFoundError(error)) {
|
|
20477
|
+
const clientRegion = await this.getClient().config.region();
|
|
20478
|
+
assertRegionMatch(
|
|
20479
|
+
clientRegion,
|
|
20480
|
+
context?.expectedRegion,
|
|
20481
|
+
resourceType,
|
|
20482
|
+
logicalId,
|
|
20483
|
+
physicalId
|
|
20484
|
+
);
|
|
19778
20485
|
this.logger.debug(`TargetGroup ${physicalId} does not exist, skipping deletion`);
|
|
19779
20486
|
return;
|
|
19780
20487
|
}
|
|
@@ -19870,13 +20577,21 @@ var ELBv2Provider = class {
|
|
|
19870
20577
|
);
|
|
19871
20578
|
}
|
|
19872
20579
|
}
|
|
19873
|
-
async deleteListener(logicalId, physicalId, resourceType) {
|
|
20580
|
+
async deleteListener(logicalId, physicalId, resourceType, context) {
|
|
19874
20581
|
this.logger.debug(`Deleting Listener ${logicalId}: ${physicalId}`);
|
|
19875
20582
|
try {
|
|
19876
20583
|
await this.getClient().send(new DeleteListenerCommand({ ListenerArn: physicalId }));
|
|
19877
20584
|
this.logger.debug(`Successfully deleted Listener ${logicalId}`);
|
|
19878
20585
|
} catch (error) {
|
|
19879
20586
|
if (this.isNotFoundError(error)) {
|
|
20587
|
+
const clientRegion = await this.getClient().config.region();
|
|
20588
|
+
assertRegionMatch(
|
|
20589
|
+
clientRegion,
|
|
20590
|
+
context?.expectedRegion,
|
|
20591
|
+
resourceType,
|
|
20592
|
+
logicalId,
|
|
20593
|
+
physicalId
|
|
20594
|
+
);
|
|
19880
20595
|
this.logger.debug(`Listener ${physicalId} does not exist, skipping deletion`);
|
|
19881
20596
|
return;
|
|
19882
20597
|
}
|
|
@@ -20026,14 +20741,14 @@ var RDSProvider = class {
|
|
|
20026
20741
|
);
|
|
20027
20742
|
}
|
|
20028
20743
|
}
|
|
20029
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
20744
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
20030
20745
|
switch (resourceType) {
|
|
20031
20746
|
case "AWS::RDS::DBSubnetGroup":
|
|
20032
|
-
return this.deleteDBSubnetGroup(logicalId, physicalId, resourceType);
|
|
20747
|
+
return this.deleteDBSubnetGroup(logicalId, physicalId, resourceType, context);
|
|
20033
20748
|
case "AWS::RDS::DBCluster":
|
|
20034
|
-
return this.deleteDBCluster(logicalId, physicalId, resourceType);
|
|
20749
|
+
return this.deleteDBCluster(logicalId, physicalId, resourceType, context);
|
|
20035
20750
|
case "AWS::RDS::DBInstance":
|
|
20036
|
-
return this.deleteDBInstance(logicalId, physicalId, resourceType);
|
|
20751
|
+
return this.deleteDBInstance(logicalId, physicalId, resourceType, context);
|
|
20037
20752
|
default:
|
|
20038
20753
|
throw new ProvisioningError(
|
|
20039
20754
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -20104,7 +20819,7 @@ var RDSProvider = class {
|
|
|
20104
20819
|
);
|
|
20105
20820
|
}
|
|
20106
20821
|
}
|
|
20107
|
-
async deleteDBSubnetGroup(logicalId, physicalId, resourceType) {
|
|
20822
|
+
async deleteDBSubnetGroup(logicalId, physicalId, resourceType, context) {
|
|
20108
20823
|
this.logger.debug(`Deleting DBSubnetGroup ${logicalId}: ${physicalId}`);
|
|
20109
20824
|
try {
|
|
20110
20825
|
await this.getClient().send(
|
|
@@ -20115,6 +20830,14 @@ var RDSProvider = class {
|
|
|
20115
20830
|
this.logger.debug(`Successfully deleted DBSubnetGroup ${logicalId}`);
|
|
20116
20831
|
} catch (error) {
|
|
20117
20832
|
if (this.isNotFoundError(error, "DBSubnetGroupNotFoundFault")) {
|
|
20833
|
+
const clientRegion = await this.getClient().config.region();
|
|
20834
|
+
assertRegionMatch(
|
|
20835
|
+
clientRegion,
|
|
20836
|
+
context?.expectedRegion,
|
|
20837
|
+
resourceType,
|
|
20838
|
+
logicalId,
|
|
20839
|
+
physicalId
|
|
20840
|
+
);
|
|
20118
20841
|
this.logger.debug(`DBSubnetGroup ${physicalId} does not exist, skipping deletion`);
|
|
20119
20842
|
return;
|
|
20120
20843
|
}
|
|
@@ -20237,7 +20960,7 @@ var RDSProvider = class {
|
|
|
20237
20960
|
);
|
|
20238
20961
|
}
|
|
20239
20962
|
}
|
|
20240
|
-
async deleteDBCluster(logicalId, physicalId, resourceType) {
|
|
20963
|
+
async deleteDBCluster(logicalId, physicalId, resourceType, context) {
|
|
20241
20964
|
this.logger.debug(`Deleting DBCluster ${logicalId}: ${physicalId}`);
|
|
20242
20965
|
try {
|
|
20243
20966
|
try {
|
|
@@ -20264,6 +20987,14 @@ var RDSProvider = class {
|
|
|
20264
20987
|
await this.waitForClusterDeleted(physicalId);
|
|
20265
20988
|
} catch (error) {
|
|
20266
20989
|
if (this.isNotFoundError(error, "DBClusterNotFoundFault")) {
|
|
20990
|
+
const clientRegion = await this.getClient().config.region();
|
|
20991
|
+
assertRegionMatch(
|
|
20992
|
+
clientRegion,
|
|
20993
|
+
context?.expectedRegion,
|
|
20994
|
+
resourceType,
|
|
20995
|
+
logicalId,
|
|
20996
|
+
physicalId
|
|
20997
|
+
);
|
|
20267
20998
|
this.logger.debug(`DBCluster ${physicalId} does not exist, skipping deletion`);
|
|
20268
20999
|
return;
|
|
20269
21000
|
}
|
|
@@ -20357,7 +21088,7 @@ var RDSProvider = class {
|
|
|
20357
21088
|
);
|
|
20358
21089
|
}
|
|
20359
21090
|
}
|
|
20360
|
-
async deleteDBInstance(logicalId, physicalId, resourceType) {
|
|
21091
|
+
async deleteDBInstance(logicalId, physicalId, resourceType, context) {
|
|
20361
21092
|
this.logger.debug(`Deleting DBInstance ${logicalId}: ${physicalId}`);
|
|
20362
21093
|
try {
|
|
20363
21094
|
try {
|
|
@@ -20385,6 +21116,14 @@ var RDSProvider = class {
|
|
|
20385
21116
|
await this.waitForInstanceDeleted(physicalId);
|
|
20386
21117
|
} catch (error) {
|
|
20387
21118
|
if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) {
|
|
21119
|
+
const clientRegion = await this.getClient().config.region();
|
|
21120
|
+
assertRegionMatch(
|
|
21121
|
+
clientRegion,
|
|
21122
|
+
context?.expectedRegion,
|
|
21123
|
+
resourceType,
|
|
21124
|
+
logicalId,
|
|
21125
|
+
physicalId
|
|
21126
|
+
);
|
|
20388
21127
|
this.logger.debug(`DBInstance ${physicalId} does not exist, skipping deletion`);
|
|
20389
21128
|
return;
|
|
20390
21129
|
}
|
|
@@ -20598,12 +21337,12 @@ var Route53Provider = class {
|
|
|
20598
21337
|
);
|
|
20599
21338
|
}
|
|
20600
21339
|
}
|
|
20601
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
21340
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
20602
21341
|
switch (resourceType) {
|
|
20603
21342
|
case "AWS::Route53::HostedZone":
|
|
20604
|
-
return this.deleteHostedZone(logicalId, physicalId, resourceType);
|
|
21343
|
+
return this.deleteHostedZone(logicalId, physicalId, resourceType, context);
|
|
20605
21344
|
case "AWS::Route53::RecordSet":
|
|
20606
|
-
return this.deleteRecordSet(logicalId, physicalId, resourceType, properties);
|
|
21345
|
+
return this.deleteRecordSet(logicalId, physicalId, resourceType, properties, context);
|
|
20607
21346
|
default:
|
|
20608
21347
|
throw new ProvisioningError(
|
|
20609
21348
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -20737,7 +21476,7 @@ var Route53Provider = class {
|
|
|
20737
21476
|
);
|
|
20738
21477
|
}
|
|
20739
21478
|
}
|
|
20740
|
-
async deleteHostedZone(logicalId, physicalId, resourceType) {
|
|
21479
|
+
async deleteHostedZone(logicalId, physicalId, resourceType, context) {
|
|
20741
21480
|
this.logger.debug(`Deleting Route 53 hosted zone ${logicalId}: ${physicalId}`);
|
|
20742
21481
|
try {
|
|
20743
21482
|
await this.deleteQueryLoggingConfigForZone(physicalId, logicalId);
|
|
@@ -20745,6 +21484,14 @@ var Route53Provider = class {
|
|
|
20745
21484
|
this.logger.debug(`Successfully deleted hosted zone ${logicalId}`);
|
|
20746
21485
|
} catch (error) {
|
|
20747
21486
|
if (error instanceof Error && error.name === "NoSuchHostedZone") {
|
|
21487
|
+
const clientRegion = await this.getClient().config.region();
|
|
21488
|
+
assertRegionMatch(
|
|
21489
|
+
clientRegion,
|
|
21490
|
+
context?.expectedRegion,
|
|
21491
|
+
resourceType,
|
|
21492
|
+
logicalId,
|
|
21493
|
+
physicalId
|
|
21494
|
+
);
|
|
20748
21495
|
this.logger.debug(`Hosted zone ${physicalId} does not exist, skipping deletion`);
|
|
20749
21496
|
return;
|
|
20750
21497
|
}
|
|
@@ -20857,7 +21604,7 @@ var Route53Provider = class {
|
|
|
20857
21604
|
);
|
|
20858
21605
|
}
|
|
20859
21606
|
}
|
|
20860
|
-
async deleteRecordSet(logicalId, physicalId, resourceType, properties) {
|
|
21607
|
+
async deleteRecordSet(logicalId, physicalId, resourceType, properties, context) {
|
|
20861
21608
|
this.logger.debug(`Deleting Route 53 record set ${logicalId}: ${physicalId}`);
|
|
20862
21609
|
const parts = physicalId.split("|");
|
|
20863
21610
|
if (parts.length !== 3) {
|
|
@@ -20895,6 +21642,14 @@ var Route53Provider = class {
|
|
|
20895
21642
|
this.logger.debug(`Successfully deleted record set ${logicalId}`);
|
|
20896
21643
|
} catch (error) {
|
|
20897
21644
|
if (error instanceof Error && (error.name === "InvalidChangeBatch" || error.message.includes("it was not found"))) {
|
|
21645
|
+
const clientRegion = await this.getClient().config.region();
|
|
21646
|
+
assertRegionMatch(
|
|
21647
|
+
clientRegion,
|
|
21648
|
+
context?.expectedRegion,
|
|
21649
|
+
resourceType,
|
|
21650
|
+
logicalId,
|
|
21651
|
+
physicalId
|
|
21652
|
+
);
|
|
20898
21653
|
this.logger.debug(`Record set ${physicalId} does not exist, skipping deletion`);
|
|
20899
21654
|
return;
|
|
20900
21655
|
}
|
|
@@ -21335,7 +22090,7 @@ var WAFv2WebACLProvider = class {
|
|
|
21335
22090
|
* DeleteWebACL requires LockToken obtained from GetWebACL.
|
|
21336
22091
|
* WAFNonexistentItemException is treated as success (idempotent delete).
|
|
21337
22092
|
*/
|
|
21338
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
22093
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
21339
22094
|
this.logger.debug(`Deleting WAFv2 WebACL ${logicalId}: ${physicalId}`);
|
|
21340
22095
|
try {
|
|
21341
22096
|
const { id, name, scope } = parseWebACLArn(physicalId);
|
|
@@ -21361,6 +22116,14 @@ var WAFv2WebACLProvider = class {
|
|
|
21361
22116
|
this.logger.debug(`Successfully deleted WAFv2 WebACL ${logicalId}`);
|
|
21362
22117
|
} catch (error) {
|
|
21363
22118
|
if (error instanceof WAFNonexistentItemException) {
|
|
22119
|
+
const clientRegion = await this.getClient().config.region();
|
|
22120
|
+
assertRegionMatch(
|
|
22121
|
+
clientRegion,
|
|
22122
|
+
context?.expectedRegion,
|
|
22123
|
+
resourceType,
|
|
22124
|
+
logicalId,
|
|
22125
|
+
physicalId
|
|
22126
|
+
);
|
|
21364
22127
|
this.logger.debug(`WAFv2 WebACL ${physicalId} does not exist, skipping deletion`);
|
|
21365
22128
|
return;
|
|
21366
22129
|
}
|
|
@@ -21645,7 +22408,7 @@ var CognitoUserPoolProvider = class {
|
|
|
21645
22408
|
*
|
|
21646
22409
|
* If DeletionProtection is ACTIVE, it is automatically disabled before deletion.
|
|
21647
22410
|
*/
|
|
21648
|
-
async delete(logicalId, physicalId, resourceType, properties) {
|
|
22411
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
21649
22412
|
this.logger.debug(`Deleting Cognito User Pool ${logicalId}: ${physicalId}`);
|
|
21650
22413
|
try {
|
|
21651
22414
|
const deletionProtection = properties?.["DeletionProtection"];
|
|
@@ -21677,6 +22440,14 @@ var CognitoUserPoolProvider = class {
|
|
|
21677
22440
|
}
|
|
21678
22441
|
} catch (descError) {
|
|
21679
22442
|
if (descError instanceof ResourceNotFoundException12) {
|
|
22443
|
+
const clientRegion = await this.getClient().config.region();
|
|
22444
|
+
assertRegionMatch(
|
|
22445
|
+
clientRegion,
|
|
22446
|
+
context?.expectedRegion,
|
|
22447
|
+
resourceType,
|
|
22448
|
+
logicalId,
|
|
22449
|
+
physicalId
|
|
22450
|
+
);
|
|
21680
22451
|
this.logger.debug(`Cognito User Pool ${physicalId} does not exist, skipping deletion`);
|
|
21681
22452
|
return;
|
|
21682
22453
|
}
|
|
@@ -21689,6 +22460,14 @@ var CognitoUserPoolProvider = class {
|
|
|
21689
22460
|
this.logger.debug(`Successfully deleted Cognito User Pool ${logicalId}`);
|
|
21690
22461
|
} catch (error) {
|
|
21691
22462
|
if (error instanceof ResourceNotFoundException12) {
|
|
22463
|
+
const clientRegion = await this.getClient().config.region();
|
|
22464
|
+
assertRegionMatch(
|
|
22465
|
+
clientRegion,
|
|
22466
|
+
context?.expectedRegion,
|
|
22467
|
+
resourceType,
|
|
22468
|
+
logicalId,
|
|
22469
|
+
physicalId
|
|
22470
|
+
);
|
|
21692
22471
|
this.logger.debug(`Cognito User Pool ${physicalId} does not exist, skipping deletion`);
|
|
21693
22472
|
return;
|
|
21694
22473
|
}
|
|
@@ -21791,12 +22570,12 @@ var ElastiCacheProvider = class {
|
|
|
21791
22570
|
);
|
|
21792
22571
|
}
|
|
21793
22572
|
}
|
|
21794
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
22573
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
21795
22574
|
switch (resourceType) {
|
|
21796
22575
|
case "AWS::ElastiCache::SubnetGroup":
|
|
21797
|
-
return this.deleteSubnetGroup(logicalId, physicalId, resourceType);
|
|
22576
|
+
return this.deleteSubnetGroup(logicalId, physicalId, resourceType, context);
|
|
21798
22577
|
case "AWS::ElastiCache::CacheCluster":
|
|
21799
|
-
return this.deleteCacheCluster(logicalId, physicalId, resourceType);
|
|
22578
|
+
return this.deleteCacheCluster(logicalId, physicalId, resourceType, context);
|
|
21800
22579
|
default:
|
|
21801
22580
|
throw new ProvisioningError(
|
|
21802
22581
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -21867,7 +22646,7 @@ var ElastiCacheProvider = class {
|
|
|
21867
22646
|
);
|
|
21868
22647
|
}
|
|
21869
22648
|
}
|
|
21870
|
-
async deleteSubnetGroup(logicalId, physicalId, resourceType) {
|
|
22649
|
+
async deleteSubnetGroup(logicalId, physicalId, resourceType, context) {
|
|
21871
22650
|
this.logger.debug(`Deleting CacheSubnetGroup ${logicalId}: ${physicalId}`);
|
|
21872
22651
|
try {
|
|
21873
22652
|
await this.getClient().send(
|
|
@@ -21878,6 +22657,14 @@ var ElastiCacheProvider = class {
|
|
|
21878
22657
|
this.logger.debug(`Successfully deleted CacheSubnetGroup ${logicalId}`);
|
|
21879
22658
|
} catch (error) {
|
|
21880
22659
|
if (this.isNotFoundError(error, "CacheSubnetGroupNotFoundFault")) {
|
|
22660
|
+
const clientRegion = await this.getClient().config.region();
|
|
22661
|
+
assertRegionMatch(
|
|
22662
|
+
clientRegion,
|
|
22663
|
+
context?.expectedRegion,
|
|
22664
|
+
resourceType,
|
|
22665
|
+
logicalId,
|
|
22666
|
+
physicalId
|
|
22667
|
+
);
|
|
21881
22668
|
this.logger.debug(`CacheSubnetGroup ${physicalId} does not exist, skipping deletion`);
|
|
21882
22669
|
return;
|
|
21883
22670
|
}
|
|
@@ -22011,7 +22798,7 @@ var ElastiCacheProvider = class {
|
|
|
22011
22798
|
);
|
|
22012
22799
|
}
|
|
22013
22800
|
}
|
|
22014
|
-
async deleteCacheCluster(logicalId, physicalId, resourceType) {
|
|
22801
|
+
async deleteCacheCluster(logicalId, physicalId, resourceType, context) {
|
|
22015
22802
|
this.logger.debug(`Deleting CacheCluster ${logicalId}: ${physicalId}`);
|
|
22016
22803
|
try {
|
|
22017
22804
|
await this.getClient().send(
|
|
@@ -22023,6 +22810,14 @@ var ElastiCacheProvider = class {
|
|
|
22023
22810
|
await this.waitForClusterDeleted(physicalId);
|
|
22024
22811
|
} catch (error) {
|
|
22025
22812
|
if (this.isNotFoundError(error, "CacheClusterNotFoundFault")) {
|
|
22813
|
+
const clientRegion = await this.getClient().config.region();
|
|
22814
|
+
assertRegionMatch(
|
|
22815
|
+
clientRegion,
|
|
22816
|
+
context?.expectedRegion,
|
|
22817
|
+
resourceType,
|
|
22818
|
+
logicalId,
|
|
22819
|
+
physicalId
|
|
22820
|
+
);
|
|
22026
22821
|
this.logger.debug(`CacheCluster ${physicalId} does not exist, skipping deletion`);
|
|
22027
22822
|
return;
|
|
22028
22823
|
}
|
|
@@ -22181,12 +22976,12 @@ var ServiceDiscoveryProvider = class {
|
|
|
22181
22976
|
);
|
|
22182
22977
|
}
|
|
22183
22978
|
}
|
|
22184
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
22979
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
22185
22980
|
switch (resourceType) {
|
|
22186
22981
|
case "AWS::ServiceDiscovery::PrivateDnsNamespace":
|
|
22187
|
-
return this.deleteNamespace(logicalId, physicalId, resourceType);
|
|
22982
|
+
return this.deleteNamespace(logicalId, physicalId, resourceType, context);
|
|
22188
22983
|
case "AWS::ServiceDiscovery::Service":
|
|
22189
|
-
return this.deleteService(logicalId, physicalId, resourceType);
|
|
22984
|
+
return this.deleteService(logicalId, physicalId, resourceType, context);
|
|
22190
22985
|
default:
|
|
22191
22986
|
throw new ProvisioningError(
|
|
22192
22987
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -22264,7 +23059,7 @@ var ServiceDiscoveryProvider = class {
|
|
|
22264
23059
|
}
|
|
22265
23060
|
});
|
|
22266
23061
|
}
|
|
22267
|
-
async deleteNamespace(logicalId, physicalId, resourceType) {
|
|
23062
|
+
async deleteNamespace(logicalId, physicalId, resourceType, context) {
|
|
22268
23063
|
this.logger.debug(`Deleting private DNS namespace ${logicalId}: ${physicalId}`);
|
|
22269
23064
|
const client = this.getClient();
|
|
22270
23065
|
try {
|
|
@@ -22276,6 +23071,14 @@ var ServiceDiscoveryProvider = class {
|
|
|
22276
23071
|
this.logger.debug(`Successfully deleted private DNS namespace ${logicalId}`);
|
|
22277
23072
|
} catch (error) {
|
|
22278
23073
|
if (error instanceof NamespaceNotFound) {
|
|
23074
|
+
const clientRegion = await this.getClient().config.region();
|
|
23075
|
+
assertRegionMatch(
|
|
23076
|
+
clientRegion,
|
|
23077
|
+
context?.expectedRegion,
|
|
23078
|
+
resourceType,
|
|
23079
|
+
logicalId,
|
|
23080
|
+
physicalId
|
|
23081
|
+
);
|
|
22279
23082
|
this.logger.debug(`Namespace ${physicalId} does not exist, skipping deletion`);
|
|
22280
23083
|
return;
|
|
22281
23084
|
}
|
|
@@ -22359,7 +23162,7 @@ var ServiceDiscoveryProvider = class {
|
|
|
22359
23162
|
}
|
|
22360
23163
|
});
|
|
22361
23164
|
}
|
|
22362
|
-
async deleteService(logicalId, physicalId, resourceType) {
|
|
23165
|
+
async deleteService(logicalId, physicalId, resourceType, context) {
|
|
22363
23166
|
this.logger.debug(`Deleting service discovery service ${logicalId}: ${physicalId}`);
|
|
22364
23167
|
const client = this.getClient();
|
|
22365
23168
|
try {
|
|
@@ -22367,6 +23170,14 @@ var ServiceDiscoveryProvider = class {
|
|
|
22367
23170
|
this.logger.debug(`Successfully deleted service discovery service ${logicalId}`);
|
|
22368
23171
|
} catch (error) {
|
|
22369
23172
|
if (error instanceof ServiceNotFound) {
|
|
23173
|
+
const clientRegion = await this.getClient().config.region();
|
|
23174
|
+
assertRegionMatch(
|
|
23175
|
+
clientRegion,
|
|
23176
|
+
context?.expectedRegion,
|
|
23177
|
+
resourceType,
|
|
23178
|
+
logicalId,
|
|
23179
|
+
physicalId
|
|
23180
|
+
);
|
|
22370
23181
|
this.logger.debug(`Service ${physicalId} does not exist, skipping deletion`);
|
|
22371
23182
|
return;
|
|
22372
23183
|
}
|
|
@@ -22513,19 +23324,19 @@ var AppSyncProvider = class {
|
|
|
22513
23324
|
this.logger.debug(`Update for ${resourceType} ${logicalId} (${physicalId}) - no-op, immutable`);
|
|
22514
23325
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
22515
23326
|
}
|
|
22516
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
23327
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
22517
23328
|
switch (resourceType) {
|
|
22518
23329
|
case "AWS::AppSync::GraphQLApi":
|
|
22519
|
-
return this.deleteGraphQLApi(logicalId, physicalId, resourceType);
|
|
23330
|
+
return this.deleteGraphQLApi(logicalId, physicalId, resourceType, context);
|
|
22520
23331
|
case "AWS::AppSync::GraphQLSchema":
|
|
22521
23332
|
this.logger.debug(`Schema ${logicalId} is deleted with its API, skipping`);
|
|
22522
23333
|
return;
|
|
22523
23334
|
case "AWS::AppSync::DataSource":
|
|
22524
|
-
return this.deleteDataSource(logicalId, physicalId, resourceType);
|
|
23335
|
+
return this.deleteDataSource(logicalId, physicalId, resourceType, context);
|
|
22525
23336
|
case "AWS::AppSync::Resolver":
|
|
22526
|
-
return this.deleteResolver(logicalId, physicalId, resourceType);
|
|
23337
|
+
return this.deleteResolver(logicalId, physicalId, resourceType, context);
|
|
22527
23338
|
case "AWS::AppSync::ApiKey":
|
|
22528
|
-
return this.deleteApiKey(logicalId, physicalId, resourceType);
|
|
23339
|
+
return this.deleteApiKey(logicalId, physicalId, resourceType, context);
|
|
22529
23340
|
default:
|
|
22530
23341
|
throw new ProvisioningError(
|
|
22531
23342
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -22599,13 +23410,21 @@ var AppSyncProvider = class {
|
|
|
22599
23410
|
);
|
|
22600
23411
|
}
|
|
22601
23412
|
}
|
|
22602
|
-
async deleteGraphQLApi(logicalId, physicalId, resourceType) {
|
|
23413
|
+
async deleteGraphQLApi(logicalId, physicalId, resourceType, context) {
|
|
22603
23414
|
this.logger.debug(`Deleting GraphQL API ${logicalId}: ${physicalId}`);
|
|
22604
23415
|
try {
|
|
22605
23416
|
await this.getClient().send(new DeleteGraphqlApiCommand({ apiId: physicalId }));
|
|
22606
23417
|
this.logger.debug(`Successfully deleted GraphQL API ${logicalId}`);
|
|
22607
23418
|
} catch (error) {
|
|
22608
23419
|
if (this.isNotFoundError(error)) {
|
|
23420
|
+
const clientRegion = await this.getClient().config.region();
|
|
23421
|
+
assertRegionMatch(
|
|
23422
|
+
clientRegion,
|
|
23423
|
+
context?.expectedRegion,
|
|
23424
|
+
resourceType,
|
|
23425
|
+
logicalId,
|
|
23426
|
+
physicalId
|
|
23427
|
+
);
|
|
22609
23428
|
this.logger.debug(`GraphQL API ${physicalId} does not exist, skipping deletion`);
|
|
22610
23429
|
return;
|
|
22611
23430
|
}
|
|
@@ -22725,7 +23544,7 @@ var AppSyncProvider = class {
|
|
|
22725
23544
|
);
|
|
22726
23545
|
}
|
|
22727
23546
|
}
|
|
22728
|
-
async deleteDataSource(logicalId, physicalId, resourceType) {
|
|
23547
|
+
async deleteDataSource(logicalId, physicalId, resourceType, context) {
|
|
22729
23548
|
this.logger.debug(`Deleting DataSource ${logicalId}: ${physicalId}`);
|
|
22730
23549
|
const [apiId, name] = physicalId.split("|");
|
|
22731
23550
|
if (!apiId || !name) {
|
|
@@ -22737,6 +23556,14 @@ var AppSyncProvider = class {
|
|
|
22737
23556
|
this.logger.debug(`Successfully deleted DataSource ${logicalId}`);
|
|
22738
23557
|
} catch (error) {
|
|
22739
23558
|
if (this.isNotFoundError(error)) {
|
|
23559
|
+
const clientRegion = await this.getClient().config.region();
|
|
23560
|
+
assertRegionMatch(
|
|
23561
|
+
clientRegion,
|
|
23562
|
+
context?.expectedRegion,
|
|
23563
|
+
resourceType,
|
|
23564
|
+
logicalId,
|
|
23565
|
+
physicalId
|
|
23566
|
+
);
|
|
22740
23567
|
this.logger.debug(`DataSource ${physicalId} does not exist, skipping deletion`);
|
|
22741
23568
|
return;
|
|
22742
23569
|
}
|
|
@@ -22817,7 +23644,7 @@ var AppSyncProvider = class {
|
|
|
22817
23644
|
);
|
|
22818
23645
|
}
|
|
22819
23646
|
}
|
|
22820
|
-
async deleteResolver(logicalId, physicalId, resourceType) {
|
|
23647
|
+
async deleteResolver(logicalId, physicalId, resourceType, context) {
|
|
22821
23648
|
this.logger.debug(`Deleting Resolver ${logicalId}: ${physicalId}`);
|
|
22822
23649
|
const parts = physicalId.split("|");
|
|
22823
23650
|
if (parts.length < 3) {
|
|
@@ -22830,6 +23657,14 @@ var AppSyncProvider = class {
|
|
|
22830
23657
|
this.logger.debug(`Successfully deleted Resolver ${logicalId}`);
|
|
22831
23658
|
} catch (error) {
|
|
22832
23659
|
if (this.isNotFoundError(error)) {
|
|
23660
|
+
const clientRegion = await this.getClient().config.region();
|
|
23661
|
+
assertRegionMatch(
|
|
23662
|
+
clientRegion,
|
|
23663
|
+
context?.expectedRegion,
|
|
23664
|
+
resourceType,
|
|
23665
|
+
logicalId,
|
|
23666
|
+
physicalId
|
|
23667
|
+
);
|
|
22833
23668
|
this.logger.debug(`Resolver ${physicalId} does not exist, skipping deletion`);
|
|
22834
23669
|
return;
|
|
22835
23670
|
}
|
|
@@ -22883,7 +23718,7 @@ var AppSyncProvider = class {
|
|
|
22883
23718
|
);
|
|
22884
23719
|
}
|
|
22885
23720
|
}
|
|
22886
|
-
async deleteApiKey(logicalId, physicalId, resourceType) {
|
|
23721
|
+
async deleteApiKey(logicalId, physicalId, resourceType, context) {
|
|
22887
23722
|
this.logger.debug(`Deleting ApiKey ${logicalId}: ${physicalId}`);
|
|
22888
23723
|
const [apiId, apiKeyId] = physicalId.split("|");
|
|
22889
23724
|
if (!apiId || !apiKeyId) {
|
|
@@ -22895,6 +23730,14 @@ var AppSyncProvider = class {
|
|
|
22895
23730
|
this.logger.debug(`Successfully deleted ApiKey ${logicalId}`);
|
|
22896
23731
|
} catch (error) {
|
|
22897
23732
|
if (this.isNotFoundError(error)) {
|
|
23733
|
+
const clientRegion = await this.getClient().config.region();
|
|
23734
|
+
assertRegionMatch(
|
|
23735
|
+
clientRegion,
|
|
23736
|
+
context?.expectedRegion,
|
|
23737
|
+
resourceType,
|
|
23738
|
+
logicalId,
|
|
23739
|
+
physicalId
|
|
23740
|
+
);
|
|
22898
23741
|
this.logger.debug(`ApiKey ${physicalId} does not exist, skipping deletion`);
|
|
22899
23742
|
return;
|
|
22900
23743
|
}
|
|
@@ -22975,12 +23818,12 @@ var GlueProvider = class {
|
|
|
22975
23818
|
);
|
|
22976
23819
|
}
|
|
22977
23820
|
}
|
|
22978
|
-
async delete(logicalId, physicalId, resourceType,
|
|
23821
|
+
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
22979
23822
|
switch (resourceType) {
|
|
22980
23823
|
case "AWS::Glue::Database":
|
|
22981
|
-
return this.deleteDatabase(logicalId, physicalId, resourceType);
|
|
23824
|
+
return this.deleteDatabase(logicalId, physicalId, resourceType, properties, context);
|
|
22982
23825
|
case "AWS::Glue::Table":
|
|
22983
|
-
return this.deleteTable(logicalId, physicalId, resourceType);
|
|
23826
|
+
return this.deleteTable(logicalId, physicalId, resourceType, properties, context);
|
|
22984
23827
|
default:
|
|
22985
23828
|
throw new ProvisioningError(
|
|
22986
23829
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -23038,7 +23881,7 @@ var GlueProvider = class {
|
|
|
23038
23881
|
);
|
|
23039
23882
|
}
|
|
23040
23883
|
}
|
|
23041
|
-
async deleteDatabase(logicalId, physicalId, resourceType, properties) {
|
|
23884
|
+
async deleteDatabase(logicalId, physicalId, resourceType, properties, context) {
|
|
23042
23885
|
this.logger.debug(`Deleting Glue Database ${logicalId}: ${physicalId}`);
|
|
23043
23886
|
try {
|
|
23044
23887
|
const catalogId = properties?.["CatalogId"];
|
|
@@ -23051,6 +23894,14 @@ var GlueProvider = class {
|
|
|
23051
23894
|
this.logger.debug(`Successfully deleted Glue Database ${logicalId}`);
|
|
23052
23895
|
} catch (error) {
|
|
23053
23896
|
if (error instanceof EntityNotFoundException) {
|
|
23897
|
+
const clientRegion = await this.getClient().config.region();
|
|
23898
|
+
assertRegionMatch(
|
|
23899
|
+
clientRegion,
|
|
23900
|
+
context?.expectedRegion,
|
|
23901
|
+
resourceType,
|
|
23902
|
+
logicalId,
|
|
23903
|
+
physicalId
|
|
23904
|
+
);
|
|
23054
23905
|
this.logger.debug(`Glue Database ${physicalId} does not exist, skipping deletion`);
|
|
23055
23906
|
return;
|
|
23056
23907
|
}
|
|
@@ -23162,7 +24013,7 @@ var GlueProvider = class {
|
|
|
23162
24013
|
);
|
|
23163
24014
|
}
|
|
23164
24015
|
}
|
|
23165
|
-
async deleteTable(logicalId, physicalId, resourceType) {
|
|
24016
|
+
async deleteTable(logicalId, physicalId, resourceType, _properties, context) {
|
|
23166
24017
|
this.logger.debug(`Deleting Glue Table ${logicalId}: ${physicalId}`);
|
|
23167
24018
|
const [databaseName, tableName] = physicalId.split("|");
|
|
23168
24019
|
if (!databaseName || !tableName) {
|
|
@@ -23179,6 +24030,14 @@ var GlueProvider = class {
|
|
|
23179
24030
|
this.logger.debug(`Successfully deleted Glue Table ${logicalId}`);
|
|
23180
24031
|
} catch (error) {
|
|
23181
24032
|
if (error instanceof EntityNotFoundException) {
|
|
24033
|
+
const clientRegion = await this.getClient().config.region();
|
|
24034
|
+
assertRegionMatch(
|
|
24035
|
+
clientRegion,
|
|
24036
|
+
context?.expectedRegion,
|
|
24037
|
+
resourceType,
|
|
24038
|
+
logicalId,
|
|
24039
|
+
physicalId
|
|
24040
|
+
);
|
|
23182
24041
|
this.logger.debug(`Glue Table ${physicalId} does not exist, skipping deletion`);
|
|
23183
24042
|
return;
|
|
23184
24043
|
}
|
|
@@ -23364,12 +24223,12 @@ var KMSProvider = class {
|
|
|
23364
24223
|
);
|
|
23365
24224
|
}
|
|
23366
24225
|
}
|
|
23367
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
24226
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
23368
24227
|
switch (resourceType) {
|
|
23369
24228
|
case "AWS::KMS::Key":
|
|
23370
|
-
return this.deleteKey(logicalId, physicalId, resourceType, _properties);
|
|
24229
|
+
return this.deleteKey(logicalId, physicalId, resourceType, _properties, context);
|
|
23371
24230
|
case "AWS::KMS::Alias":
|
|
23372
|
-
return this.deleteAlias(logicalId, physicalId, resourceType);
|
|
24231
|
+
return this.deleteAlias(logicalId, physicalId, resourceType, context);
|
|
23373
24232
|
default:
|
|
23374
24233
|
throw new ProvisioningError(
|
|
23375
24234
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -23533,7 +24392,7 @@ var KMSProvider = class {
|
|
|
23533
24392
|
);
|
|
23534
24393
|
}
|
|
23535
24394
|
}
|
|
23536
|
-
async deleteKey(logicalId, physicalId, resourceType, properties) {
|
|
24395
|
+
async deleteKey(logicalId, physicalId, resourceType, properties, context) {
|
|
23537
24396
|
this.logger.debug(`Scheduling deletion for KMS Key ${logicalId}: ${physicalId}`);
|
|
23538
24397
|
const pendingWindowInDays = properties?.["PendingWindowInDays"] ?? 7;
|
|
23539
24398
|
try {
|
|
@@ -23546,6 +24405,14 @@ var KMSProvider = class {
|
|
|
23546
24405
|
this.logger.debug(`Successfully scheduled deletion for KMS Key ${logicalId}`);
|
|
23547
24406
|
} catch (error) {
|
|
23548
24407
|
if (error instanceof NotFoundException5) {
|
|
24408
|
+
const clientRegion = await this.getClient().config.region();
|
|
24409
|
+
assertRegionMatch(
|
|
24410
|
+
clientRegion,
|
|
24411
|
+
context?.expectedRegion,
|
|
24412
|
+
resourceType,
|
|
24413
|
+
logicalId,
|
|
24414
|
+
physicalId
|
|
24415
|
+
);
|
|
23549
24416
|
this.logger.debug(`KMS Key ${physicalId} does not exist, skipping deletion`);
|
|
23550
24417
|
return;
|
|
23551
24418
|
}
|
|
@@ -23632,7 +24499,7 @@ var KMSProvider = class {
|
|
|
23632
24499
|
);
|
|
23633
24500
|
}
|
|
23634
24501
|
}
|
|
23635
|
-
async deleteAlias(logicalId, physicalId, resourceType) {
|
|
24502
|
+
async deleteAlias(logicalId, physicalId, resourceType, context) {
|
|
23636
24503
|
this.logger.debug(`Deleting KMS Alias ${logicalId}: ${physicalId}`);
|
|
23637
24504
|
try {
|
|
23638
24505
|
await this.getClient().send(
|
|
@@ -23643,6 +24510,14 @@ var KMSProvider = class {
|
|
|
23643
24510
|
this.logger.debug(`Successfully deleted KMS Alias ${logicalId}`);
|
|
23644
24511
|
} catch (error) {
|
|
23645
24512
|
if (error instanceof NotFoundException5) {
|
|
24513
|
+
const clientRegion = await this.getClient().config.region();
|
|
24514
|
+
assertRegionMatch(
|
|
24515
|
+
clientRegion,
|
|
24516
|
+
context?.expectedRegion,
|
|
24517
|
+
resourceType,
|
|
24518
|
+
logicalId,
|
|
24519
|
+
physicalId
|
|
24520
|
+
);
|
|
23646
24521
|
this.logger.debug(`KMS Alias ${physicalId} does not exist, skipping deletion`);
|
|
23647
24522
|
return;
|
|
23648
24523
|
}
|
|
@@ -23889,7 +24764,7 @@ var KinesisStreamProvider = class {
|
|
|
23889
24764
|
/**
|
|
23890
24765
|
* Delete a Kinesis stream
|
|
23891
24766
|
*/
|
|
23892
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
24767
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
23893
24768
|
this.logger.debug(`Deleting Kinesis stream ${logicalId}: ${physicalId}`);
|
|
23894
24769
|
try {
|
|
23895
24770
|
await this.getClient().send(
|
|
@@ -23901,6 +24776,14 @@ var KinesisStreamProvider = class {
|
|
|
23901
24776
|
this.logger.debug(`Successfully deleted Kinesis stream ${logicalId}`);
|
|
23902
24777
|
} catch (error) {
|
|
23903
24778
|
if (error instanceof ResourceNotFoundException13) {
|
|
24779
|
+
const clientRegion = await this.getClient().config.region();
|
|
24780
|
+
assertRegionMatch(
|
|
24781
|
+
clientRegion,
|
|
24782
|
+
context?.expectedRegion,
|
|
24783
|
+
resourceType,
|
|
24784
|
+
logicalId,
|
|
24785
|
+
physicalId
|
|
24786
|
+
);
|
|
23904
24787
|
this.logger.debug(`Kinesis stream ${physicalId} does not exist, skipping deletion`);
|
|
23905
24788
|
return;
|
|
23906
24789
|
}
|
|
@@ -24017,14 +24900,14 @@ var EFSProvider = class {
|
|
|
24017
24900
|
}
|
|
24018
24901
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
24019
24902
|
}
|
|
24020
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
24903
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
24021
24904
|
switch (resourceType) {
|
|
24022
24905
|
case "AWS::EFS::FileSystem":
|
|
24023
|
-
return this.deleteFileSystem(logicalId, physicalId, resourceType);
|
|
24906
|
+
return this.deleteFileSystem(logicalId, physicalId, resourceType, context);
|
|
24024
24907
|
case "AWS::EFS::MountTarget":
|
|
24025
|
-
return this.deleteMountTarget(logicalId, physicalId, resourceType);
|
|
24908
|
+
return this.deleteMountTarget(logicalId, physicalId, resourceType, context);
|
|
24026
24909
|
case "AWS::EFS::AccessPoint":
|
|
24027
|
-
return this.deleteAccessPoint(logicalId, physicalId, resourceType);
|
|
24910
|
+
return this.deleteAccessPoint(logicalId, physicalId, resourceType, context);
|
|
24028
24911
|
default:
|
|
24029
24912
|
throw new ProvisioningError(
|
|
24030
24913
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -24073,7 +24956,7 @@ var EFSProvider = class {
|
|
|
24073
24956
|
);
|
|
24074
24957
|
}
|
|
24075
24958
|
}
|
|
24076
|
-
async deleteFileSystem(logicalId, physicalId, resourceType) {
|
|
24959
|
+
async deleteFileSystem(logicalId, physicalId, resourceType, context) {
|
|
24077
24960
|
this.logger.debug(`Deleting EFS FileSystem ${logicalId}: ${physicalId}`);
|
|
24078
24961
|
try {
|
|
24079
24962
|
await this.getClient().send(
|
|
@@ -24084,6 +24967,14 @@ var EFSProvider = class {
|
|
|
24084
24967
|
this.logger.debug(`Successfully deleted EFS FileSystem ${logicalId}`);
|
|
24085
24968
|
} catch (error) {
|
|
24086
24969
|
if (error instanceof FileSystemNotFound) {
|
|
24970
|
+
const clientRegion = await this.getClient().config.region();
|
|
24971
|
+
assertRegionMatch(
|
|
24972
|
+
clientRegion,
|
|
24973
|
+
context?.expectedRegion,
|
|
24974
|
+
resourceType,
|
|
24975
|
+
logicalId,
|
|
24976
|
+
physicalId
|
|
24977
|
+
);
|
|
24087
24978
|
this.logger.debug(`EFS FileSystem ${physicalId} does not exist, skipping deletion`);
|
|
24088
24979
|
return;
|
|
24089
24980
|
}
|
|
@@ -24199,7 +25090,7 @@ var EFSProvider = class {
|
|
|
24199
25090
|
mountTargetId
|
|
24200
25091
|
);
|
|
24201
25092
|
}
|
|
24202
|
-
async deleteMountTarget(logicalId, physicalId, resourceType) {
|
|
25093
|
+
async deleteMountTarget(logicalId, physicalId, resourceType, context) {
|
|
24203
25094
|
this.logger.debug(`Deleting EFS MountTarget ${logicalId}: ${physicalId}`);
|
|
24204
25095
|
try {
|
|
24205
25096
|
await this.getClient().send(
|
|
@@ -24211,6 +25102,14 @@ var EFSProvider = class {
|
|
|
24211
25102
|
this.logger.debug(`Successfully deleted EFS MountTarget ${logicalId}`);
|
|
24212
25103
|
} catch (error) {
|
|
24213
25104
|
if (error instanceof MountTargetNotFound) {
|
|
25105
|
+
const clientRegion = await this.getClient().config.region();
|
|
25106
|
+
assertRegionMatch(
|
|
25107
|
+
clientRegion,
|
|
25108
|
+
context?.expectedRegion,
|
|
25109
|
+
resourceType,
|
|
25110
|
+
logicalId,
|
|
25111
|
+
physicalId
|
|
25112
|
+
);
|
|
24214
25113
|
this.logger.debug(`EFS MountTarget ${physicalId} does not exist, skipping deletion`);
|
|
24215
25114
|
return;
|
|
24216
25115
|
}
|
|
@@ -24309,7 +25208,7 @@ var EFSProvider = class {
|
|
|
24309
25208
|
);
|
|
24310
25209
|
}
|
|
24311
25210
|
}
|
|
24312
|
-
async deleteAccessPoint(logicalId, physicalId, resourceType) {
|
|
25211
|
+
async deleteAccessPoint(logicalId, physicalId, resourceType, context) {
|
|
24313
25212
|
this.logger.debug(`Deleting EFS AccessPoint ${logicalId}: ${physicalId}`);
|
|
24314
25213
|
try {
|
|
24315
25214
|
await this.getClient().send(
|
|
@@ -24320,6 +25219,14 @@ var EFSProvider = class {
|
|
|
24320
25219
|
this.logger.debug(`Successfully deleted EFS AccessPoint ${logicalId}`);
|
|
24321
25220
|
} catch (error) {
|
|
24322
25221
|
if (error instanceof AccessPointNotFound) {
|
|
25222
|
+
const clientRegion = await this.getClient().config.region();
|
|
25223
|
+
assertRegionMatch(
|
|
25224
|
+
clientRegion,
|
|
25225
|
+
context?.expectedRegion,
|
|
25226
|
+
resourceType,
|
|
25227
|
+
logicalId,
|
|
25228
|
+
physicalId
|
|
25229
|
+
);
|
|
24323
25230
|
this.logger.debug(`EFS AccessPoint ${physicalId} does not exist, skipping deletion`);
|
|
24324
25231
|
return;
|
|
24325
25232
|
}
|
|
@@ -24557,7 +25464,7 @@ var FirehoseProvider = class {
|
|
|
24557
25464
|
/**
|
|
24558
25465
|
* Delete a Firehose delivery stream
|
|
24559
25466
|
*/
|
|
24560
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
25467
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
24561
25468
|
this.logger.debug(`Deleting Firehose delivery stream ${logicalId}: ${physicalId}`);
|
|
24562
25469
|
try {
|
|
24563
25470
|
await this.getClient().send(
|
|
@@ -24568,6 +25475,14 @@ var FirehoseProvider = class {
|
|
|
24568
25475
|
this.logger.debug(`Successfully deleted Firehose delivery stream ${logicalId}`);
|
|
24569
25476
|
} catch (error) {
|
|
24570
25477
|
if (error instanceof ResourceNotFoundException14) {
|
|
25478
|
+
const clientRegion = await this.getClient().config.region();
|
|
25479
|
+
assertRegionMatch(
|
|
25480
|
+
clientRegion,
|
|
25481
|
+
context?.expectedRegion,
|
|
25482
|
+
resourceType,
|
|
25483
|
+
logicalId,
|
|
25484
|
+
physicalId
|
|
25485
|
+
);
|
|
24571
25486
|
this.logger.debug(
|
|
24572
25487
|
`Firehose delivery stream ${physicalId} does not exist, skipping deletion`
|
|
24573
25488
|
);
|
|
@@ -24899,7 +25814,7 @@ var CloudTrailProvider = class {
|
|
|
24899
25814
|
);
|
|
24900
25815
|
}
|
|
24901
25816
|
}
|
|
24902
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
25817
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
24903
25818
|
this.logger.debug(`Deleting CloudTrail Trail ${logicalId}: ${physicalId}`);
|
|
24904
25819
|
try {
|
|
24905
25820
|
try {
|
|
@@ -24910,6 +25825,14 @@ var CloudTrailProvider = class {
|
|
|
24910
25825
|
this.logger.debug(`Successfully deleted CloudTrail Trail ${logicalId}`);
|
|
24911
25826
|
} catch (error) {
|
|
24912
25827
|
if (error instanceof TrailNotFoundException) {
|
|
25828
|
+
const clientRegion = await this.getClient().config.region();
|
|
25829
|
+
assertRegionMatch(
|
|
25830
|
+
clientRegion,
|
|
25831
|
+
context?.expectedRegion,
|
|
25832
|
+
resourceType,
|
|
25833
|
+
logicalId,
|
|
25834
|
+
physicalId
|
|
25835
|
+
);
|
|
24913
25836
|
this.logger.debug(`CloudTrail Trail ${physicalId} does not exist, skipping deletion`);
|
|
24914
25837
|
return;
|
|
24915
25838
|
}
|
|
@@ -25017,7 +25940,7 @@ var CodeBuildProvider = class {
|
|
|
25017
25940
|
const tags = properties["Tags"];
|
|
25018
25941
|
const envVars = environment?.["EnvironmentVariables"];
|
|
25019
25942
|
const cfnCache = properties["Cache"];
|
|
25020
|
-
const
|
|
25943
|
+
const cache2 = cfnCache ? {
|
|
25021
25944
|
type: cfnCache["Type"],
|
|
25022
25945
|
location: cfnCache["Location"],
|
|
25023
25946
|
modes: cfnCache["Modes"]
|
|
@@ -25104,7 +26027,7 @@ var CodeBuildProvider = class {
|
|
|
25104
26027
|
timeoutInMinutes: properties["TimeoutInMinutes"],
|
|
25105
26028
|
queuedTimeoutInMinutes: properties["QueuedTimeoutInMinutes"],
|
|
25106
26029
|
encryptionKey: properties["EncryptionKey"],
|
|
25107
|
-
cache,
|
|
26030
|
+
cache: cache2,
|
|
25108
26031
|
vpcConfig,
|
|
25109
26032
|
logsConfig,
|
|
25110
26033
|
concurrentBuildLimit: properties["ConcurrentBuildLimit"],
|
|
@@ -25161,13 +26084,21 @@ var CodeBuildProvider = class {
|
|
|
25161
26084
|
);
|
|
25162
26085
|
}
|
|
25163
26086
|
}
|
|
25164
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
26087
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
25165
26088
|
this.logger.debug(`Deleting CodeBuild Project ${logicalId}: ${physicalId}`);
|
|
25166
26089
|
try {
|
|
25167
26090
|
await this.getClient().send(new DeleteProjectCommand({ name: physicalId }));
|
|
25168
26091
|
this.logger.debug(`Successfully deleted CodeBuild Project ${logicalId}`);
|
|
25169
26092
|
} catch (error) {
|
|
25170
26093
|
if (error instanceof ResourceNotFoundException15) {
|
|
26094
|
+
const clientRegion = await this.getClient().config.region();
|
|
26095
|
+
assertRegionMatch(
|
|
26096
|
+
clientRegion,
|
|
26097
|
+
context?.expectedRegion,
|
|
26098
|
+
resourceType,
|
|
26099
|
+
logicalId,
|
|
26100
|
+
physicalId
|
|
26101
|
+
);
|
|
25171
26102
|
this.logger.debug(`CodeBuild Project ${physicalId} does not exist, skipping deletion`);
|
|
25172
26103
|
return;
|
|
25173
26104
|
}
|
|
@@ -25233,10 +26164,10 @@ var S3VectorsProvider = class {
|
|
|
25233
26164
|
);
|
|
25234
26165
|
}
|
|
25235
26166
|
}
|
|
25236
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
26167
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
25237
26168
|
switch (resourceType) {
|
|
25238
26169
|
case "AWS::S3Vectors::VectorBucket":
|
|
25239
|
-
return this.deleteVectorBucket(logicalId, physicalId, resourceType);
|
|
26170
|
+
return this.deleteVectorBucket(logicalId, physicalId, resourceType, context);
|
|
25240
26171
|
default:
|
|
25241
26172
|
throw new ProvisioningError(
|
|
25242
26173
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -25287,7 +26218,7 @@ var S3VectorsProvider = class {
|
|
|
25287
26218
|
);
|
|
25288
26219
|
}
|
|
25289
26220
|
}
|
|
25290
|
-
async deleteVectorBucket(logicalId, physicalId, resourceType) {
|
|
26221
|
+
async deleteVectorBucket(logicalId, physicalId, resourceType, context) {
|
|
25291
26222
|
this.logger.debug(`Deleting S3 VectorBucket ${logicalId}: ${physicalId}`);
|
|
25292
26223
|
try {
|
|
25293
26224
|
await this.emptyVectorBucket(logicalId, physicalId);
|
|
@@ -25299,6 +26230,14 @@ var S3VectorsProvider = class {
|
|
|
25299
26230
|
this.logger.debug(`Successfully deleted S3 VectorBucket ${logicalId}`);
|
|
25300
26231
|
} catch (error) {
|
|
25301
26232
|
if (this.isNotFoundError(error)) {
|
|
26233
|
+
const clientRegion = await this.getClient().config.region();
|
|
26234
|
+
assertRegionMatch(
|
|
26235
|
+
clientRegion,
|
|
26236
|
+
context?.expectedRegion,
|
|
26237
|
+
resourceType,
|
|
26238
|
+
logicalId,
|
|
26239
|
+
physicalId
|
|
26240
|
+
);
|
|
25302
26241
|
this.logger.debug(`S3 VectorBucket ${physicalId} does not exist, skipping deletion`);
|
|
25303
26242
|
return;
|
|
25304
26243
|
}
|
|
@@ -25495,7 +26434,7 @@ var S3DirectoryBucketProvider = class {
|
|
|
25495
26434
|
* Must empty the bucket before deletion. Directory buckets do not support
|
|
25496
26435
|
* versioning, so only current objects need to be deleted.
|
|
25497
26436
|
*/
|
|
25498
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
26437
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
25499
26438
|
this.logger.debug(`Deleting S3 Express Directory Bucket ${logicalId}: ${physicalId}`);
|
|
25500
26439
|
try {
|
|
25501
26440
|
await this.emptyBucket(physicalId);
|
|
@@ -25507,6 +26446,14 @@ var S3DirectoryBucketProvider = class {
|
|
|
25507
26446
|
this.logger.debug(`Successfully deleted S3 Express Directory Bucket ${logicalId}`);
|
|
25508
26447
|
} catch (error) {
|
|
25509
26448
|
if (error instanceof Error && (error.name === "NoSuchBucket" || error.name === "BucketNotFound")) {
|
|
26449
|
+
const clientRegion = await this.s3Client.config.region();
|
|
26450
|
+
assertRegionMatch(
|
|
26451
|
+
clientRegion,
|
|
26452
|
+
context?.expectedRegion,
|
|
26453
|
+
resourceType,
|
|
26454
|
+
logicalId,
|
|
26455
|
+
physicalId
|
|
26456
|
+
);
|
|
25510
26457
|
this.logger.debug(`Bucket ${physicalId} does not exist, skipping deletion`);
|
|
25511
26458
|
return;
|
|
25512
26459
|
}
|
|
@@ -25601,14 +26548,14 @@ var S3TablesProvider = class {
|
|
|
25601
26548
|
this.logger.debug(`Update is no-op for ${resourceType} ${logicalId}`);
|
|
25602
26549
|
return Promise.resolve({ physicalId, wasReplaced: false });
|
|
25603
26550
|
}
|
|
25604
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
26551
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
25605
26552
|
switch (resourceType) {
|
|
25606
26553
|
case "AWS::S3Tables::TableBucket":
|
|
25607
|
-
return this.deleteTableBucket(logicalId, physicalId, resourceType);
|
|
26554
|
+
return this.deleteTableBucket(logicalId, physicalId, resourceType, context);
|
|
25608
26555
|
case "AWS::S3Tables::Namespace":
|
|
25609
|
-
return this.deleteNamespace(logicalId, physicalId, resourceType);
|
|
26556
|
+
return this.deleteNamespace(logicalId, physicalId, resourceType, context);
|
|
25610
26557
|
case "AWS::S3Tables::Table":
|
|
25611
|
-
return this.deleteTable(logicalId, physicalId, resourceType);
|
|
26558
|
+
return this.deleteTable(logicalId, physicalId, resourceType, context);
|
|
25612
26559
|
default:
|
|
25613
26560
|
throw new ProvisioningError(
|
|
25614
26561
|
`Unsupported resource type: ${resourceType}`,
|
|
@@ -25654,7 +26601,7 @@ var S3TablesProvider = class {
|
|
|
25654
26601
|
);
|
|
25655
26602
|
}
|
|
25656
26603
|
}
|
|
25657
|
-
async deleteTableBucket(logicalId, physicalId, resourceType) {
|
|
26604
|
+
async deleteTableBucket(logicalId, physicalId, resourceType, context) {
|
|
25658
26605
|
this.logger.debug(`Deleting S3 Table Bucket ${logicalId}: ${physicalId}`);
|
|
25659
26606
|
try {
|
|
25660
26607
|
await this.emptyTableBucket(physicalId);
|
|
@@ -25666,6 +26613,14 @@ var S3TablesProvider = class {
|
|
|
25666
26613
|
this.logger.debug(`Successfully deleted S3 Table Bucket ${logicalId}`);
|
|
25667
26614
|
} catch (error) {
|
|
25668
26615
|
if (error instanceof NotFoundException6) {
|
|
26616
|
+
const clientRegion = await this.getClient().config.region();
|
|
26617
|
+
assertRegionMatch(
|
|
26618
|
+
clientRegion,
|
|
26619
|
+
context?.expectedRegion,
|
|
26620
|
+
resourceType,
|
|
26621
|
+
logicalId,
|
|
26622
|
+
physicalId
|
|
26623
|
+
);
|
|
25669
26624
|
this.logger.debug(`S3 Table Bucket ${physicalId} does not exist, skipping deletion`);
|
|
25670
26625
|
return;
|
|
25671
26626
|
}
|
|
@@ -25789,7 +26744,7 @@ var S3TablesProvider = class {
|
|
|
25789
26744
|
);
|
|
25790
26745
|
}
|
|
25791
26746
|
}
|
|
25792
|
-
async deleteNamespace(logicalId, physicalId, resourceType) {
|
|
26747
|
+
async deleteNamespace(logicalId, physicalId, resourceType, context) {
|
|
25793
26748
|
this.logger.debug(`Deleting S3 Tables Namespace ${logicalId}: ${physicalId}`);
|
|
25794
26749
|
const [tableBucketARN, namespaceName] = physicalId.split("|");
|
|
25795
26750
|
if (!tableBucketARN || !namespaceName) {
|
|
@@ -25810,6 +26765,14 @@ var S3TablesProvider = class {
|
|
|
25810
26765
|
this.logger.debug(`Successfully deleted S3 Tables Namespace ${logicalId}`);
|
|
25811
26766
|
} catch (error) {
|
|
25812
26767
|
if (error instanceof NotFoundException6) {
|
|
26768
|
+
const clientRegion = await this.getClient().config.region();
|
|
26769
|
+
assertRegionMatch(
|
|
26770
|
+
clientRegion,
|
|
26771
|
+
context?.expectedRegion,
|
|
26772
|
+
resourceType,
|
|
26773
|
+
logicalId,
|
|
26774
|
+
physicalId
|
|
26775
|
+
);
|
|
25813
26776
|
this.logger.debug(`S3 Tables Namespace ${physicalId} does not exist, skipping deletion`);
|
|
25814
26777
|
return;
|
|
25815
26778
|
}
|
|
@@ -25884,7 +26847,7 @@ var S3TablesProvider = class {
|
|
|
25884
26847
|
);
|
|
25885
26848
|
}
|
|
25886
26849
|
}
|
|
25887
|
-
async deleteTable(logicalId, physicalId, resourceType) {
|
|
26850
|
+
async deleteTable(logicalId, physicalId, resourceType, context) {
|
|
25888
26851
|
this.logger.debug(`Deleting S3 Tables Table ${logicalId}: ${physicalId}`);
|
|
25889
26852
|
const parts = physicalId.split("|");
|
|
25890
26853
|
if (parts.length < 3) {
|
|
@@ -25909,6 +26872,14 @@ var S3TablesProvider = class {
|
|
|
25909
26872
|
this.logger.debug(`Successfully deleted S3 Tables Table ${logicalId}`);
|
|
25910
26873
|
} catch (error) {
|
|
25911
26874
|
if (error instanceof NotFoundException6) {
|
|
26875
|
+
const clientRegion = await this.getClient().config.region();
|
|
26876
|
+
assertRegionMatch(
|
|
26877
|
+
clientRegion,
|
|
26878
|
+
context?.expectedRegion,
|
|
26879
|
+
resourceType,
|
|
26880
|
+
logicalId,
|
|
26881
|
+
physicalId
|
|
26882
|
+
);
|
|
25912
26883
|
this.logger.debug(`S3 Tables Table ${physicalId} does not exist, skipping deletion`);
|
|
25913
26884
|
return;
|
|
25914
26885
|
}
|
|
@@ -26135,7 +27106,7 @@ var ECRProvider = class {
|
|
|
26135
27106
|
* Uses `force: true` to delete the repository even if it contains images.
|
|
26136
27107
|
* This supports CDK's `emptyOnDelete: true` / `removalPolicy: DESTROY` pattern.
|
|
26137
27108
|
*/
|
|
26138
|
-
async delete(logicalId, physicalId, resourceType, _properties) {
|
|
27109
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
26139
27110
|
this.logger.debug(`Deleting ECR Repository ${logicalId}: ${physicalId}`);
|
|
26140
27111
|
try {
|
|
26141
27112
|
await this.getClient().send(
|
|
@@ -26147,6 +27118,14 @@ var ECRProvider = class {
|
|
|
26147
27118
|
this.logger.debug(`Successfully deleted ECR Repository ${logicalId}`);
|
|
26148
27119
|
} catch (error) {
|
|
26149
27120
|
if (error instanceof RepositoryNotFoundException) {
|
|
27121
|
+
const clientRegion = await this.getClient().config.region();
|
|
27122
|
+
assertRegionMatch(
|
|
27123
|
+
clientRegion,
|
|
27124
|
+
context?.expectedRegion,
|
|
27125
|
+
resourceType,
|
|
27126
|
+
logicalId,
|
|
27127
|
+
physicalId
|
|
27128
|
+
);
|
|
26150
27129
|
this.logger.debug(`ECR Repository ${physicalId} does not exist, skipping deletion`);
|
|
26151
27130
|
return;
|
|
26152
27131
|
}
|
|
@@ -27051,7 +28030,9 @@ var DeployEngine = class {
|
|
|
27051
28030
|
` Rollback: Deleting created resource ${op.logicalId} (${op.resourceType})`
|
|
27052
28031
|
);
|
|
27053
28032
|
const provider = this.providerRegistry.getProvider(op.resourceType);
|
|
27054
|
-
await provider.delete(op.logicalId, op.physicalId, op.resourceType, op.properties
|
|
28033
|
+
await provider.delete(op.logicalId, op.physicalId, op.resourceType, op.properties, {
|
|
28034
|
+
expectedRegion: this.stackRegion
|
|
28035
|
+
});
|
|
27055
28036
|
delete stateResources[op.logicalId];
|
|
27056
28037
|
this.logger.info(` Rollback: ${op.logicalId} deleted successfully`);
|
|
27057
28038
|
break;
|
|
@@ -27193,7 +28174,8 @@ var DeployEngine = class {
|
|
|
27193
28174
|
logicalId,
|
|
27194
28175
|
currentResource.physicalId,
|
|
27195
28176
|
resourceType,
|
|
27196
|
-
currentResource.properties
|
|
28177
|
+
currentResource.properties,
|
|
28178
|
+
{ expectedRegion: this.stackRegion }
|
|
27197
28179
|
);
|
|
27198
28180
|
this.logger.info(` \u2713 Old resource deleted`);
|
|
27199
28181
|
} catch (deleteError) {
|
|
@@ -27242,7 +28224,8 @@ var DeployEngine = class {
|
|
|
27242
28224
|
logicalId,
|
|
27243
28225
|
currentResource.physicalId,
|
|
27244
28226
|
resourceType,
|
|
27245
|
-
currentProps
|
|
28227
|
+
currentProps,
|
|
28228
|
+
{ expectedRegion: this.stackRegion }
|
|
27246
28229
|
);
|
|
27247
28230
|
} catch (deleteError) {
|
|
27248
28231
|
const deleteMsg = deleteError instanceof Error ? deleteError.message : String(deleteError);
|
|
@@ -27313,7 +28296,8 @@ var DeployEngine = class {
|
|
|
27313
28296
|
logicalId,
|
|
27314
28297
|
currentResource.physicalId,
|
|
27315
28298
|
resourceType,
|
|
27316
|
-
currentResource.properties
|
|
28299
|
+
currentResource.properties,
|
|
28300
|
+
{ expectedRegion: this.stackRegion }
|
|
27317
28301
|
),
|
|
27318
28302
|
logicalId,
|
|
27319
28303
|
3,
|
|
@@ -27587,10 +28571,17 @@ async function deployCommand(stacks, options) {
|
|
|
27587
28571
|
...options.profile && { profile: options.profile }
|
|
27588
28572
|
});
|
|
27589
28573
|
setAwsClients(awsClients);
|
|
27590
|
-
const preflightStateBackend = new S3StateBackend(
|
|
27591
|
-
|
|
27592
|
-
|
|
27593
|
-
|
|
28574
|
+
const preflightStateBackend = new S3StateBackend(
|
|
28575
|
+
awsClients.s3,
|
|
28576
|
+
{
|
|
28577
|
+
bucket: stateBucket,
|
|
28578
|
+
prefix: options.statePrefix
|
|
28579
|
+
},
|
|
28580
|
+
{
|
|
28581
|
+
region,
|
|
28582
|
+
...options.profile && { profile: options.profile }
|
|
28583
|
+
}
|
|
28584
|
+
);
|
|
27594
28585
|
await preflightStateBackend.verifyBucketExists();
|
|
27595
28586
|
let deployInterrupted = false;
|
|
27596
28587
|
const topLevelSigintHandler = () => {
|
|
@@ -27741,7 +28732,10 @@ Deploying stack: ${stackInfo.stackName}${stackRegion !== baseRegion ? ` (region:
|
|
|
27741
28732
|
region: baseRegion,
|
|
27742
28733
|
...options.profile && { profile: options.profile }
|
|
27743
28734
|
});
|
|
27744
|
-
const stackStateBackend = new S3StateBackend(stateS3Client.s3, stateConfig
|
|
28735
|
+
const stackStateBackend = new S3StateBackend(stateS3Client.s3, stateConfig, {
|
|
28736
|
+
region: baseRegion,
|
|
28737
|
+
...options.profile && { profile: options.profile }
|
|
28738
|
+
});
|
|
27745
28739
|
const stackLockManager = new LockManager(stateS3Client.s3, stateConfig);
|
|
27746
28740
|
const stackProviderRegistry = new ProviderRegistry();
|
|
27747
28741
|
registerAllProviders(stackProviderRegistry);
|
|
@@ -27922,7 +28916,10 @@ async function diffCommand(stacks, options) {
|
|
|
27922
28916
|
bucket: stateBucket,
|
|
27923
28917
|
prefix: options.statePrefix
|
|
27924
28918
|
};
|
|
27925
|
-
const stateBackend = new S3StateBackend(awsClients.s3, stateConfig
|
|
28919
|
+
const stateBackend = new S3StateBackend(awsClients.s3, stateConfig, {
|
|
28920
|
+
region,
|
|
28921
|
+
...options.profile && { profile: options.profile }
|
|
28922
|
+
});
|
|
27926
28923
|
const diffCalculator = new DiffCalculator();
|
|
27927
28924
|
const intrinsicResolver = new IntrinsicFunctionResolver(region);
|
|
27928
28925
|
for (const stackInfo of targetStacks) {
|
|
@@ -28042,7 +29039,10 @@ async function destroyCommand(stackArgs, options) {
|
|
|
28042
29039
|
bucket: stateBucket,
|
|
28043
29040
|
prefix: options.statePrefix
|
|
28044
29041
|
};
|
|
28045
|
-
const stateBackend = new S3StateBackend(awsClients.s3, stateConfig
|
|
29042
|
+
const stateBackend = new S3StateBackend(awsClients.s3, stateConfig, {
|
|
29043
|
+
...options.region && { region: options.region },
|
|
29044
|
+
...options.profile && { profile: options.profile }
|
|
29045
|
+
});
|
|
28046
29046
|
await stateBackend.verifyBucketExists();
|
|
28047
29047
|
const lockManager = new LockManager(awsClients.s3, stateConfig);
|
|
28048
29048
|
const dagBuilder = new DagBuilder();
|
|
@@ -28268,7 +29268,8 @@ Acquiring lock for stack ${stackName}...`);
|
|
|
28268
29268
|
logicalId,
|
|
28269
29269
|
resource.physicalId,
|
|
28270
29270
|
resource.resourceType,
|
|
28271
|
-
resource.properties
|
|
29271
|
+
resource.properties,
|
|
29272
|
+
{ expectedRegion: currentState.region }
|
|
28272
29273
|
);
|
|
28273
29274
|
lastDeleteError = null;
|
|
28274
29275
|
break;
|
|
@@ -28490,7 +29491,10 @@ async function setupStateBackend(options) {
|
|
|
28490
29491
|
const bucket = await resolveStateBucketWithDefault(options.stateBucket, region);
|
|
28491
29492
|
const prefix = options.statePrefix;
|
|
28492
29493
|
const stateConfig = { bucket, prefix };
|
|
28493
|
-
const stateBackend = new S3StateBackend(awsClients.s3, stateConfig
|
|
29494
|
+
const stateBackend = new S3StateBackend(awsClients.s3, stateConfig, {
|
|
29495
|
+
region,
|
|
29496
|
+
...options.profile && { profile: options.profile }
|
|
29497
|
+
});
|
|
28494
29498
|
const lockManager = new LockManager(awsClients.s3, stateConfig);
|
|
28495
29499
|
await stateBackend.verifyBucketExists();
|
|
28496
29500
|
return {
|
|
@@ -28894,7 +29898,7 @@ function reorderArgs(argv) {
|
|
|
28894
29898
|
}
|
|
28895
29899
|
async function main() {
|
|
28896
29900
|
const program = new Command10();
|
|
28897
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
29901
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.10.0");
|
|
28898
29902
|
program.addCommand(createBootstrapCommand());
|
|
28899
29903
|
program.addCommand(createSynthCommand());
|
|
28900
29904
|
program.addCommand(createListCommand());
|