@go-to-k/cdkd 0.257.0 → 0.257.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/{asg-provider-6IZKZOKp.js → asg-provider-4KjJhMTY.js} +2 -2
- package/dist/{asg-provider-6IZKZOKp.js.map → asg-provider-4KjJhMTY.js.map} +1 -1
- package/dist/cli.js +335 -131
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-DOPBIRKR.js → deploy-engine-wmvXbyoB.js} +71 -10
- package/dist/deploy-engine-wmvXbyoB.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-DOPBIRKR.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as AssetModeResolver, $t as StackTerminationProtectionError, A as importTagWalk, At as expectedOwnerParam, B as DagBuilder, C as slowCcOperationTimeoutMs, Ct as resolveUseCdkBootstrapAssets, D as cfnRefValueFromPhysicalId, Dt as MIGRATE_TMP_PREFIX, E as IntrinsicFunctionResolver, Et as CFN_TEMPLATE_URL_LIMIT, F as normalizeAwsTagsToCfn, Ft as getAwsClients, G as shouldRetainResource, H as LockManager, Ht as LocalInvokeBuildError$1, I as resolveExplicitPhysicalId, It as resetAwsClients, J as WorkGraph, Jt as PartialFailureError, K as AssetPublisher, Kt as MissingCdkCliError, L as assertRegionMatch, Lt as setAwsClients, M as isRetryableTransientError, N as CDK_PATH_TAG, Nt as resolveBucketRegion, O as refStateLookupFromResource, Ot as findLargeInlineResources, P as matchesCdkPath, Pt as AwsClients, Q as rewriteTemplateAssetReferences, Qt as StackHasActiveImportsError, R as applyRoleArnIfSet, S as CloudControlProvider, St as resolveStateBucketWithDefaultAndSource, T as isTerminationProtectionPropagationError, Tt as CFN_TEMPLATE_BODY_LIMIT, U as S3StateBackend, Ut as LocalMigrateError, V as TemplateParser, W as rebuildClientForBucketRegion, Wt as LocalStartServiceError, X as createAssetRedirectResolver, Xt as ResourceTimeoutError, Y as buildAssetRedirectMap, Yt as ProvisioningError, Z as loadPublishableAssetManifest, Zt as ResourceUpdateNotSupportedError, _ as yellow, _t as resolveApp, a as IMPLICIT_DELETE_DEPENDENCIES, an as withErrorHandling, at as validateContainerRepoName, b as ProviderRegistry, bt as resolveSkipPrefix, c as MULTI_REGION_RECREATE_BLOCKED_TYPES, ct as getDockerCmd, d as formatResourceLine, dt as AssetManifestLoader, et as BOOTSTRAP_MARKER_PREFIX, f as bold, ft as getDockerImageBySourceHash, g as red, gt as getLegacyStateBucketName, h as green, ht as getDefaultStateBucketName, i as withResourceDeadline, in as normalizeAwsError, it as validateAssetBucketName, j as withRetry, jt as AssemblyReader, k as WAFv2WebACLProvider, kt as uploadCfnTemplate, l as isStatefulRecreateTargetSync, lt as runDockerForeground, m as gray, mt as synthesisStatusMessage, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as getBootstrapMarkerKey, o as computeImplicitDeleteEdges, ot as buildDockerImage, p as cyan, pt as Synthesizer, q as stringifyValue, qt as NestedStackChildDirectDestroyError, r as DeployEngine, rt as parseBootstrapMarker, s as extractDeploymentEventError, st as formatDockerLoginError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as ensureAssetStorage, u as renderStatefulReason, ut as runDockerStreaming, v as IAMRoleProvider, vt as resolveAutoAssetStorage, w as disableInstanceApiTermination, wt as warnDeprecatedNoPrefixCliFlag, x as findActionableSilentDrops, xt as resolveStateBucketWithDefault, y as collectInlinePolicyNamesManagedBySiblings, yt as resolveCaptureObservedState, z as DiffCalculator, zt as CdkdError } from "./deploy-engine-wmvXbyoB.js";
|
|
3
3
|
import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BYMEE-BS.js";
|
|
4
|
-
import { t as ASGProvider } from "./asg-provider-
|
|
4
|
+
import { t as ASGProvider } from "./asg-provider-4KjJhMTY.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
7
7
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -1899,7 +1899,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
1899
1899
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
1900
1900
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
1901
1901
|
function getCdkdVersion() {
|
|
1902
|
-
return "0.257.
|
|
1902
|
+
return "0.257.2";
|
|
1903
1903
|
}
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -3945,9 +3945,11 @@ var IAMInstanceProfileProvider = class {
|
|
|
3945
3945
|
* Lookup order:
|
|
3946
3946
|
* 1. `--resource` override or `Properties.InstanceProfileName` → verify
|
|
3947
3947
|
* via `GetInstanceProfile`.
|
|
3948
|
-
* 2. `ListInstanceProfiles` paginator +
|
|
3949
|
-
* `
|
|
3950
|
-
*
|
|
3948
|
+
* 2. `ListInstanceProfiles` paginator + a per-candidate `GetInstanceProfile`
|
|
3949
|
+
* to read the tags, matched against `aws:cdk:path`. The list API does
|
|
3950
|
+
* NOT return tags (AWS documents this on the command) even though the
|
|
3951
|
+
* `InstanceProfile` type declares `Tags?`, so reading them off the
|
|
3952
|
+
* summary typechecks and never matches.
|
|
3951
3953
|
*
|
|
3952
3954
|
* IAM is global; this walks every instance profile in the account once.
|
|
3953
3955
|
*/
|
|
@@ -3963,20 +3965,32 @@ var IAMInstanceProfileProvider = class {
|
|
|
3963
3965
|
if (err instanceof NoSuchEntityException) return null;
|
|
3964
3966
|
throw err;
|
|
3965
3967
|
}
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
attributes: {}
|
|
3968
|
+
const match = await importTagWalk({
|
|
3969
|
+
cdkPath: input.cdkPath,
|
|
3970
|
+
logicalId: input.logicalId,
|
|
3971
|
+
listPage: async (marker) => {
|
|
3972
|
+
const list = await this.iamClient.send(new ListInstanceProfilesCommand({ ...marker && { Marker: marker } }));
|
|
3973
|
+
return {
|
|
3974
|
+
items: list.InstanceProfiles,
|
|
3975
|
+
nextMarker: list.IsTruncated ? list.Marker : void 0
|
|
3975
3976
|
};
|
|
3976
|
-
}
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3977
|
+
},
|
|
3978
|
+
describe: async (profile) => {
|
|
3979
|
+
if (!profile.InstanceProfileName) return void 0;
|
|
3980
|
+
try {
|
|
3981
|
+
return (await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: profile.InstanceProfileName }))).InstanceProfile;
|
|
3982
|
+
} catch (err) {
|
|
3983
|
+
if (err instanceof NoSuchEntityException) return void 0;
|
|
3984
|
+
throw err;
|
|
3985
|
+
}
|
|
3986
|
+
},
|
|
3987
|
+
tagsOf: (detail) => detail?.Tags
|
|
3988
|
+
});
|
|
3989
|
+
if (!match) return null;
|
|
3990
|
+
return {
|
|
3991
|
+
physicalId: match.summary.InstanceProfileName,
|
|
3992
|
+
attributes: {}
|
|
3993
|
+
};
|
|
3980
3994
|
}
|
|
3981
3995
|
};
|
|
3982
3996
|
|
|
@@ -10379,25 +10393,35 @@ var LambdaLayerVersionProvider = class {
|
|
|
10379
10393
|
if (err instanceof ResourceNotFoundException) return null;
|
|
10380
10394
|
throw err;
|
|
10381
10395
|
}
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10396
|
+
const match = await importTagWalk({
|
|
10397
|
+
cdkPath: input.cdkPath,
|
|
10398
|
+
logicalId: input.logicalId,
|
|
10399
|
+
listPage: async (marker) => {
|
|
10400
|
+
const list = await this.lambdaClient.send(new ListLayersCommand({ ...marker && { Marker: marker } }));
|
|
10401
|
+
return {
|
|
10402
|
+
items: list.Layers,
|
|
10403
|
+
nextMarker: list.NextMarker
|
|
10404
|
+
};
|
|
10405
|
+
},
|
|
10406
|
+
describe: async (layer) => {
|
|
10407
|
+
if (!layer.LayerArn || !layer.LatestMatchingVersion?.LayerVersionArn) return void 0;
|
|
10388
10408
|
try {
|
|
10389
|
-
|
|
10390
|
-
physicalId: layer.LatestMatchingVersion.LayerVersionArn,
|
|
10391
|
-
attributes: {}
|
|
10392
|
-
};
|
|
10409
|
+
return await this.lambdaClient.send(new ListTagsCommand({ Resource: layer.LayerArn }));
|
|
10393
10410
|
} catch (err) {
|
|
10394
|
-
if (err instanceof ResourceNotFoundException)
|
|
10411
|
+
if (err instanceof ResourceNotFoundException) return void 0;
|
|
10395
10412
|
throw err;
|
|
10396
10413
|
}
|
|
10397
|
-
}
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10414
|
+
},
|
|
10415
|
+
tagsOf: (tagsResp) => Object.entries(tagsResp.Tags ?? {}).map(([Key, Value]) => ({
|
|
10416
|
+
Key,
|
|
10417
|
+
Value
|
|
10418
|
+
}))
|
|
10419
|
+
});
|
|
10420
|
+
if (!match) return null;
|
|
10421
|
+
return {
|
|
10422
|
+
physicalId: match.summary.LatestMatchingVersion.LayerVersionArn,
|
|
10423
|
+
attributes: {}
|
|
10424
|
+
};
|
|
10401
10425
|
}
|
|
10402
10426
|
};
|
|
10403
10427
|
|
|
@@ -13940,17 +13964,24 @@ var SecretsManagerSecretProvider = class {
|
|
|
13940
13964
|
if (err instanceof ResourceNotFoundException$3) return null;
|
|
13941
13965
|
throw err;
|
|
13942
13966
|
}
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13967
|
+
const match = await importTagWalk({
|
|
13968
|
+
cdkPath: input.cdkPath,
|
|
13969
|
+
logicalId: input.logicalId,
|
|
13970
|
+
listPage: async (marker) => {
|
|
13971
|
+
const list = await this.smClient.send(new ListSecretsCommand({ ...marker && { NextToken: marker } }));
|
|
13972
|
+
return {
|
|
13973
|
+
items: list.SecretList,
|
|
13974
|
+
nextMarker: list.NextToken
|
|
13975
|
+
};
|
|
13976
|
+
},
|
|
13977
|
+
describe: async (secret) => secret.ARN ? secret : void 0,
|
|
13978
|
+
tagsOf: (secret) => secret.Tags
|
|
13979
|
+
});
|
|
13980
|
+
if (!match) return null;
|
|
13981
|
+
return {
|
|
13982
|
+
physicalId: match.summary.ARN,
|
|
13983
|
+
attributes: {}
|
|
13984
|
+
};
|
|
13954
13985
|
}
|
|
13955
13986
|
};
|
|
13956
13987
|
|
|
@@ -32552,25 +32583,35 @@ var KMSProvider = class {
|
|
|
32552
32583
|
throw err;
|
|
32553
32584
|
}
|
|
32554
32585
|
if (!input.cdkPath) return null;
|
|
32555
|
-
|
|
32556
|
-
|
|
32557
|
-
|
|
32558
|
-
|
|
32559
|
-
|
|
32586
|
+
const match = await importTagWalk({
|
|
32587
|
+
cdkPath: input.cdkPath,
|
|
32588
|
+
logicalId: input.logicalId,
|
|
32589
|
+
listPage: async (marker) => {
|
|
32590
|
+
const list = await this.getClient().send(new ListKeysCommand({ ...marker && { Marker: marker } }));
|
|
32591
|
+
return {
|
|
32592
|
+
items: list.Keys,
|
|
32593
|
+
nextMarker: list.NextMarker
|
|
32594
|
+
};
|
|
32595
|
+
},
|
|
32596
|
+
describe: async (key) => {
|
|
32597
|
+
if (!key.KeyId) return void 0;
|
|
32560
32598
|
try {
|
|
32561
|
-
|
|
32562
|
-
for (const tag of tagsResp.Tags ?? []) if (tag.TagKey === "aws:cdk:path" && tag.TagValue === input.cdkPath) return {
|
|
32563
|
-
physicalId: key.KeyId,
|
|
32564
|
-
attributes: {}
|
|
32565
|
-
};
|
|
32599
|
+
return await this.getClient().send(new ListResourceTagsCommand({ KeyId: key.KeyId }));
|
|
32566
32600
|
} catch (err) {
|
|
32567
|
-
if (err.name === "AccessDeniedException" || err instanceof NotFoundException$2)
|
|
32601
|
+
if (err.name === "AccessDeniedException" || err instanceof NotFoundException$2) return void 0;
|
|
32568
32602
|
throw err;
|
|
32569
32603
|
}
|
|
32570
|
-
}
|
|
32571
|
-
|
|
32572
|
-
|
|
32573
|
-
|
|
32604
|
+
},
|
|
32605
|
+
tagsOf: (tagsResp) => (tagsResp.Tags ?? []).map((t) => ({
|
|
32606
|
+
Key: t.TagKey,
|
|
32607
|
+
Value: t.TagValue
|
|
32608
|
+
}))
|
|
32609
|
+
});
|
|
32610
|
+
if (!match) return null;
|
|
32611
|
+
return {
|
|
32612
|
+
physicalId: match.summary.KeyId,
|
|
32613
|
+
attributes: {}
|
|
32614
|
+
};
|
|
32574
32615
|
}
|
|
32575
32616
|
};
|
|
32576
32617
|
|
|
@@ -39687,28 +39728,42 @@ var CodeCommitRepositoryProvider = class {
|
|
|
39687
39728
|
if (err instanceof RepositoryDoesNotExistException) return null;
|
|
39688
39729
|
throw err;
|
|
39689
39730
|
}
|
|
39690
|
-
|
|
39691
|
-
|
|
39692
|
-
|
|
39693
|
-
|
|
39694
|
-
|
|
39695
|
-
|
|
39731
|
+
const match = await importTagWalk({
|
|
39732
|
+
cdkPath: input.cdkPath,
|
|
39733
|
+
logicalId: input.logicalId,
|
|
39734
|
+
listPage: async (marker) => {
|
|
39735
|
+
const list = await this.getClient().send(new ListRepositoriesCommand({ ...marker && { nextToken: marker } }));
|
|
39736
|
+
return {
|
|
39737
|
+
items: list.repositories,
|
|
39738
|
+
nextMarker: list.nextToken
|
|
39739
|
+
};
|
|
39740
|
+
},
|
|
39741
|
+
describe: async (repo) => {
|
|
39742
|
+
if (!repo.repositoryName) return void 0;
|
|
39696
39743
|
let metadata;
|
|
39697
39744
|
try {
|
|
39698
39745
|
metadata = await this.getRepositoryMetadata(repo.repositoryName);
|
|
39699
39746
|
} catch (err) {
|
|
39700
|
-
if (err instanceof RepositoryDoesNotExistException)
|
|
39747
|
+
if (err instanceof RepositoryDoesNotExistException) return void 0;
|
|
39701
39748
|
throw err;
|
|
39702
39749
|
}
|
|
39703
|
-
if (!metadata?.Arn)
|
|
39704
|
-
|
|
39705
|
-
|
|
39706
|
-
|
|
39750
|
+
if (!metadata?.Arn) return void 0;
|
|
39751
|
+
const tagsResp = await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn: metadata.Arn }));
|
|
39752
|
+
return {
|
|
39753
|
+
metadata,
|
|
39754
|
+
tags: tagsResp.tags
|
|
39707
39755
|
};
|
|
39708
|
-
}
|
|
39709
|
-
|
|
39710
|
-
|
|
39711
|
-
|
|
39756
|
+
},
|
|
39757
|
+
tagsOf: (detail) => Object.entries(detail.tags ?? {}).map(([Key, Value]) => ({
|
|
39758
|
+
Key,
|
|
39759
|
+
Value
|
|
39760
|
+
}))
|
|
39761
|
+
});
|
|
39762
|
+
if (!match) return null;
|
|
39763
|
+
return {
|
|
39764
|
+
physicalId: match.summary.repositoryName,
|
|
39765
|
+
attributes: this.toAttributes(match.detail.metadata)
|
|
39766
|
+
};
|
|
39712
39767
|
}
|
|
39713
39768
|
/**
|
|
39714
39769
|
* Seed the repository's initial commit from the CFn `Code` property.
|
|
@@ -40038,16 +40093,23 @@ var DLMLifecyclePolicyProvider = class {
|
|
|
40038
40093
|
if (err instanceof ResourceNotFoundException$12) return null;
|
|
40039
40094
|
throw err;
|
|
40040
40095
|
}
|
|
40041
|
-
|
|
40042
|
-
|
|
40043
|
-
|
|
40044
|
-
|
|
40045
|
-
|
|
40046
|
-
|
|
40047
|
-
|
|
40048
|
-
}
|
|
40049
|
-
|
|
40050
|
-
|
|
40096
|
+
const match = await importTagWalk({
|
|
40097
|
+
cdkPath: input.cdkPath,
|
|
40098
|
+
logicalId: input.logicalId,
|
|
40099
|
+
listPage: async () => {
|
|
40100
|
+
return { items: (await this.getClient().send(new GetLifecyclePoliciesCommand({}))).Policies };
|
|
40101
|
+
},
|
|
40102
|
+
describe: async (policy) => policy.PolicyId ? policy : void 0,
|
|
40103
|
+
tagsOf: (policy) => Object.entries(policy.Tags ?? {}).map(([Key, Value]) => ({
|
|
40104
|
+
Key,
|
|
40105
|
+
Value
|
|
40106
|
+
}))
|
|
40107
|
+
});
|
|
40108
|
+
if (!match) return null;
|
|
40109
|
+
return {
|
|
40110
|
+
physicalId: match.summary.PolicyId,
|
|
40111
|
+
attributes: {}
|
|
40112
|
+
};
|
|
40051
40113
|
}
|
|
40052
40114
|
};
|
|
40053
40115
|
|
|
@@ -40285,25 +40347,35 @@ var S3VectorsProvider = class {
|
|
|
40285
40347
|
if (this.isNotFoundError(err)) return null;
|
|
40286
40348
|
throw err;
|
|
40287
40349
|
}
|
|
40288
|
-
|
|
40289
|
-
|
|
40290
|
-
|
|
40291
|
-
|
|
40292
|
-
|
|
40293
|
-
|
|
40350
|
+
const match = await importTagWalk({
|
|
40351
|
+
cdkPath: input.cdkPath,
|
|
40352
|
+
logicalId: input.logicalId,
|
|
40353
|
+
listPage: async (marker) => {
|
|
40354
|
+
const list = await this.getClient().send(new ListVectorBucketsCommand({ ...marker && { nextToken: marker } }));
|
|
40355
|
+
return {
|
|
40356
|
+
items: list.vectorBuckets,
|
|
40357
|
+
nextMarker: list.nextToken
|
|
40358
|
+
};
|
|
40359
|
+
},
|
|
40360
|
+
describe: async (bucket) => {
|
|
40361
|
+
if (!bucket.vectorBucketName || !bucket.vectorBucketArn) return void 0;
|
|
40294
40362
|
try {
|
|
40295
|
-
|
|
40296
|
-
physicalId: bucket.vectorBucketName,
|
|
40297
|
-
attributes: {}
|
|
40298
|
-
};
|
|
40363
|
+
return await this.getClient().send(new ListTagsForResourceCommand$20({ resourceArn: bucket.vectorBucketArn }));
|
|
40299
40364
|
} catch (err) {
|
|
40300
|
-
if (this.isNotFoundError(err))
|
|
40365
|
+
if (this.isNotFoundError(err)) return void 0;
|
|
40301
40366
|
throw err;
|
|
40302
40367
|
}
|
|
40303
|
-
}
|
|
40304
|
-
|
|
40305
|
-
|
|
40306
|
-
|
|
40368
|
+
},
|
|
40369
|
+
tagsOf: (tagsResp) => Object.entries(tagsResp.tags ?? {}).map(([Key, Value]) => ({
|
|
40370
|
+
Key,
|
|
40371
|
+
Value
|
|
40372
|
+
}))
|
|
40373
|
+
});
|
|
40374
|
+
if (!match) return null;
|
|
40375
|
+
return {
|
|
40376
|
+
physicalId: match.summary.vectorBucketName,
|
|
40377
|
+
attributes: {}
|
|
40378
|
+
};
|
|
40307
40379
|
}
|
|
40308
40380
|
isNotFoundError(error) {
|
|
40309
40381
|
if (error instanceof Error) {
|
|
@@ -41829,7 +41901,8 @@ async function runDestroyForStack(stackName, state, ctx) {
|
|
|
41829
41901
|
const providerMinTimeoutMs = provider.getMinResourceTimeoutMs?.() ?? 0;
|
|
41830
41902
|
const warnAfterMs = ctx.resourceWarnAfterByType?.[resource.resourceType] ?? ctx.resourceWarnAfterMs ?? 3e5;
|
|
41831
41903
|
const globalTimeoutMs = ctx.resourceTimeoutMs ?? 18e5;
|
|
41832
|
-
const
|
|
41904
|
+
const slowTypeMinTimeoutMs = slowCcOperationTimeoutMs(resource.resourceType, "DELETE");
|
|
41905
|
+
const timeoutMs = ctx.resourceTimeoutByType?.[resource.resourceType] ?? Math.max(providerMinTimeoutMs, slowTypeMinTimeoutMs, globalTimeoutMs);
|
|
41833
41906
|
await withResourceDeadline(async () => {
|
|
41834
41907
|
const maxAttempts = provider.disableOuterRetry ? 0 : 3;
|
|
41835
41908
|
let lastDeleteError;
|
|
@@ -44179,6 +44252,67 @@ async function confirmPrompt$6(prompt) {
|
|
|
44179
44252
|
rl.close();
|
|
44180
44253
|
}
|
|
44181
44254
|
}
|
|
44255
|
+
/**
|
|
44256
|
+
* Flat `logicalId -> physicalId` map for ONE CloudFormation stack, or `null`
|
|
44257
|
+
* when no stack of that name exists.
|
|
44258
|
+
*
|
|
44259
|
+
* This is the non-recursive, non-throwing sibling of
|
|
44260
|
+
* {@link getCloudFormationResourceTree}, used by `cdkd import`'s auto mode as
|
|
44261
|
+
* a best-effort lookup (issue #1128). The distinction matters:
|
|
44262
|
+
*
|
|
44263
|
+
* - the tree walk is for `--migrate-from-cloudformation`, where the stack is
|
|
44264
|
+
* known to exist and nested children must be walked so each child's state
|
|
44265
|
+
* can be written and the whole tree retired;
|
|
44266
|
+
* - this one runs speculatively on every auto-mode import, so a missing
|
|
44267
|
+
* stack is the NORMAL case (a cdkd-native stack has no CFn counterpart)
|
|
44268
|
+
* and must return `null` rather than abort the import.
|
|
44269
|
+
*
|
|
44270
|
+
* NO failure is fatal. The lookup is an OPTIMIZATION: when it cannot answer,
|
|
44271
|
+
* the caller falls through to the per-provider lookups, which is exactly the
|
|
44272
|
+
* behavior that shipped before this function existed. Throwing would convert a
|
|
44273
|
+
* missed improvement into a hard failure — and it would do so precisely for the
|
|
44274
|
+
* users least likely to benefit. A cdkd-native stack has no CloudFormation
|
|
44275
|
+
* counterpart, so an operator whose IAM policy is scoped to cdkd's actual needs
|
|
44276
|
+
* (no `cloudformation:DescribeStackResources`) would see `AccessDenied` abort an
|
|
44277
|
+
* import that worked fine the day before.
|
|
44278
|
+
*
|
|
44279
|
+
* A missing stack is the expected case and logs at debug. Anything else logs a
|
|
44280
|
+
* WARN naming the cause, so a permissions gap or a throttle is visible rather
|
|
44281
|
+
* than silent — the user learns why the ids were not resolved, and still gets
|
|
44282
|
+
* the pre-existing behavior instead of an abort.
|
|
44283
|
+
*/
|
|
44284
|
+
async function tryGetCloudFormationResourceMap(stackName, cfnClient) {
|
|
44285
|
+
const logger = getLogger();
|
|
44286
|
+
let resp;
|
|
44287
|
+
try {
|
|
44288
|
+
resp = await cfnClient.send(new DescribeStackResourcesCommand({ StackName: stackName }));
|
|
44289
|
+
} catch (err) {
|
|
44290
|
+
if (isStackNotFoundError(err)) {
|
|
44291
|
+
logger.debug(`No CloudFormation stack named '${stackName}'.`);
|
|
44292
|
+
return null;
|
|
44293
|
+
}
|
|
44294
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
44295
|
+
logger.warn(`Could not read CloudFormation stack '${stackName}' to resolve physical IDs (${reason}). Falling back to per-resource lookup; resources whose physical name CloudFormation generated may be reported as not found. Grant cloudformation:DescribeStackResources, or pass --resource <LogicalId>=<physicalId> for those resources.`);
|
|
44296
|
+
return null;
|
|
44297
|
+
}
|
|
44298
|
+
const resources = /* @__PURE__ */ new Map();
|
|
44299
|
+
for (const r of resp.StackResources ?? []) {
|
|
44300
|
+
if (!r.LogicalResourceId || !r.PhysicalResourceId) continue;
|
|
44301
|
+
resources.set(r.LogicalResourceId, r.PhysicalResourceId);
|
|
44302
|
+
}
|
|
44303
|
+
return resources;
|
|
44304
|
+
}
|
|
44305
|
+
/**
|
|
44306
|
+
* CloudFormation reports an unknown stack as a `ValidationError` whose message
|
|
44307
|
+
* carries "does not exist" — there is no dedicated exception type to catch.
|
|
44308
|
+
* Matching the message is therefore required, but it is kept narrow so an
|
|
44309
|
+
* unrelated ValidationError (a malformed stack name, say) still surfaces.
|
|
44310
|
+
*/
|
|
44311
|
+
function isStackNotFoundError(err) {
|
|
44312
|
+
const name = err?.name;
|
|
44313
|
+
const message = err?.message ?? "";
|
|
44314
|
+
return name === "ValidationError" && /does not exist/i.test(message);
|
|
44315
|
+
}
|
|
44182
44316
|
|
|
44183
44317
|
//#endregion
|
|
44184
44318
|
//#region src/cli/commands/diff-recursive.ts
|
|
@@ -51870,30 +52004,13 @@ async function importCommand(stackArg, options) {
|
|
|
51870
52004
|
if (migrationCfnStackName) {
|
|
51871
52005
|
logger.info(`Resolving physical IDs from CloudFormation stack '${migrationCfnStackName}' (recursive)...`);
|
|
51872
52006
|
migrationTree = await getCloudFormationResourceTree(migrationCfnStackName, awsClients.cloudFormation);
|
|
51873
|
-
const
|
|
51874
|
-
|
|
51875
|
-
|
|
51876
|
-
|
|
51877
|
-
|
|
51878
|
-
|
|
51879
|
-
|
|
51880
|
-
continue;
|
|
51881
|
-
}
|
|
51882
|
-
if (template.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") {
|
|
51883
|
-
skippedNestedStackRow++;
|
|
51884
|
-
continue;
|
|
51885
|
-
}
|
|
51886
|
-
if (!overrides.has(logicalId)) {
|
|
51887
|
-
overrides.set(logicalId, physicalId);
|
|
51888
|
-
derived++;
|
|
51889
|
-
}
|
|
51890
|
-
}
|
|
51891
|
-
const overriddenByUser = cfnMapping.size - derived - skippedNonImportable - skippedNestedStackRow;
|
|
51892
|
-
const detail = [];
|
|
51893
|
-
if (overriddenByUser > 0) detail.push(`${overriddenByUser} already overridden by --resource`);
|
|
51894
|
-
if (skippedNonImportable > 0) detail.push(`${skippedNonImportable} non-importable (e.g. CDKMetadata)`);
|
|
51895
|
-
if (skippedNestedStackRow > 0) detail.push(`${skippedNestedStackRow} nested-stack row(s) handled separately`);
|
|
51896
|
-
logger.info(`Resolved ${derived} physical ID(s) from CloudFormation` + (detail.length > 0 ? ` (${detail.join(", ")})` : ""));
|
|
52007
|
+
const mergeStats = mergeCfnDerivedOverrides({
|
|
52008
|
+
cfnMapping: migrationTree.resources,
|
|
52009
|
+
template,
|
|
52010
|
+
templateLogicalIds,
|
|
52011
|
+
overrides
|
|
52012
|
+
});
|
|
52013
|
+
logger.info(`Resolved ${mergeStats.derived} physical ID(s) from CloudFormation` + formatCfnOverrideMergeDetail(mergeStats));
|
|
51897
52014
|
validateNestedStackShape(template, migrationTree, stackInfo.stackName, stackInfo.nestedTemplates ?? {});
|
|
51898
52015
|
}
|
|
51899
52016
|
let accountIdForNestedSynth;
|
|
@@ -51905,6 +52022,19 @@ async function importCommand(stackArg, options) {
|
|
|
51905
52022
|
}
|
|
51906
52023
|
const selectiveMode = overrides.size > 0 && !options.auto && !options.migrateFromCloudformation;
|
|
51907
52024
|
if (selectiveMode) logger.info(`Selective mode: only importing the ${overrides.size} resource(s) you listed (${[...overrides.keys()].join(", ")}). Pass --auto to also tag-import the rest.`);
|
|
52025
|
+
if (!selectiveMode && !migrationCfnStackName) {
|
|
52026
|
+
const cfnResources = await tryGetCloudFormationResourceMap(stackInfo.stackName, awsClients.cloudFormation);
|
|
52027
|
+
if (cfnResources) {
|
|
52028
|
+
const mergeStats = mergeCfnDerivedOverrides({
|
|
52029
|
+
cfnMapping: cfnResources,
|
|
52030
|
+
template,
|
|
52031
|
+
templateLogicalIds,
|
|
52032
|
+
overrides
|
|
52033
|
+
});
|
|
52034
|
+
if (mergeStats.derived > 0) logger.info(`Resolved ${mergeStats.derived} physical ID(s) from CloudFormation stack '${stackInfo.stackName}'. To adopt AND retire that stack, use --migrate-from-cloudformation.`);
|
|
52035
|
+
else logger.debug(`CloudFormation stack '${stackInfo.stackName}' contributed no new physical IDs.`);
|
|
52036
|
+
} else logger.debug(`No CloudFormation stack named '${stackInfo.stackName}' — resolving physical IDs per provider.`);
|
|
52037
|
+
}
|
|
51908
52038
|
const existingResult = await stateBackend.getState(stackInfo.stackName, targetRegion);
|
|
51909
52039
|
const existingState = existingResult?.state ?? null;
|
|
51910
52040
|
const existingEtag = existingResult?.etag;
|
|
@@ -52018,6 +52148,79 @@ async function importCommand(stackArg, options) {
|
|
|
52018
52148
|
}
|
|
52019
52149
|
}
|
|
52020
52150
|
/**
|
|
52151
|
+
* Merge a CloudFormation-derived `logicalId -> physicalId` map into the run's
|
|
52152
|
+
* `overrides`, applying the three filters every CFn-derived seed needs, and
|
|
52153
|
+
* report what each filter dropped.
|
|
52154
|
+
*
|
|
52155
|
+
* The filters, in order:
|
|
52156
|
+
* 1. **Not an importable template resource** — CFn knows about sentinel rows
|
|
52157
|
+
* like `AWS::CDK::Metadata` that cdkd silently skips on import. Merging
|
|
52158
|
+
* those would make the typo-validation step reject them.
|
|
52159
|
+
* 2. **Nested-stack row** — the AWS-side physical ID of an
|
|
52160
|
+
* `AWS::CloudFormation::Stack` row is the child stack ARN, which is NOT
|
|
52161
|
+
* what we want as an import override. The parent's state entry carries
|
|
52162
|
+
* the synthesized cdkd-local ARN (matching what `NestedStackProvider.create`
|
|
52163
|
+
* writes at deploy time — design §6), populated by `importOne`'s
|
|
52164
|
+
* short-circuit. Filtering here keeps the AWS ARN from overwriting it.
|
|
52165
|
+
* 3. **Already overridden** — user-supplied `--resource` /
|
|
52166
|
+
* `--resource-mapping` entries are inserted before any CFn lookup and
|
|
52167
|
+
* always win.
|
|
52168
|
+
*
|
|
52169
|
+
* Shared by all three CFn-derived seeding sites so a change to any filter
|
|
52170
|
+
* lands once: the `--migrate-from-cloudformation` root walk, the auto-mode
|
|
52171
|
+
* best-effort lookup (issue #1128), and the recursive nested-child walk.
|
|
52172
|
+
* The three differ only in their LOGGING, which stays at the call sites.
|
|
52173
|
+
*
|
|
52174
|
+
* **Second-order effect worth naming:** `overrides` is also consumed by
|
|
52175
|
+
* {@link substituteOverrideRefs}, so seeding it from CloudFormation means a
|
|
52176
|
+
* `{Ref: <X>}` in a resource's Properties pre-resolves to the CFn physical ID
|
|
52177
|
+
* before `provider.import()` sees it. That is intended — it is what makes
|
|
52178
|
+
* sub-resource providers (e.g. `SQSQueuePolicyProvider`, which reads
|
|
52179
|
+
* `properties.Queues[0]` as a literal queue URL) importable — but it is a
|
|
52180
|
+
* behavior beyond "resolve physical IDs", and it applies to every caller of
|
|
52181
|
+
* this helper, not just the migration path. See issue #1131.
|
|
52182
|
+
*
|
|
52183
|
+
* Mutates `overrides` in place; does not mutate `cfnMapping` or `template`.
|
|
52184
|
+
*/
|
|
52185
|
+
function mergeCfnDerivedOverrides(params) {
|
|
52186
|
+
const { cfnMapping, template, templateLogicalIds, overrides } = params;
|
|
52187
|
+
const stats = {
|
|
52188
|
+
derived: 0,
|
|
52189
|
+
skippedNonImportable: 0,
|
|
52190
|
+
skippedNestedStackRow: 0,
|
|
52191
|
+
overriddenByUser: 0
|
|
52192
|
+
};
|
|
52193
|
+
for (const [logicalId, physicalId] of cfnMapping) {
|
|
52194
|
+
if (!templateLogicalIds.has(logicalId)) {
|
|
52195
|
+
stats.skippedNonImportable++;
|
|
52196
|
+
continue;
|
|
52197
|
+
}
|
|
52198
|
+
if (template.Resources[logicalId]?.Type === "AWS::CloudFormation::Stack") {
|
|
52199
|
+
stats.skippedNestedStackRow++;
|
|
52200
|
+
continue;
|
|
52201
|
+
}
|
|
52202
|
+
if (overrides.has(logicalId)) {
|
|
52203
|
+
stats.overriddenByUser++;
|
|
52204
|
+
continue;
|
|
52205
|
+
}
|
|
52206
|
+
overrides.set(logicalId, physicalId);
|
|
52207
|
+
stats.derived++;
|
|
52208
|
+
}
|
|
52209
|
+
return stats;
|
|
52210
|
+
}
|
|
52211
|
+
/**
|
|
52212
|
+
* Render the human-readable breakdown of a {@link mergeCfnDerivedOverrides}
|
|
52213
|
+
* result — the parenthesized suffix of the `Resolved N physical ID(s)` line.
|
|
52214
|
+
* Returns `''` when nothing was dropped (no breakdown worth reporting).
|
|
52215
|
+
*/
|
|
52216
|
+
function formatCfnOverrideMergeDetail(stats) {
|
|
52217
|
+
const detail = [];
|
|
52218
|
+
if (stats.overriddenByUser > 0) detail.push(`${stats.overriddenByUser} already overridden by --resource`);
|
|
52219
|
+
if (stats.skippedNonImportable > 0) detail.push(`${stats.skippedNonImportable} non-importable (e.g. CDKMetadata)`);
|
|
52220
|
+
if (stats.skippedNestedStackRow > 0) detail.push(`${stats.skippedNestedStackRow} nested-stack row(s) handled separately`);
|
|
52221
|
+
return detail.length > 0 ? ` (${detail.join(", ")})` : "";
|
|
52222
|
+
}
|
|
52223
|
+
/**
|
|
52021
52224
|
* Recursively substitute `{Ref: <LogicalId>}` shapes in an arbitrary value
|
|
52022
52225
|
* tree with the matching entry from `overrides`. Used to bridge the gap
|
|
52023
52226
|
* between CDK synth's template (which carries raw intrinsics) and what a
|
|
@@ -52566,11 +52769,12 @@ async function importNestedStackChildrenRecursive(args) {
|
|
|
52566
52769
|
const childResources = collectImportableResources(childTemplate);
|
|
52567
52770
|
const childTemplateLogicalIds = new Set(childResources.map((r) => r.logicalId));
|
|
52568
52771
|
const childOverrides = /* @__PURE__ */ new Map();
|
|
52569
|
-
|
|
52570
|
-
|
|
52571
|
-
|
|
52572
|
-
|
|
52573
|
-
|
|
52772
|
+
mergeCfnDerivedOverrides({
|
|
52773
|
+
cfnMapping: childTreeNode.resources,
|
|
52774
|
+
template: childTemplate,
|
|
52775
|
+
templateLogicalIds: childTemplateLogicalIds,
|
|
52776
|
+
overrides: childOverrides
|
|
52777
|
+
});
|
|
52574
52778
|
const rows = [];
|
|
52575
52779
|
for (const { logicalId, resource } of childResources) {
|
|
52576
52780
|
if (resource.Type === "AWS::CloudFormation::Stack" && childTreeNode.nested.has(logicalId)) {
|
|
@@ -62172,7 +62376,7 @@ function createMigrateCommand() {
|
|
|
62172
62376
|
*/
|
|
62173
62377
|
function buildProgram() {
|
|
62174
62378
|
const program = new Command();
|
|
62175
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.257.
|
|
62379
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.257.2");
|
|
62176
62380
|
program.addCommand(createBootstrapCommand());
|
|
62177
62381
|
program.addCommand(createSynthCommand());
|
|
62178
62382
|
program.addCommand(createListCommand());
|