cdk-local 0.163.4 → 0.163.6
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 +2 -2
- package/dist/{docker-runner-Dq3y5-Me.js → docker-runner-B3OunVKV.js} +10 -14
- package/dist/docker-runner-B3OunVKV.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +13 -36
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -4
- package/dist/{local-studio-DK5chhyj.js → local-studio-BR8vPfCn.js} +395 -198
- package/dist/local-studio-BR8vPfCn.js.map +1 -0
- package/dist/{local-studio-C8iEtNcn.d.ts → local-studio-Cq73EZrD.d.ts} +112 -50
- package/dist/local-studio-Cq73EZrD.d.ts.map +1 -0
- package/dist/{workload-identity-D3XdPJjV.js → workload-identity-BOEZuEDO.js} +717 -145
- package/dist/workload-identity-BOEZuEDO.js.map +1 -0
- package/package.json +1 -1
- package/dist/docker-runner-Dq3y5-Me.js.map +0 -1
- package/dist/local-studio-C8iEtNcn.d.ts.map +0 -1
- package/dist/local-studio-DK5chhyj.js.map +0 -1
- package/dist/workload-identity-D3XdPJjV.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as displayIdent, c as getEmbedConfig, i as STACK_REF_MAX_CODE_POINTS, o as displayStackName, s as displayToolOutput, t as getLogger, u as setEmbedConfig } from "./logger-Co5XVwco.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as effectiveLoopbackPorts, F as resolveHostDefaultCredentials, G as awsEndpointOverrideClientConfig, K as buildProxyClientConfig, Q as proxyAwareFetch, W as awsEmulatorRoutedServices, Y as isAwsServiceRoutedToEmulator, _t as isLoopbackHostname, b as awsEmulatorEnvName, bt as formatHostForAuthority, d as workloadStsClientConfig, gt as defineOwnKey, ht as resolveEnvVars$1, l as warnWorkloadCredentialsStripped, mt as readEnvVarsFileText, n as accountLookupStsClientConfig, pt as applyEnvOverrideMap, r as applyWorkloadEnvCredentials, rt as createMixedModeStateProvider, u as workloadClientConfig, v as activateWorkloadAwsWiring, vt as isWildcardHostname, w as getActiveWorkloadAwsWiring, xt as hostFromAuthority, y as applyWorkloadAwsWiringToEnv, yt as formatAuthority } from "./workload-identity-BOEZuEDO.js";
|
|
3
3
|
import { c as clampErrorName, d as flattenToOneLine, f as isAwsServiceException, l as describeAwsFailureForWarn, m as stringifyThrown, o as renderAssemblyPathEscape, p as sanitizeServiceExceptionMessage, r as displayUntrustedValue, s as resolveAssemblyPath, t as absoluteAssemblyPathEscape, u as describeCredentialLoadFailure } from "./assembly-path-R96uhMm1.js";
|
|
4
|
-
import { $ as isIamRoleArn, A as buildDockerImage, B as
|
|
4
|
+
import { $ as isIamRoleArn, A as buildDockerImage, B as substituteImagePlaceholders, D as isImageInLocalCache, E as warnIfEmulatedPlatform, F as parseEcrRegistryHost, G as LocalStartServiceError, H as CdkLocalError, I as contextForContainer, J as withErrorHandling, K as RouteDiscoveryError, L as derivePartitionAndUrlSuffix, M as createShutdownSignalHandler, N as signalExitCode, O as parseEcrUri, P as describeExitWithoutArgv, Q as describeRejectedRoleArn, R as derivePseudoParametersFromRegion, T as buildContainerImage, U as InteractiveTtyRequiredError, V as tryResolveImageFnJoin, W as LocalInvokeBuildError, X as applyRoleArnIfSet, Y as AssumeRoleFailure, Z as assumeRoleCredentials, a as describeRefusedSensitiveEnvKeys, c as execEnvForSecrets, d as rememberForwardedPorts, et as refusedRoleArnMessage, f as removeContainer, h as streamLogs, i as attachLoopbackForwarder, j as resolveAssetSourcePath, k as pullEcrImage, l as pickFreePort, m as startNamespaceOwnerForwarder, n as SENSITIVE_ENV_KEYS, nt as resolveProfileCredentials, p as runDetached, q as TargetSelectionCancelledError, r as appendEnvFlags, s as ensureDockerAvailable, t as DockerRunnerError, tt as buildStsClientConfig, u as pullImage, w as architectureToPlatform, z as formatStateRemedy } from "./docker-runner-B3OunVKV.js";
|
|
5
5
|
import { a as isDockerClientEnvKey, c as runDockerStreaming, i as getDockerCmd, n as finchSecretArgvRefusal, o as isMalformedEnvKey, u as warnFinchArgvExposure } from "./docker-cmd-Cjg3jGYF.js";
|
|
6
6
|
import { chmodSync, cpSync, createWriteStream, existsSync, lstatSync, mkdirSync, mkdtempSync, promises, readFileSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
@@ -321,10 +321,17 @@ var DynamicReferenceResolver = class {
|
|
|
321
321
|
return Promise.reject(new DynamicReferenceResolutionError(`${err.message.replace(/\.$/, "")} (${opts.consumer}).`));
|
|
322
322
|
}
|
|
323
323
|
const region = firstUsableRegion(ref.arnRegion, opts.region);
|
|
324
|
-
const
|
|
324
|
+
const workload = opts.workload ?? this.options.workload;
|
|
325
|
+
const emulator = isAwsServiceRoutedToEmulator(ref.service === "secretsmanager" ? "SECRETS_MANAGER" : "SSM", workload);
|
|
326
|
+
const cacheKey = `${emulator ? "emulator" : "aws"}\u0000${region ?? ""}\u0000${raw}`;
|
|
325
327
|
let pending = this.cache.get(cacheKey);
|
|
326
328
|
if (!pending) {
|
|
327
|
-
|
|
329
|
+
const target = {
|
|
330
|
+
region,
|
|
331
|
+
workload,
|
|
332
|
+
emulator
|
|
333
|
+
};
|
|
334
|
+
pending = ref.service === "secretsmanager" ? this.fetchSecret(ref, target) : this.fetchParameter(ref, target);
|
|
328
335
|
this.cache.set(cacheKey, pending);
|
|
329
336
|
pending.catch(() => this.cache.delete(cacheKey));
|
|
330
337
|
}
|
|
@@ -336,14 +343,19 @@ var DynamicReferenceResolver = class {
|
|
|
336
343
|
throw err instanceof DeferredFailure ? err.render(opts) : err;
|
|
337
344
|
});
|
|
338
345
|
}
|
|
339
|
-
smClient(
|
|
340
|
-
const
|
|
346
|
+
smClient(target) {
|
|
347
|
+
const { region, workload } = target;
|
|
348
|
+
const key = `${target.emulator ? "emulator" : "aws"}\u0000${region ?? ""}`;
|
|
341
349
|
let c = this.smClients.get(key);
|
|
342
350
|
if (!c) {
|
|
343
|
-
c = this.options.secretsManagerClientFactory?.(region
|
|
351
|
+
c = this.options.secretsManagerClientFactory?.(region, {
|
|
352
|
+
workload,
|
|
353
|
+
emulator: target.emulator
|
|
354
|
+
}) ?? new SecretsManagerClient({
|
|
344
355
|
...workloadClientConfig({
|
|
345
356
|
profile: this.options.profile,
|
|
346
|
-
service: "SECRETS_MANAGER"
|
|
357
|
+
service: "SECRETS_MANAGER",
|
|
358
|
+
workload
|
|
347
359
|
}),
|
|
348
360
|
...region && { region },
|
|
349
361
|
...this.options.profile && { profile: this.options.profile }
|
|
@@ -352,14 +364,19 @@ var DynamicReferenceResolver = class {
|
|
|
352
364
|
}
|
|
353
365
|
return c;
|
|
354
366
|
}
|
|
355
|
-
ssmClient(
|
|
356
|
-
const
|
|
367
|
+
ssmClient(target) {
|
|
368
|
+
const { region, workload } = target;
|
|
369
|
+
const key = `${target.emulator ? "emulator" : "aws"}\u0000${region ?? ""}`;
|
|
357
370
|
let c = this.ssmClients.get(key);
|
|
358
371
|
if (!c) {
|
|
359
|
-
c = this.options.ssmClientFactory?.(region
|
|
372
|
+
c = this.options.ssmClientFactory?.(region, {
|
|
373
|
+
workload,
|
|
374
|
+
emulator: target.emulator
|
|
375
|
+
}) ?? new SSMClient({
|
|
360
376
|
...workloadClientConfig({
|
|
361
377
|
profile: this.options.profile,
|
|
362
|
-
service: "SSM"
|
|
378
|
+
service: "SSM",
|
|
379
|
+
workload
|
|
363
380
|
}),
|
|
364
381
|
...region && { region },
|
|
365
382
|
...this.options.profile && { profile: this.options.profile }
|
|
@@ -376,11 +393,12 @@ var DynamicReferenceResolver = class {
|
|
|
376
393
|
const detail = describeAwsFailureForWarn(err, operation);
|
|
377
394
|
return deferred((consumer, overridable) => `Could not resolve CloudFormation dynamic reference ${displayUntrustedValue(ref.raw)} for ${consumer} (${operation} in ${region ?? "the default region"}): ${detail}.${hint} Resolving it needs ${requiredPermissionsFor(ref)}. cdk-local does not fall back to the unresolved token` + (overridable ? "; override the variable with --env-vars to skip the lookup." : "."));
|
|
378
395
|
}
|
|
379
|
-
async fetchSecret(ref,
|
|
380
|
-
const
|
|
396
|
+
async fetchSecret(ref, target) {
|
|
397
|
+
const { region } = target;
|
|
398
|
+
const operation = `SecretsManager GetSecretValue${target.emulator ? " on AWS Emulator" : ""}`;
|
|
381
399
|
let secretString;
|
|
382
400
|
try {
|
|
383
|
-
secretString = (await this.smClient(
|
|
401
|
+
secretString = (await this.smClient(target).send(new GetSecretValueCommand({
|
|
384
402
|
SecretId: ref.secretId,
|
|
385
403
|
...ref.versionStage && { VersionStage: ref.versionStage },
|
|
386
404
|
...ref.versionId && { VersionId: ref.versionId }
|
|
@@ -403,12 +421,13 @@ var DynamicReferenceResolver = class {
|
|
|
403
421
|
const value = parsed[jsonKey];
|
|
404
422
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
405
423
|
}
|
|
406
|
-
async fetchParameter(ref,
|
|
407
|
-
const
|
|
424
|
+
async fetchParameter(ref, target) {
|
|
425
|
+
const { region } = target;
|
|
426
|
+
const operation = `SSM GetParameter${target.emulator ? " on AWS Emulator" : ""}`;
|
|
408
427
|
let value;
|
|
409
428
|
let type;
|
|
410
429
|
try {
|
|
411
|
-
const resp = await this.ssmClient(
|
|
430
|
+
const resp = await this.ssmClient(target).send(new GetParameterCommand({
|
|
412
431
|
Name: ref.version !== void 0 ? `${ref.name}:${ref.version}` : ref.name,
|
|
413
432
|
WithDecryption: ref.service === "ssm-secure"
|
|
414
433
|
}));
|
|
@@ -422,6 +441,14 @@ var DynamicReferenceResolver = class {
|
|
|
422
441
|
return value;
|
|
423
442
|
}
|
|
424
443
|
};
|
|
444
|
+
function crossStackDynamicReferenceHook(resolver, consumer) {
|
|
445
|
+
return (value, producerRegion, workload) => resolver.resolveString(value, {
|
|
446
|
+
region: producerRegion,
|
|
447
|
+
workload,
|
|
448
|
+
consumer,
|
|
449
|
+
overridable: false
|
|
450
|
+
});
|
|
451
|
+
}
|
|
425
452
|
function keysNotFromTemplate(templateEnv, finalEnv) {
|
|
426
453
|
const out = /* @__PURE__ */ new Set();
|
|
427
454
|
for (const [k, v] of Object.entries(finalEnv)) {
|
|
@@ -440,7 +467,8 @@ async function resolveDynamicReferencesInEnv(env, options) {
|
|
|
440
467
|
try {
|
|
441
468
|
const values = await Promise.all(candidates.map((k) => resolver.resolveString(env[k], {
|
|
442
469
|
region: options.region,
|
|
443
|
-
consumer: `${options.label} env var ${displayUntrustedValue(k)}
|
|
470
|
+
consumer: `${options.label} env var ${displayUntrustedValue(k)}`,
|
|
471
|
+
...options.workload !== void 0 && { workload: options.workload }
|
|
444
472
|
})));
|
|
445
473
|
const out = {};
|
|
446
474
|
for (const k of Object.keys(env)) defineOwnKey(out, k, env[k]);
|
|
@@ -1069,6 +1097,20 @@ function resolveAgentCoreTarget(target, stacks, imageContext) {
|
|
|
1069
1097
|
if (resource.Type !== "AWS::BedrockAgentCore::Runtime") throw new AgentCoreResolutionError(`Resource ${displayIdent(logicalId)} in ${stack.stackName} is ${resource.Type}, not ${AGENTCORE_RUNTIME_TYPE}. ${getEmbedConfig().cliName} invoke-agentcore only runs Bedrock AgentCore Runtime resources.`);
|
|
1070
1098
|
return extractRuntimeProperties(stack, logicalId, resource, resources, imageContext);
|
|
1071
1099
|
}
|
|
1100
|
+
function agentCoreTargetWorkload(target, stacks) {
|
|
1101
|
+
try {
|
|
1102
|
+
const parsed = parseTarget(target);
|
|
1103
|
+
const stack = pickStack$5(parsed, stacks, target);
|
|
1104
|
+
const { logicalId, resource } = matchRuntime(parsed, target, stack, stack.template.Resources ?? {});
|
|
1105
|
+
const path = resource.Metadata?.["aws:cdk:path"];
|
|
1106
|
+
return {
|
|
1107
|
+
logicalId,
|
|
1108
|
+
cdkPath: typeof path === "string" ? path : void 0
|
|
1109
|
+
};
|
|
1110
|
+
} catch {
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1072
1114
|
function pickAgentCoreCandidateStack(target, stacks) {
|
|
1073
1115
|
return candidateTargetStack(parseTarget(target), target, stacks);
|
|
1074
1116
|
}
|
|
@@ -2998,6 +3040,7 @@ var CfnLocalStateProvider = class {
|
|
|
2998
3040
|
agentCoreControlClient;
|
|
2999
3041
|
clientOptions;
|
|
3000
3042
|
endpointOverride;
|
|
3043
|
+
workload;
|
|
3001
3044
|
disposed = false;
|
|
3002
3045
|
lastLoadError;
|
|
3003
3046
|
constructor(opts) {
|
|
@@ -3005,6 +3048,7 @@ var CfnLocalStateProvider = class {
|
|
|
3005
3048
|
this.region = opts.region;
|
|
3006
3049
|
this.clientOptions = { region: opts.region };
|
|
3007
3050
|
this.endpointOverride = opts.endpointOverride;
|
|
3051
|
+
this.workload = opts.workload;
|
|
3008
3052
|
this.label = opts.label ?? "--from-cfn-stack";
|
|
3009
3053
|
if (opts.profile !== void 0 && !opts.endpointOverride) this.clientOptions.profile = opts.profile;
|
|
3010
3054
|
}
|
|
@@ -3046,7 +3090,10 @@ var CfnLocalStateProvider = class {
|
|
|
3046
3090
|
if (!this.ssmClient) this.ssmClient = new SSMClient({
|
|
3047
3091
|
...workloadClientConfig({
|
|
3048
3092
|
profile: this.clientOptions.profile,
|
|
3049
|
-
...this.endpointOverride ? {} : {
|
|
3093
|
+
...this.endpointOverride ? {} : {
|
|
3094
|
+
service: "SSM",
|
|
3095
|
+
workload: this.workload
|
|
3096
|
+
}
|
|
3050
3097
|
}),
|
|
3051
3098
|
...this.overrideClientConfig(),
|
|
3052
3099
|
region: this.region,
|
|
@@ -3327,10 +3374,13 @@ function createLocalStateProvider(options, stackName, synthRegion, extraStatePro
|
|
|
3327
3374
|
const real = new CfnLocalStateProvider({
|
|
3328
3375
|
cfnStackName,
|
|
3329
3376
|
region,
|
|
3330
|
-
...options.profile !== void 0 && { profile: options.profile }
|
|
3377
|
+
...options.profile !== void 0 && { profile: options.profile },
|
|
3378
|
+
...behavior.workload !== void 0 && { workload: behavior.workload }
|
|
3331
3379
|
});
|
|
3332
3380
|
const mixed = behavior.realAwsOnly ? void 0 : getActiveWorkloadAwsWiring()?.mixed;
|
|
3333
3381
|
if (!mixed) return real;
|
|
3382
|
+
const emulatedServices = awsEmulatorRoutedServices(behavior.workload) ?? mixed.services;
|
|
3383
|
+
if (emulatedServices.length === 0) return real;
|
|
3334
3384
|
return createMixedModeStateProvider({
|
|
3335
3385
|
real,
|
|
3336
3386
|
emulator: new CfnLocalStateProvider({
|
|
@@ -3339,13 +3389,34 @@ function createLocalStateProvider(options, stackName, synthRegion, extraStatePro
|
|
|
3339
3389
|
endpointOverride: mixed.emulatorClientOverride,
|
|
3340
3390
|
label: "--from-cfn-stack (AWS Emulator)"
|
|
3341
3391
|
}),
|
|
3342
|
-
emulatedServices
|
|
3392
|
+
emulatedServices
|
|
3343
3393
|
});
|
|
3344
3394
|
}
|
|
3345
3395
|
if (activeExtras.length === 1) {
|
|
3346
3396
|
const factory = extraStateProviders[activeExtras[0]];
|
|
3347
|
-
return factory(options);
|
|
3397
|
+
return factory(options, behavior);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
const UNNAMED_WORKLOAD = Object.freeze({});
|
|
3401
|
+
function groupWorkloadsRoutedApart(items, workloadOf) {
|
|
3402
|
+
const base = awsEmulatorRoutedServices(UNNAMED_WORKLOAD);
|
|
3403
|
+
if (base === void 0) return [];
|
|
3404
|
+
const baseKey = base.join(",");
|
|
3405
|
+
const groups = /* @__PURE__ */ new Map();
|
|
3406
|
+
for (const item of items) {
|
|
3407
|
+
const workload = workloadOf(item);
|
|
3408
|
+
const services = awsEmulatorRoutedServices(workload) ?? base;
|
|
3409
|
+
const key = services.join(",");
|
|
3410
|
+
if (key === baseKey) continue;
|
|
3411
|
+
const group = groups.get(key);
|
|
3412
|
+
if (group) group.items.push(item);
|
|
3413
|
+
else groups.set(key, {
|
|
3414
|
+
services,
|
|
3415
|
+
workload,
|
|
3416
|
+
items: [item]
|
|
3417
|
+
});
|
|
3348
3418
|
}
|
|
3419
|
+
return [...groups.values()];
|
|
3349
3420
|
}
|
|
3350
3421
|
function toFlagName(field) {
|
|
3351
3422
|
return "--" + field.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -4222,7 +4293,7 @@ function parseContainerDefinition(raw, idx, taskLogicalId, resources, stack, con
|
|
|
4222
4293
|
const command = pickStringArray$1(c["Command"]);
|
|
4223
4294
|
const entryPoint = pickStringArray$1(c["EntryPoint"]);
|
|
4224
4295
|
const workingDirectory = pickString(c["WorkingDirectory"]);
|
|
4225
|
-
const subContext = buildSubstitutionContextFromImageContext(context);
|
|
4296
|
+
const subContext = buildSubstitutionContextFromImageContext(contextForContainer(context, name));
|
|
4226
4297
|
const environment = {};
|
|
4227
4298
|
const sensitiveEnvKeys = [];
|
|
4228
4299
|
const droppedEnvKeys = [];
|
|
@@ -4625,7 +4696,46 @@ function checkVolumeHostPath(hostPath) {
|
|
|
4625
4696
|
return false;
|
|
4626
4697
|
}
|
|
4627
4698
|
}
|
|
4628
|
-
async function
|
|
4699
|
+
async function applyCrossStackValuesToTask(task, crossStackResolver, opts) {
|
|
4700
|
+
const { imageContext } = opts;
|
|
4701
|
+
const dynamicRefs = new DynamicReferenceResolver({ ...opts.profile !== void 0 && { profile: opts.profile } });
|
|
4702
|
+
const subContext = {
|
|
4703
|
+
resources: imageContext?.stateResources ?? {},
|
|
4704
|
+
...imageContext?.pseudoParameters && { pseudoParameters: imageContext.pseudoParameters },
|
|
4705
|
+
...imageContext?.stateParameters && { parameters: imageContext.stateParameters },
|
|
4706
|
+
...imageContext?.stateSensitiveParameters?.length && { sensitiveParameters: new Set(imageContext.stateSensitiveParameters) },
|
|
4707
|
+
consumerRegion: opts.consumerRegion,
|
|
4708
|
+
crossStackResolver,
|
|
4709
|
+
resolveDynamicReferences: crossStackDynamicReferenceHook(dynamicRefs, `Task ${task.taskDefinitionLogicalId} cross-stack env value`)
|
|
4710
|
+
};
|
|
4711
|
+
const containerState = (name) => {
|
|
4712
|
+
const own = imageContext?.containerStates;
|
|
4713
|
+
if (!own || !Object.hasOwn(own, name)) return void 0;
|
|
4714
|
+
const state = own[name];
|
|
4715
|
+
return {
|
|
4716
|
+
resources: state.stateResources ?? {},
|
|
4717
|
+
parameters: state.stateParameters,
|
|
4718
|
+
sensitiveParameters: state.stateSensitiveParameters?.length ? new Set(state.stateSensitiveParameters) : void 0
|
|
4719
|
+
};
|
|
4720
|
+
};
|
|
4721
|
+
try {
|
|
4722
|
+
await applyCrossStackResolverToTask(task, subContext, containerState);
|
|
4723
|
+
} finally {
|
|
4724
|
+
dynamicRefs.dispose();
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
function withContainerState(context, state) {
|
|
4728
|
+
const out = {
|
|
4729
|
+
...context,
|
|
4730
|
+
resources: state.resources
|
|
4731
|
+
};
|
|
4732
|
+
if (state.parameters) out.parameters = state.parameters;
|
|
4733
|
+
else delete out.parameters;
|
|
4734
|
+
if (state.sensitiveParameters) out.sensitiveParameters = state.sensitiveParameters;
|
|
4735
|
+
else delete out.sensitiveParameters;
|
|
4736
|
+
return out;
|
|
4737
|
+
}
|
|
4738
|
+
async function applyCrossStackResolverToTask(task, context, containerState) {
|
|
4629
4739
|
if (!context.crossStackResolver) return;
|
|
4630
4740
|
const { resolveDynamicReferences: _envOnly, ...secretContext } = context;
|
|
4631
4741
|
const rawContainers = (task.resource.Properties ?? {})["ContainerDefinitions"];
|
|
@@ -4636,6 +4746,13 @@ async function applyCrossStackResolverToTask(task, context) {
|
|
|
4636
4746
|
if (!raw || typeof raw !== "object") continue;
|
|
4637
4747
|
const c = raw;
|
|
4638
4748
|
const containerName = pickString(c["Name"]) ?? container.name;
|
|
4749
|
+
const resolveRefs = context.resolveDynamicReferences;
|
|
4750
|
+
const ownState = containerState?.(container.name);
|
|
4751
|
+
const baseContext = ownState ? withContainerState(context, ownState) : context;
|
|
4752
|
+
const containerContext = resolveRefs ? {
|
|
4753
|
+
...baseContext,
|
|
4754
|
+
resolveDynamicReferences: (v, region) => resolveRefs(v, region, { containerName: container.name })
|
|
4755
|
+
} : baseContext;
|
|
4639
4756
|
const resolvedEnvKeys = /* @__PURE__ */ new Set();
|
|
4640
4757
|
const resolvedSecretNames = /* @__PURE__ */ new Set();
|
|
4641
4758
|
if (Array.isArray(c["Environment"])) for (const entry of c["Environment"]) {
|
|
@@ -4647,7 +4764,7 @@ async function applyCrossStackResolverToTask(task, context) {
|
|
|
4647
4764
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") continue;
|
|
4648
4765
|
if (Object.hasOwn(container.environment, key)) continue;
|
|
4649
4766
|
if (!isCrossStackIntrinsic(value)) continue;
|
|
4650
|
-
const { result: sub, consumedSensitive } = await resolveWithSensitivityAsync(value,
|
|
4767
|
+
const { result: sub, consumedSensitive } = await resolveWithSensitivityAsync(value, containerContext);
|
|
4651
4768
|
if (sub.kind === "literal") {
|
|
4652
4769
|
defineOwnKey(container.environment, key, String(sub.value));
|
|
4653
4770
|
resolvedEnvKeys.add(key);
|
|
@@ -4663,7 +4780,7 @@ async function applyCrossStackResolverToTask(task, context) {
|
|
|
4663
4780
|
if (typeof valueFromRaw === "string" && valueFromRaw.length > 0) continue;
|
|
4664
4781
|
if (container.secrets.some((s) => s.name === sName)) continue;
|
|
4665
4782
|
if (!isCrossStackIntrinsic(valueFromRaw)) continue;
|
|
4666
|
-
const sub = await substituteAgainstStateAsync(valueFromRaw, secretContext);
|
|
4783
|
+
const sub = await substituteAgainstStateAsync(valueFromRaw, ownState ? withContainerState(secretContext, ownState) : secretContext);
|
|
4667
4784
|
if (sub.kind === "literal" && typeof sub.value === "string" && sub.value.length > 0) {
|
|
4668
4785
|
container.secrets.push({
|
|
4669
4786
|
name: sName,
|
|
@@ -10117,39 +10234,6 @@ function availableApiIdentifiers(routes) {
|
|
|
10117
10234
|
return out;
|
|
10118
10235
|
}
|
|
10119
10236
|
|
|
10120
|
-
//#endregion
|
|
10121
|
-
//#region src/local/env-resolver.ts
|
|
10122
|
-
function resolveEnvVars$1(logicalId, displayPath, templateEnv, overrides) {
|
|
10123
|
-
const resolved = {};
|
|
10124
|
-
const unresolved = [];
|
|
10125
|
-
if (templateEnv) for (const [key, value] of Object.entries(templateEnv)) if (isLiteralEnvValue(value)) defineOwnKey(resolved, key, String(value));
|
|
10126
|
-
else unresolved.push(key);
|
|
10127
|
-
if (overrides) {
|
|
10128
|
-
applyEnvOverrideMap(resolved, overrides.Parameters);
|
|
10129
|
-
for (const [key, val] of Object.entries(overrides)) {
|
|
10130
|
-
if (key === "Parameters") continue;
|
|
10131
|
-
if (!val || typeof val !== "object") continue;
|
|
10132
|
-
if (key === logicalId) {
|
|
10133
|
-
applyEnvOverrideMap(resolved, val);
|
|
10134
|
-
continue;
|
|
10135
|
-
}
|
|
10136
|
-
if (displayPath && (displayPath === key || displayPath.startsWith(`${key}/`))) applyEnvOverrideMap(resolved, val);
|
|
10137
|
-
}
|
|
10138
|
-
}
|
|
10139
|
-
return {
|
|
10140
|
-
resolved,
|
|
10141
|
-
unresolved
|
|
10142
|
-
};
|
|
10143
|
-
}
|
|
10144
|
-
function applyEnvOverrideMap(acc, map) {
|
|
10145
|
-
if (!map) return;
|
|
10146
|
-
for (const [key, value] of Object.entries(map)) if (value === null) delete acc[key];
|
|
10147
|
-
else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") defineOwnKey(acc, key, String(value));
|
|
10148
|
-
}
|
|
10149
|
-
function isLiteralEnvValue(value) {
|
|
10150
|
-
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
10151
|
-
}
|
|
10152
|
-
|
|
10153
10237
|
//#endregion
|
|
10154
10238
|
//#region src/local/layer-arn-materializer.ts
|
|
10155
10239
|
var LayerMaterializationError = class LayerMaterializationError extends Error {
|
|
@@ -10783,7 +10867,7 @@ async function localStartApiCommand(targets, options, extraStateProviders) {
|
|
|
10783
10867
|
for (const [k, v] of direct) corsConfigByApiId.set(k, v);
|
|
10784
10868
|
}
|
|
10785
10869
|
assertServedLogicalIdsUnambiguous(servedStacks, servedRoutes, routesWithAuth, webSocketApis);
|
|
10786
|
-
const stateByStack = isCfnFlagPresent(options) || hasExtraStateProviderActive(options, extraStateProviders) ? await loadStateForRoutedStacks(servedStacks, servedRoutes, routesWithAuth, options, extraStateProviders) : /* @__PURE__ */ new Map();
|
|
10870
|
+
const stateByStack = isCfnFlagPresent(options) || hasExtraStateProviderActive(options, extraStateProviders) ? await loadStateForRoutedStacks(servedStacks, servedRoutes, routesWithAuth, options, extraStateProviders, webSocketApis) : /* @__PURE__ */ new Map();
|
|
10787
10871
|
const profileCredentials = options.profile ? await resolveProfileCredentials(options.profile) : void 0;
|
|
10788
10872
|
if (options.profile && profileCredentials && !profileCredsFile) profileCredsFile = await writeProfileCredentialsFile(options.profile, profileCredentials);
|
|
10789
10873
|
const lambdaIds = uniqueLambdaIds(servedRoutes, routesWithAuth, webSocketApis);
|
|
@@ -11356,7 +11440,8 @@ async function buildContainerSpec(args) {
|
|
|
11356
11440
|
platform = architectureToPlatform(lambda.architecture);
|
|
11357
11441
|
}
|
|
11358
11442
|
let templateEnv = getTemplateEnv$1(lambda.resource);
|
|
11359
|
-
const
|
|
11443
|
+
const stackBundle = stateByStack.get(lambda.stack.stackName);
|
|
11444
|
+
const stateBundle = stackBundle?.byLambda?.get(logicalId) ?? (stackBundle?.withoutSharedState ? void 0 : stackBundle);
|
|
11360
11445
|
let stateAudit;
|
|
11361
11446
|
const plaintextKeys = /* @__PURE__ */ new Set();
|
|
11362
11447
|
const deployedSecretKeys = [];
|
|
@@ -11402,7 +11487,11 @@ async function buildContainerSpec(args) {
|
|
|
11402
11487
|
region: firstUsableRegion(stateBundle?.region, stackRegionOverride, lambda.stack.region, stsRegion, profileRegion),
|
|
11403
11488
|
label: `Lambda ${logicalId}`,
|
|
11404
11489
|
skipKeys: plaintextKeys,
|
|
11405
|
-
...profile !== void 0 && { profile }
|
|
11490
|
+
...profile !== void 0 && { profile },
|
|
11491
|
+
workload: {
|
|
11492
|
+
logicalId,
|
|
11493
|
+
cdkPath: lambdaCdkPath
|
|
11494
|
+
}
|
|
11406
11495
|
});
|
|
11407
11496
|
const dockerEnv = {
|
|
11408
11497
|
AWS_LAMBDA_FUNCTION_NAME: logicalId,
|
|
@@ -11417,7 +11506,7 @@ async function buildContainerSpec(args) {
|
|
|
11417
11506
|
logicalId,
|
|
11418
11507
|
assumeRole,
|
|
11419
11508
|
lambdaResource: lambda.resource,
|
|
11420
|
-
stateBundle
|
|
11509
|
+
stateBundle: stackBundle?.withoutSharedState ? void 0 : stackBundle
|
|
11421
11510
|
});
|
|
11422
11511
|
if (roleArn) {
|
|
11423
11512
|
const creds = await assumeLambdaExecutionRole(roleArn, stsRegion, profile);
|
|
@@ -11708,7 +11797,7 @@ function readEnvOverridesFile$4(filePath) {
|
|
|
11708
11797
|
if (!filePath) return void 0;
|
|
11709
11798
|
let raw;
|
|
11710
11799
|
try {
|
|
11711
|
-
raw =
|
|
11800
|
+
raw = readEnvVarsFileText(filePath);
|
|
11712
11801
|
} catch (err) {
|
|
11713
11802
|
throw new Error(`Failed to read --env-vars file '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
11714
11803
|
}
|
|
@@ -11849,10 +11938,9 @@ function envHasIntrinsicValue$1(templateEnv) {
|
|
|
11849
11938
|
}
|
|
11850
11939
|
return false;
|
|
11851
11940
|
}
|
|
11852
|
-
async function loadStateForRoutedStacks(stacks, routes, routesWithAuth, options, extraStateProviders) {
|
|
11853
|
-
const logger = getLogger();
|
|
11941
|
+
async function loadStateForRoutedStacks(stacks, routes, routesWithAuth, options, extraStateProviders, webSocketApis = []) {
|
|
11854
11942
|
const out = /* @__PURE__ */ new Map();
|
|
11855
|
-
const lambdaIds = uniqueLambdaIds(routes, routesWithAuth);
|
|
11943
|
+
const lambdaIds = uniqueLambdaIds(routes, routesWithAuth, webSocketApis);
|
|
11856
11944
|
const reachableStackNames = /* @__PURE__ */ new Set();
|
|
11857
11945
|
for (const logicalId of lambdaIds) for (const stack of stacks) {
|
|
11858
11946
|
const resource = stack.template.Resources?.[logicalId];
|
|
@@ -11874,51 +11962,88 @@ async function loadStateForRoutedStacks(stacks, routes, routesWithAuth, options,
|
|
|
11874
11962
|
for (const stackName of reachableStackNames) {
|
|
11875
11963
|
const stack = stacks.find((s) => s.stackName === stackName);
|
|
11876
11964
|
if (!stack) continue;
|
|
11877
|
-
const
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
const resource = stack.template.Resources?.[logicalId];
|
|
11900
|
-
if (!resource || resource.Type !== "AWS::Lambda::Function") continue;
|
|
11901
|
-
if (!envHasIntrinsicValue$1(getTemplateEnv$1(resource))) continue;
|
|
11902
|
-
const physicalId = loaded.resources[logicalId]?.physicalId;
|
|
11903
|
-
if (!physicalId) continue;
|
|
11904
|
-
const deployedEnv = await provider.resolveDeployedFunctionEnv(physicalId);
|
|
11905
|
-
if (deployedEnv) deployedEnvByLambda.set(logicalId, deployedEnv);
|
|
11906
|
-
}
|
|
11907
|
-
if (deployedEnvByLambda.size > 0) bundle.deployedEnvByLambda = deployedEnvByLambda;
|
|
11908
|
-
}
|
|
11909
|
-
if (stackHasIntrinsicEnv(stackName) && provider.resolveTemplateSsmParameters) {
|
|
11910
|
-
const ssmParameters = await provider.resolveTemplateSsmParameters(stack.template);
|
|
11911
|
-
if (Object.keys(ssmParameters.values).length > 0) bundle.ssmParameters = ssmParameters.values;
|
|
11912
|
-
if (ssmParameters.secureStringLogicalIds.length > 0) bundle.ssmSecureStringLogicalIds = ssmParameters.secureStringLogicalIds;
|
|
11913
|
-
}
|
|
11914
|
-
out.set(stackName, bundle);
|
|
11915
|
-
logger.debug(`${provider.label}: loaded state for ${displayStackName(stackName)} (${loaded.region})`);
|
|
11916
|
-
} finally {
|
|
11917
|
-
provider.dispose();
|
|
11965
|
+
const region = await resolveCfnFallbackRegion(options, stack.region);
|
|
11966
|
+
const providerFor = (workload) => createLocalStateProvider(options, stack.stackName, region, extraStateProviders, { workload });
|
|
11967
|
+
const stackLambdaIds = lambdaIds.filter((id) => stack.template.Resources?.[id]?.Type === "AWS::Lambda::Function");
|
|
11968
|
+
const groups = groupWorkloadsRoutedApart(stackLambdaIds, (logicalId) => ({
|
|
11969
|
+
logicalId,
|
|
11970
|
+
cdkPath: readCdkPathOrUndefined(stack.template.Resources[logicalId])
|
|
11971
|
+
}));
|
|
11972
|
+
const grouped = new Set(groups.flatMap((g) => g.items));
|
|
11973
|
+
const shared = await loadStackStateBundle(stack, providerFor(UNNAMED_WORKLOAD), {
|
|
11974
|
+
lambdaIds: stackLambdaIds.filter((id) => !grouped.has(id)),
|
|
11975
|
+
intrinsicEnv: stackHasIntrinsicEnv(stackName),
|
|
11976
|
+
options
|
|
11977
|
+
});
|
|
11978
|
+
const byLambda = /* @__PURE__ */ new Map();
|
|
11979
|
+
for (const group of groups) {
|
|
11980
|
+
const own = await loadStackStateBundle(stack, providerFor(group.workload), {
|
|
11981
|
+
lambdaIds: group.items,
|
|
11982
|
+
intrinsicEnv: stackHasIntrinsicEnv(stackName),
|
|
11983
|
+
options,
|
|
11984
|
+
...shared?.pseudoParameters && { pseudoParameters: shared.pseudoParameters }
|
|
11985
|
+
});
|
|
11986
|
+
if (own) for (const logicalId of group.items) byLambda.set(logicalId, own);
|
|
11918
11987
|
}
|
|
11988
|
+
const bundle = shared ?? (byLambda.size > 0 ? {
|
|
11989
|
+
state: {
|
|
11990
|
+
version: 1,
|
|
11991
|
+
stackName: stack.stackName,
|
|
11992
|
+
resources: {},
|
|
11993
|
+
outputs: {},
|
|
11994
|
+
lastModified: 0
|
|
11995
|
+
},
|
|
11996
|
+
withoutSharedState: true
|
|
11997
|
+
} : void 0);
|
|
11998
|
+
if (!bundle) continue;
|
|
11999
|
+
if (byLambda.size > 0) bundle.byLambda = byLambda;
|
|
12000
|
+
out.set(stackName, bundle);
|
|
11919
12001
|
}
|
|
11920
12002
|
return out;
|
|
11921
12003
|
}
|
|
12004
|
+
async function loadStackStateBundle(stack, provider, args) {
|
|
12005
|
+
if (!provider) return void 0;
|
|
12006
|
+
try {
|
|
12007
|
+
const loaded = await provider.load(stack.stackName, stack.region);
|
|
12008
|
+
if (!loaded) return void 0;
|
|
12009
|
+
const bundle = {
|
|
12010
|
+
state: {
|
|
12011
|
+
version: 1,
|
|
12012
|
+
stackName: stack.stackName,
|
|
12013
|
+
resources: loaded.resources,
|
|
12014
|
+
outputs: loaded.outputs,
|
|
12015
|
+
lastModified: 0
|
|
12016
|
+
},
|
|
12017
|
+
region: loaded.region
|
|
12018
|
+
};
|
|
12019
|
+
if (args.intrinsicEnv) {
|
|
12020
|
+
const pseudo = args.pseudoParameters ?? await resolvePseudoParametersForStartApi(loaded.region, args.options);
|
|
12021
|
+
if (pseudo) bundle.pseudoParameters = pseudo;
|
|
12022
|
+
}
|
|
12023
|
+
if (provider.resolveDeployedFunctionEnv) {
|
|
12024
|
+
const deployedEnvByLambda = /* @__PURE__ */ new Map();
|
|
12025
|
+
for (const logicalId of args.lambdaIds) {
|
|
12026
|
+
const resource = stack.template.Resources?.[logicalId];
|
|
12027
|
+
if (!resource || resource.Type !== "AWS::Lambda::Function") continue;
|
|
12028
|
+
if (!envHasIntrinsicValue$1(getTemplateEnv$1(resource))) continue;
|
|
12029
|
+
const physicalId = loaded.resources[logicalId]?.physicalId;
|
|
12030
|
+
if (!physicalId) continue;
|
|
12031
|
+
const deployedEnv = await provider.resolveDeployedFunctionEnv(physicalId);
|
|
12032
|
+
if (deployedEnv) deployedEnvByLambda.set(logicalId, deployedEnv);
|
|
12033
|
+
}
|
|
12034
|
+
if (deployedEnvByLambda.size > 0) bundle.deployedEnvByLambda = deployedEnvByLambda;
|
|
12035
|
+
}
|
|
12036
|
+
if (args.intrinsicEnv && provider.resolveTemplateSsmParameters) {
|
|
12037
|
+
const ssmParameters = await provider.resolveTemplateSsmParameters(stack.template);
|
|
12038
|
+
if (Object.keys(ssmParameters.values).length > 0) bundle.ssmParameters = ssmParameters.values;
|
|
12039
|
+
if (ssmParameters.secureStringLogicalIds.length > 0) bundle.ssmSecureStringLogicalIds = ssmParameters.secureStringLogicalIds;
|
|
12040
|
+
}
|
|
12041
|
+
getLogger().debug(`${provider.label}: loaded state for ${displayStackName(stack.stackName)} (${loaded.region})`);
|
|
12042
|
+
return bundle;
|
|
12043
|
+
} finally {
|
|
12044
|
+
provider.dispose();
|
|
12045
|
+
}
|
|
12046
|
+
}
|
|
11922
12047
|
async function resolvePseudoParametersForStartApi(stateRegion, options) {
|
|
11923
12048
|
const logger = getLogger();
|
|
11924
12049
|
const region = options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? stateRegion;
|
|
@@ -12352,11 +12477,17 @@ function getTemplateEnv(resource) {
|
|
|
12352
12477
|
if (!vars || typeof vars !== "object") return void 0;
|
|
12353
12478
|
return vars;
|
|
12354
12479
|
}
|
|
12480
|
+
function lambdaWorkload(lambda) {
|
|
12481
|
+
return {
|
|
12482
|
+
logicalId: lambda.logicalId,
|
|
12483
|
+
cdkPath: readCdkPathOrUndefined(lambda.resource)
|
|
12484
|
+
};
|
|
12485
|
+
}
|
|
12355
12486
|
function readEnvOverridesFile$3(filePath) {
|
|
12356
12487
|
if (!filePath) return void 0;
|
|
12357
12488
|
let raw;
|
|
12358
12489
|
try {
|
|
12359
|
-
raw =
|
|
12490
|
+
raw = readEnvVarsFileText(filePath);
|
|
12360
12491
|
} catch (err) {
|
|
12361
12492
|
throw new Error(`Failed to read --env-vars file '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
12362
12493
|
}
|
|
@@ -12409,7 +12540,10 @@ function applyProfileCredentialsOverlay(env, profileCreds, assumeRoleActive) {
|
|
|
12409
12540
|
else delete env["AWS_SESSION_TOKEN"];
|
|
12410
12541
|
}
|
|
12411
12542
|
async function resolveLambdaContainerEnv(lambda, options, profileCredentials, extraStateProviders) {
|
|
12412
|
-
const dynamicRefs = new DynamicReferenceResolver({
|
|
12543
|
+
const dynamicRefs = new DynamicReferenceResolver({
|
|
12544
|
+
...options.profile !== void 0 && { profile: options.profile },
|
|
12545
|
+
workload: lambdaWorkload(lambda)
|
|
12546
|
+
});
|
|
12413
12547
|
try {
|
|
12414
12548
|
return await resolveLambdaContainerEnvWith(lambda, options, profileCredentials, extraStateProviders, dynamicRefs);
|
|
12415
12549
|
} finally {
|
|
@@ -12428,7 +12562,7 @@ async function resolveLambdaContainerEnvWith(lambda, options, profileCredentials
|
|
|
12428
12562
|
const overriddenKeys = keysOverriddenBy(declaredEnv, (env) => resolveEnvVars$1(lambda.logicalId, lambdaCdkPath, env, overrides).resolved);
|
|
12429
12563
|
let templateEnv = declaredEnv && withoutKeys(declaredEnv, overriddenKeys);
|
|
12430
12564
|
let stateForRoleHint;
|
|
12431
|
-
const stateProvider = createLocalStateProvider(options, lambda.stack.stackName, await resolveCfnFallbackRegion(options, lambda.stack.region), extraStateProviders);
|
|
12565
|
+
const stateProvider = createLocalStateProvider(options, lambda.stack.stackName, await resolveCfnFallbackRegion(options, lambda.stack.region), extraStateProviders, { workload: lambdaWorkload(lambda) });
|
|
12432
12566
|
if (stateProvider) try {
|
|
12433
12567
|
const loaded = await stateProvider.load(lambda.stack.stackName, lambda.stack.region);
|
|
12434
12568
|
if (loaded) {
|
|
@@ -13565,7 +13699,7 @@ async function localInvokeAgentCoreCommand(target, options, extraStateProviders)
|
|
|
13565
13699
|
onMissing: () => new CdkLocalError(`${getEmbedConfig().cliName} invoke-agentcore requires a <target> (an AgentCore Runtime display path or logical ID). Run \`${getEmbedConfig().cliName} list\` to see them, or run it in a TTY to pick interactively.`, "LOCAL_INVOKE_AGENTCORE_TARGET_REQUIRED")
|
|
13566
13700
|
});
|
|
13567
13701
|
const candidate = pickAgentCoreCandidateStack(resolvedTarget, stacks);
|
|
13568
|
-
stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
13702
|
+
stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders, { workload: agentCoreTargetWorkload(resolvedTarget, stacks) });
|
|
13569
13703
|
const { context: imageContext, loaded: loadedState } = stateProvider && candidate ? await buildAgentCoreImageContext(candidate, stateProvider, options) : {
|
|
13570
13704
|
context: void 0,
|
|
13571
13705
|
loaded: void 0
|
|
@@ -13923,7 +14057,13 @@ function findFileAssetByObjectKey(fileAssets, hash) {
|
|
|
13923
14057
|
for (const asset of fileAssets.values()) if (Object.values(asset.destinations).some((d) => d.objectKey === zip || d.objectKey.endsWith(`/${zip}`))) return asset;
|
|
13924
14058
|
}
|
|
13925
14059
|
async function buildContainerEnv(resolved, options, profileCredentials, profileCredsFile, stateProvider, loaded, imageContext) {
|
|
13926
|
-
const dynamicRefs = new DynamicReferenceResolver({
|
|
14060
|
+
const dynamicRefs = new DynamicReferenceResolver({
|
|
14061
|
+
...options.profile !== void 0 && { profile: options.profile },
|
|
14062
|
+
workload: {
|
|
14063
|
+
logicalId: resolved.logicalId,
|
|
14064
|
+
cdkPath: readCdkPathOrUndefined(resolved.resource)
|
|
14065
|
+
}
|
|
14066
|
+
});
|
|
13927
14067
|
try {
|
|
13928
14068
|
return await buildContainerEnvWith(resolved, options, profileCredentials, profileCredsFile, stateProvider, loaded, imageContext, dynamicRefs);
|
|
13929
14069
|
} finally {
|
|
@@ -14269,7 +14409,7 @@ function readEnvOverridesFile$2(filePath) {
|
|
|
14269
14409
|
if (!filePath) return void 0;
|
|
14270
14410
|
let raw;
|
|
14271
14411
|
try {
|
|
14272
|
-
raw =
|
|
14412
|
+
raw = readEnvVarsFileText(filePath);
|
|
14273
14413
|
} catch (err) {
|
|
14274
14414
|
throw new Error(`Failed to read --env-vars file '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
14275
14415
|
}
|
|
@@ -14962,26 +15102,49 @@ var EcsSecretsResolutionError = class EcsSecretsResolutionError extends Error {
|
|
|
14962
15102
|
async function resolveEcsSecrets(entries, options = {}) {
|
|
14963
15103
|
if (entries.length === 0) return [];
|
|
14964
15104
|
const logger = getLogger().child("ecs-secrets");
|
|
14965
|
-
const
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
}
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
15105
|
+
const owned = [];
|
|
15106
|
+
const smClients = /* @__PURE__ */ new Map();
|
|
15107
|
+
const ssmClients = /* @__PURE__ */ new Map();
|
|
15108
|
+
const clientsFor = (containerName) => {
|
|
15109
|
+
const workload = { containerName };
|
|
15110
|
+
const smRoute = isAwsServiceRoutedToEmulator("SECRETS_MANAGER", workload);
|
|
15111
|
+
const ssmRoute = isAwsServiceRoutedToEmulator("SSM", workload);
|
|
15112
|
+
let secretsClient = options.secretsManagerClient ?? smClients.get(smRoute);
|
|
15113
|
+
if (!secretsClient) {
|
|
15114
|
+
secretsClient = new SecretsManagerClient({
|
|
15115
|
+
...workloadClientConfig({
|
|
15116
|
+
profile: options.profile,
|
|
15117
|
+
service: "SECRETS_MANAGER",
|
|
15118
|
+
workload
|
|
15119
|
+
}),
|
|
15120
|
+
...options.region && { region: options.region },
|
|
15121
|
+
...options.profile && { profile: options.profile }
|
|
15122
|
+
});
|
|
15123
|
+
smClients.set(smRoute, secretsClient);
|
|
15124
|
+
owned.push(secretsClient);
|
|
15125
|
+
}
|
|
15126
|
+
let ssmClient = options.ssmClient ?? ssmClients.get(ssmRoute);
|
|
15127
|
+
if (!ssmClient) {
|
|
15128
|
+
ssmClient = new SSMClient({
|
|
15129
|
+
...workloadClientConfig({
|
|
15130
|
+
profile: options.profile,
|
|
15131
|
+
service: "SSM",
|
|
15132
|
+
workload
|
|
15133
|
+
}),
|
|
15134
|
+
...options.region && { region: options.region },
|
|
15135
|
+
...options.profile && { profile: options.profile }
|
|
15136
|
+
});
|
|
15137
|
+
ssmClients.set(ssmRoute, ssmClient);
|
|
15138
|
+
owned.push(ssmClient);
|
|
15139
|
+
}
|
|
15140
|
+
return {
|
|
15141
|
+
secretsClient,
|
|
15142
|
+
ssmClient
|
|
15143
|
+
};
|
|
15144
|
+
};
|
|
14983
15145
|
try {
|
|
14984
15146
|
return await Promise.all(entries.map(async (entry) => {
|
|
15147
|
+
const { secretsClient, ssmClient } = clientsFor(entry.containerName);
|
|
14985
15148
|
const value = await resolveOne(entry, secretsClient, ssmClient);
|
|
14986
15149
|
logger.debug(`Resolved secret ${displayIdent(entry.containerName)}.${displayIdent(entry.name)} (${displayUntrustedValue(entry.valueFrom)})`);
|
|
14987
15150
|
return {
|
|
@@ -14990,8 +15153,7 @@ async function resolveEcsSecrets(entries, options = {}) {
|
|
|
14990
15153
|
};
|
|
14991
15154
|
}));
|
|
14992
15155
|
} finally {
|
|
14993
|
-
|
|
14994
|
-
if (ownsSsmClient) ssmClient.destroy();
|
|
15156
|
+
for (const c of owned) c.destroy();
|
|
14995
15157
|
}
|
|
14996
15158
|
}
|
|
14997
15159
|
async function resolveOne(entry, secretsClient, ssmClient) {
|
|
@@ -15183,7 +15345,8 @@ async function runEcsTask(task, options, state) {
|
|
|
15183
15345
|
region: firstUsableRegion(options.stackRegion, task.stack.region, options.region),
|
|
15184
15346
|
label: `Container ${c.name}`,
|
|
15185
15347
|
skipKeys: new Set(Object.keys(c.environment).filter((k) => !tokenKeys.has(k))),
|
|
15186
|
-
resolver: dynamicRefs
|
|
15348
|
+
resolver: dynamicRefs,
|
|
15349
|
+
workload: { containerName: c.name }
|
|
15187
15350
|
}));
|
|
15188
15351
|
}
|
|
15189
15352
|
} finally {
|
|
@@ -16622,10 +16785,10 @@ const defaultDockerStartImpl = async (containerId, opts = {}) => {
|
|
|
16622
16785
|
const { getDockerCmd } = await import("./docker-cmd-Cjg3jGYF.js").then((n) => n.t);
|
|
16623
16786
|
await promisify(execFile)(getDockerCmd(), ["start", containerId]);
|
|
16624
16787
|
if (opts.joinedForwarder) return;
|
|
16625
|
-
const { getActiveWorkloadAwsWiring } = await import("./workload-identity-
|
|
16788
|
+
const { getActiveWorkloadAwsWiring } = await import("./workload-identity-BOEZuEDO.js").then((n) => n.R);
|
|
16626
16789
|
const wiring = getActiveWorkloadAwsWiring();
|
|
16627
16790
|
if (wiring) {
|
|
16628
|
-
const { attachLoopbackForwarder } = await import("./docker-runner-
|
|
16791
|
+
const { attachLoopbackForwarder } = await import("./docker-runner-B3OunVKV.js").then((n) => n.o);
|
|
16629
16792
|
await attachLoopbackForwarder(containerId, wiring);
|
|
16630
16793
|
}
|
|
16631
16794
|
};
|
|
@@ -19506,13 +19669,13 @@ async function loadAssetContextForTarget(args) {
|
|
|
19506
19669
|
}
|
|
19507
19670
|
async function rollOneTarget(args) {
|
|
19508
19671
|
const { signal, controller, newBoot, stacks, options, discovery, skipPull, extraStateProviders, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, verdict, imageOverrideTag, logger } = args;
|
|
19509
|
-
const
|
|
19510
|
-
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
19672
|
+
const { stateProvider, stateProviderFor } = await createTargetStateProviders(newBoot.target, stacks, options, extraStateProviders);
|
|
19511
19673
|
try {
|
|
19512
19674
|
let resolved;
|
|
19513
19675
|
try {
|
|
19514
19676
|
resolved = await resolveServiceAndRunnerOpts(newBoot, stacks, options, discovery, skipPull, stateProvider, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, {
|
|
19515
19677
|
quiet: true,
|
|
19678
|
+
stateProviderFor,
|
|
19516
19679
|
...imageOverrideTag !== void 0 && { imageOverrideTag }
|
|
19517
19680
|
});
|
|
19518
19681
|
} catch (err) {
|
|
@@ -19559,23 +19722,28 @@ async function rollOneTarget(args) {
|
|
|
19559
19722
|
}
|
|
19560
19723
|
}
|
|
19561
19724
|
async function bootOneTarget(boot, runState, stacks, options, discovery, skipPull, extraStateProviders, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, imageOverrideTag) {
|
|
19562
|
-
const
|
|
19563
|
-
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
19725
|
+
const { stateProvider, stateProviderFor } = await createTargetStateProviders(boot.target, stacks, options, extraStateProviders);
|
|
19564
19726
|
try {
|
|
19565
|
-
return await runOneTarget(boot, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, imageOverrideTag);
|
|
19727
|
+
return await runOneTarget(boot, runState, stacks, options, discovery, skipPull, stateProvider, stateProviderFor, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, imageOverrideTag);
|
|
19566
19728
|
} finally {
|
|
19567
19729
|
if (stateProvider) stateProvider.dispose();
|
|
19568
19730
|
}
|
|
19569
19731
|
}
|
|
19570
|
-
async function runOneTarget(boot, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, imageOverrideTag) {
|
|
19571
|
-
const { service, runnerOpts } = await resolveServiceAndRunnerOpts(boot, stacks, options, discovery, skipPull, stateProvider, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning,
|
|
19732
|
+
async function runOneTarget(boot, runState, stacks, options, discovery, skipPull, stateProvider, stateProviderFor, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, imageOverrideTag) {
|
|
19733
|
+
const { service, runnerOpts } = await resolveServiceAndRunnerOpts(boot, stacks, options, discovery, skipPull, stateProvider, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, {
|
|
19734
|
+
stateProviderFor,
|
|
19735
|
+
...imageOverrideTag !== void 0 && { imageOverrideTag }
|
|
19736
|
+
});
|
|
19572
19737
|
return startEcsService(service, runnerOpts, runState);
|
|
19573
19738
|
}
|
|
19574
19739
|
async function resolveServiceAndRunnerOpts(boot, stacks, options, discovery, skipPull, stateProvider, profileCredsFile, frontDoorPools, suppressLoadBalancerWarning, opts = {}) {
|
|
19575
19740
|
const logger = getLogger();
|
|
19576
19741
|
const target = boot.target;
|
|
19577
19742
|
const quiet = opts.quiet === true;
|
|
19578
|
-
const imageContext = await buildEcsImageResolutionContext$1(target, stacks, options, stateProvider,
|
|
19743
|
+
const imageContext = await buildEcsImageResolutionContext$1(target, stacks, options, stateProvider, {
|
|
19744
|
+
...opts.imageOverrideTag !== void 0 && { imageOverridden: true },
|
|
19745
|
+
...opts.stateProviderFor && { stateProviderFor: opts.stateProviderFor }
|
|
19746
|
+
});
|
|
19579
19747
|
const service = resolveEcsServiceTarget(target, stacks, imageContext, { suppressLoadBalancerWarning });
|
|
19580
19748
|
const representative = service.task.containers.find((c) => c.essential) ?? service.task.containers[0];
|
|
19581
19749
|
assertEcsTaskImagesResolvable(service.task, new Set(opts.imageOverrideTag !== void 0 && representative ? [representative.name] : []));
|
|
@@ -19586,27 +19754,11 @@ async function resolveServiceAndRunnerOpts(boot, stacks, options, discovery, ski
|
|
|
19586
19754
|
if (stateProvider && taskNeeds.needsCrossStackResolver) {
|
|
19587
19755
|
const consumerRegion = options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? service.stack.region ?? "us-east-1";
|
|
19588
19756
|
const resolver = await stateProvider.buildCrossStackResolver(consumerRegion);
|
|
19589
|
-
if (resolver) {
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
...imageContext?.stateParameters && { parameters: imageContext.stateParameters },
|
|
19595
|
-
...imageContext?.stateSensitiveParameters?.length && { sensitiveParameters: new Set(imageContext.stateSensitiveParameters) },
|
|
19596
|
-
consumerRegion,
|
|
19597
|
-
crossStackResolver: resolver,
|
|
19598
|
-
resolveDynamicReferences: (value, producerRegion) => dynamicRefs.resolveString(value, {
|
|
19599
|
-
region: producerRegion,
|
|
19600
|
-
consumer: `Task ${service.task.taskDefinitionLogicalId} cross-stack env value`,
|
|
19601
|
-
overridable: false
|
|
19602
|
-
})
|
|
19603
|
-
};
|
|
19604
|
-
try {
|
|
19605
|
-
await applyCrossStackResolverToTask(service.task, subContext);
|
|
19606
|
-
} finally {
|
|
19607
|
-
dynamicRefs.dispose();
|
|
19608
|
-
}
|
|
19609
|
-
}
|
|
19757
|
+
if (resolver) await applyCrossStackValuesToTask(service.task, resolver, {
|
|
19758
|
+
imageContext,
|
|
19759
|
+
consumerRegion,
|
|
19760
|
+
profile: options.profile
|
|
19761
|
+
});
|
|
19610
19762
|
} else if (!stateProvider && taskNeeds.needsCrossStackResolver) logger.warn("Container Environment / Secrets entries contain Fn::ImportValue / Fn::GetStackOutput intrinsics. Pass a state-source flag (e.g. --from-cfn-stack or a host-provided extension) to substitute them against deployed state.");
|
|
19611
19763
|
const effectiveAssumeRole = resolveEcsAssumeRoleOption(options);
|
|
19612
19764
|
let assumedCredentials;
|
|
@@ -19978,6 +20130,63 @@ async function assumeTaskRole$1(roleArn, region, profile) {
|
|
|
19978
20130
|
makeError: (message) => new LocalStartServiceError(message)
|
|
19979
20131
|
});
|
|
19980
20132
|
}
|
|
20133
|
+
async function createTargetStateProviders(target, stacks, options, extraStateProviders) {
|
|
20134
|
+
const candidate = pickCandidateStack$1(target, stacks);
|
|
20135
|
+
const region = await resolveCfnFallbackRegion(options, candidate?.region);
|
|
20136
|
+
const stateProviderFor = (workload) => createLocalStateProvider(options, candidate?.stackName ?? "", region, extraStateProviders, { workload });
|
|
20137
|
+
return {
|
|
20138
|
+
stateProvider: stateProviderFor(UNNAMED_WORKLOAD),
|
|
20139
|
+
stateProviderFor
|
|
20140
|
+
};
|
|
20141
|
+
}
|
|
20142
|
+
function ecsContainerNamesOf(stack) {
|
|
20143
|
+
const names = /* @__PURE__ */ new Set();
|
|
20144
|
+
for (const resource of Object.values(stack.template.Resources ?? {})) {
|
|
20145
|
+
if (resource?.Type !== "AWS::ECS::TaskDefinition") continue;
|
|
20146
|
+
const defs = resource.Properties?.["ContainerDefinitions"];
|
|
20147
|
+
if (!Array.isArray(defs)) continue;
|
|
20148
|
+
for (const def of defs) {
|
|
20149
|
+
const name = def?.["Name"];
|
|
20150
|
+
if (typeof name === "string" && name !== "") names.add(name);
|
|
20151
|
+
}
|
|
20152
|
+
}
|
|
20153
|
+
return [...names];
|
|
20154
|
+
}
|
|
20155
|
+
async function loadMixedModeContainerStates(ctx, stack, stateProviderFor) {
|
|
20156
|
+
const groups = groupWorkloadsRoutedApart(ecsContainerNamesOf(stack), (containerName) => ({ containerName }));
|
|
20157
|
+
if (groups.length === 0) return;
|
|
20158
|
+
const containerStates = {};
|
|
20159
|
+
for (const group of groups) {
|
|
20160
|
+
const provider = stateProviderFor(group.workload);
|
|
20161
|
+
if (!provider) continue;
|
|
20162
|
+
try {
|
|
20163
|
+
const state = {};
|
|
20164
|
+
const loaded = await provider.load(stack.stackName, stack.region);
|
|
20165
|
+
if (loaded) state.stateResources = loaded.resources;
|
|
20166
|
+
else {
|
|
20167
|
+
const loadError = provider.getLastLoadError?.();
|
|
20168
|
+
if (loadError) state.stateLoadFailureMessage = loadError;
|
|
20169
|
+
}
|
|
20170
|
+
if (provider.resolveTemplateSsmParameters) {
|
|
20171
|
+
const ssm = await provider.resolveTemplateSsmParameters(stack.template);
|
|
20172
|
+
if (Object.keys(ssm.values).length > 0) state.stateParameters = ssm.values;
|
|
20173
|
+
if (ssm.secureStringLogicalIds.length > 0) state.stateSensitiveParameters = ssm.secureStringLogicalIds;
|
|
20174
|
+
}
|
|
20175
|
+
for (const name of group.items) defineOwnState(containerStates, name, state);
|
|
20176
|
+
} finally {
|
|
20177
|
+
provider.dispose();
|
|
20178
|
+
}
|
|
20179
|
+
}
|
|
20180
|
+
ctx.containerStates = containerStates;
|
|
20181
|
+
}
|
|
20182
|
+
function defineOwnState(map, key, value) {
|
|
20183
|
+
Object.defineProperty(map, key, {
|
|
20184
|
+
value,
|
|
20185
|
+
enumerable: true,
|
|
20186
|
+
writable: true,
|
|
20187
|
+
configurable: true
|
|
20188
|
+
});
|
|
20189
|
+
}
|
|
19981
20190
|
async function buildEcsImageResolutionContext$1(target, stacks, options, stateProvider, opts = {}) {
|
|
19982
20191
|
const logger = getLogger();
|
|
19983
20192
|
const candidate = pickCandidateStack$1(target, stacks);
|
|
@@ -20018,6 +20227,7 @@ async function buildEcsImageResolutionContext$1(target, stacks, options, statePr
|
|
|
20018
20227
|
if (Object.keys(ssmParameters.values).length > 0) ctx.stateParameters = ssmParameters.values;
|
|
20019
20228
|
if (ssmParameters.secureStringLogicalIds.length > 0) ctx.stateSensitiveParameters = ssmParameters.secureStringLogicalIds;
|
|
20020
20229
|
}
|
|
20230
|
+
if (needs.needsEnvOrSecretSubstitution && opts.stateProviderFor) await loadMixedModeContainerStates(ctx, candidate, opts.stateProviderFor);
|
|
20021
20231
|
} else if (!stateProvider && needs.needsStateResources) {
|
|
20022
20232
|
if (!opts.suppressStateWarning && !opts.imageOverridden) logger.warn("Container Image references a same-stack AWS::ECR::Repository. Pass a state-source flag (e.g. --from-cfn-stack or a host-provided extension) to substitute the deployed repository URI, or --image-override to build it from a local Dockerfile.");
|
|
20023
20233
|
} else if (!stateProvider && needs.needsEnvOrSecretSubstitution) {
|
|
@@ -20053,7 +20263,7 @@ function readEnvOverridesFile$1(filePath) {
|
|
|
20053
20263
|
if (!filePath) return void 0;
|
|
20054
20264
|
let raw;
|
|
20055
20265
|
try {
|
|
20056
|
-
raw =
|
|
20266
|
+
raw = readEnvVarsFileText(filePath);
|
|
20057
20267
|
} catch (err) {
|
|
20058
20268
|
throw new LocalStartServiceError(`Failed to read --env-vars file '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
20059
20269
|
}
|
|
@@ -20133,7 +20343,7 @@ async function resolveAndBuildImageOverrides(args) {
|
|
|
20133
20343
|
const resolvedForPeek = [];
|
|
20134
20344
|
for (const target of perTarget) {
|
|
20135
20345
|
const candidate = pickCandidateStack$1(target, stacks);
|
|
20136
|
-
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
20346
|
+
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders, { workload: UNNAMED_WORKLOAD });
|
|
20137
20347
|
let imageContext;
|
|
20138
20348
|
let service;
|
|
20139
20349
|
try {
|
|
@@ -20286,35 +20496,21 @@ async function localRunTaskCommand(target, options, extraStateProviders) {
|
|
|
20286
20496
|
onMissing: () => new CdkLocalError(`${getEmbedConfig().cliName} run-task requires a <target> (an ECS task definition display path or logical ID). Run \`${getEmbedConfig().cliName} list\` to see them, or run it in a TTY to pick interactively.`, "LOCAL_RUN_TASK_TARGET_REQUIRED")
|
|
20287
20497
|
});
|
|
20288
20498
|
const candidate = pickCandidateStack(resolvedTarget, stacks);
|
|
20289
|
-
|
|
20290
|
-
const
|
|
20499
|
+
const stateRegion = await resolveCfnFallbackRegion(options, candidate?.region);
|
|
20500
|
+
const stateProviderFor = (workload) => createLocalStateProvider(options, candidate?.stackName ?? "", stateRegion, extraStateProviders, { workload });
|
|
20501
|
+
stateProvider = stateProviderFor(UNNAMED_WORKLOAD);
|
|
20502
|
+
const imageContext = await buildEcsImageResolutionContext(candidate, stateProvider, options, stateProviderFor);
|
|
20291
20503
|
const task = resolveEcsTaskTarget(resolvedTarget, stacks, imageContext);
|
|
20292
20504
|
logger.info(`Target: ${displayStackName(`${task.stack.stackName}/${task.taskDefinitionLogicalId}`)} (family=${displayIdent(task.family)}, containers=${task.containers.length})`);
|
|
20293
20505
|
const taskNeeds = detectEcsImageResolutionNeeds(stacks.find((s) => s.stackName === task.stack.stackName) ?? task.stack);
|
|
20294
20506
|
if (stateProvider && taskNeeds.needsCrossStackResolver) {
|
|
20295
20507
|
const consumerRegion = options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"] ?? task.stack.region ?? "us-east-1";
|
|
20296
20508
|
const resolver = await stateProvider.buildCrossStackResolver(consumerRegion);
|
|
20297
|
-
if (resolver) {
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
|
|
20302
|
-
...imageContext?.stateParameters && { parameters: imageContext.stateParameters },
|
|
20303
|
-
...imageContext?.stateSensitiveParameters?.length && { sensitiveParameters: new Set(imageContext.stateSensitiveParameters) },
|
|
20304
|
-
consumerRegion,
|
|
20305
|
-
crossStackResolver: resolver,
|
|
20306
|
-
resolveDynamicReferences: (value, producerRegion) => dynamicRefs.resolveString(value, {
|
|
20307
|
-
region: producerRegion,
|
|
20308
|
-
consumer: `Task ${task.taskDefinitionLogicalId} cross-stack env value`,
|
|
20309
|
-
overridable: false
|
|
20310
|
-
})
|
|
20311
|
-
};
|
|
20312
|
-
try {
|
|
20313
|
-
await applyCrossStackResolverToTask(task, subContext);
|
|
20314
|
-
} finally {
|
|
20315
|
-
dynamicRefs.dispose();
|
|
20316
|
-
}
|
|
20317
|
-
}
|
|
20509
|
+
if (resolver) await applyCrossStackValuesToTask(task, resolver, {
|
|
20510
|
+
imageContext,
|
|
20511
|
+
consumerRegion,
|
|
20512
|
+
profile: options.profile
|
|
20513
|
+
});
|
|
20318
20514
|
} else if (!stateProvider && taskNeeds.needsCrossStackResolver) logger.warn("Container Environment / Secrets entries contain Fn::ImportValue / Fn::GetStackOutput intrinsics. Pass a state-source flag (e.g. --from-cfn-stack or a host-provided extension) to substitute them against deployed state.");
|
|
20319
20515
|
const onSignal = createShutdownSignalHandler({
|
|
20320
20516
|
cleanup,
|
|
@@ -20445,7 +20641,7 @@ async function assumeTaskRole(roleArn, region, profile) {
|
|
|
20445
20641
|
sessionNameSuffix: "run-task"
|
|
20446
20642
|
});
|
|
20447
20643
|
}
|
|
20448
|
-
async function buildEcsImageResolutionContext(candidate, stateProvider, options) {
|
|
20644
|
+
async function buildEcsImageResolutionContext(candidate, stateProvider, options, stateProviderFor) {
|
|
20449
20645
|
const logger = getLogger();
|
|
20450
20646
|
if (!candidate) return void 0;
|
|
20451
20647
|
const needs = detectEcsImageResolutionNeeds(candidate);
|
|
@@ -20484,6 +20680,7 @@ async function buildEcsImageResolutionContext(candidate, stateProvider, options)
|
|
|
20484
20680
|
if (Object.keys(ssmParameters.values).length > 0) ctx.stateParameters = ssmParameters.values;
|
|
20485
20681
|
if (ssmParameters.secureStringLogicalIds.length > 0) ctx.stateSensitiveParameters = ssmParameters.secureStringLogicalIds;
|
|
20486
20682
|
}
|
|
20683
|
+
if (needs.needsEnvOrSecretSubstitution && stateProviderFor) await loadMixedModeContainerStates(ctx, candidate, stateProviderFor);
|
|
20487
20684
|
} else if (!stateProvider && needs.needsStateResources) {
|
|
20488
20685
|
if (!options.imageOverride?.length) logger.warn("Container Image references a same-stack AWS::ECR::Repository. Pass a state-source flag (e.g. --from-cfn-stack or a host-provided extension) to substitute the deployed repository URI, or --image-override to build it from a local Dockerfile. Otherwise the resolver will surface its existing error.");
|
|
20489
20686
|
} else if (!stateProvider && needs.needsEnvOrSecretSubstitution) logger.warn("Container Environment / Secrets entries contain CloudFormation intrinsics (Ref / Fn::GetAtt / Fn::Sub / Fn::Join). Pass a state-source flag (e.g. --from-cfn-stack or a host-provided extension) to substitute them against deployed state. Without a state source these entries are dropped (per-key warnings will follow).");
|
|
@@ -20509,7 +20706,7 @@ function readEnvOverridesFile(filePath) {
|
|
|
20509
20706
|
if (!filePath) return void 0;
|
|
20510
20707
|
let raw;
|
|
20511
20708
|
try {
|
|
20512
|
-
raw =
|
|
20709
|
+
raw = readEnvVarsFileText(filePath);
|
|
20513
20710
|
} catch (err) {
|
|
20514
20711
|
throw new Error(`Failed to read --env-vars file '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
20515
20712
|
}
|
|
@@ -25070,7 +25267,7 @@ async function localStartAgentCoreCommand(target, options, extraStateProviders,
|
|
|
25070
25267
|
});
|
|
25071
25268
|
const candidate = pickAgentCoreCandidateStack(resolvedTarget, stacks);
|
|
25072
25269
|
if (candidate) checkSelectedStacks?.([candidate.stackName]);
|
|
25073
|
-
stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
25270
|
+
stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders, { workload: agentCoreTargetWorkload(resolvedTarget, stacks) });
|
|
25074
25271
|
const { context: imageContext, loaded: loadedState } = stateProvider && candidate ? await buildAgentCoreImageContext(candidate, stateProvider, options) : {
|
|
25075
25272
|
context: void 0,
|
|
25076
25273
|
loaded: void 0
|
|
@@ -31571,7 +31768,7 @@ async function prepareEcsImageContexts(args) {
|
|
|
31571
31768
|
}
|
|
31572
31769
|
rejectExplicitCfnStackWithMultipleStacks(options, owningStacks.length);
|
|
31573
31770
|
for (const stack of owningStacks) {
|
|
31574
|
-
const stateProvider = createLocalStateProvider(options, stack.stackName, await resolveCfnFallbackRegion(options, stack.region));
|
|
31771
|
+
const stateProvider = createLocalStateProvider(options, stack.stackName, await resolveCfnFallbackRegion(options, stack.region), void 0, { workload: UNNAMED_WORKLOAD });
|
|
31575
31772
|
try {
|
|
31576
31773
|
const ctx = await buildEcsImageResolutionContext(stack, stateProvider, options);
|
|
31577
31774
|
contextByStack.set(stack.stackName, ctx);
|
|
@@ -31948,5 +32145,5 @@ function addStudioSpecificOptions(cmd) {
|
|
|
31948
32145
|
}
|
|
31949
32146
|
|
|
31950
32147
|
//#endregion
|
|
31951
|
-
export { postHook as $,
|
|
31952
|
-
//# sourceMappingURL=local-studio-
|
|
32148
|
+
export { postHook as $, withoutKeys as $a, buildConnectEvent as $i, addImageOverrideOptions as $n, addStartApiSpecificOptions as $r, classifyS3Error as $t, microvmFidelityWarnings as A, filterWebSocketApisByIdentifiers as Aa, buildCorsConfigByApiId as Ai, stripCloudFrontImport as An, A2A_CONTAINER_PORT as Ar, readContainerLogTail as At, MICROVM_WS_BASE_PROTOCOL as B, AGENTCORE_RUNTIME_TYPE as Ba, pickResponseTemplate as Bi, createLocalStartAlbCommand as Bn, AGENTCORE_SESSION_ID_HEADER as Br, parseWebFunctionBuildConfig as Bt, addListSpecificOptions as C, resolveWatchConfig as Ca, buildMethodArn as Ci, WEB_FUNCTION_REVISION_TYPE as Cn, setShadowReadyTimeoutMs as Cr, parseKvsFileOverrides as Ct, buildMicrovmLambdaView as D, availableWebSocketApiIdentifiers as Da, invokeTokenAuthorizer as Di, compileCloudFrontFunction as Dn, createLocalInvokeAgentCoreCommand as Dr, WEB_FUNCTION_CONTAINER_PORT as Dt, addStartMicrovmSpecificOptions as E, listTargets as Ea, invokeRequestAuthorizer as Ei, resolveWebFunctionTarget as En, addInvokeAgentCoreSpecificOptions as Er, RecentOutput as Et, microvmImageTag as F, resolveLambdaArnIntrinsic as Fa, translateLambdaResponse as Fi, findFileAssetForObjectKey as Fn, MCP_PROTOCOL_VERSION as Fr, buildNodeEntryFileStart as Ft, startMicrovmFrontDoor as G, DynamicReferenceResolver as Ga, HOST_GATEWAY_MIN_VERSION as Gi, addStartServiceSpecificOptions as Gn, SUPPORTED_CODE_RUNTIMES as Gr, readWebFunctionServiceConfig as Gt, PROXY_PORT_HEADER as H, pickAgentCoreCandidateStack as Ha, tryParseStatus as Hi, resolveAlbTarget as Hn, waitForAgentCoreHttpReady as Hr, WEB_FUNCTION_HTTP_ENDPOINT_ENV as Ht, planMicrovmPorts as I, AGENTCORE_A2A_PROTOCOL as Ia, applyAuthorizerOverlay as Ii, isBucketDeploymentResource as In, mcpInvokeOnce as Ir, defaultWebFunctionPlatform as It, MICROVM_HOOK_PATH_PREFIX as J, firstUsableRegion as Ja, bufferToBody as Ji, addRunTaskSpecificOptions as Jn, renderCodeDockerfile as Jr, idFromArn as Jt, stripMicrovmProxyHeaders as K, containsDynamicReference as Ka, probeHostGatewaySupport as Ki, createLocalStartServiceCommand as Kn, buildAgentCoreCodeImage as Kr, webFunctionAssumeRole as Kt, readExposedPorts as L, AGENTCORE_AGUI_PROTOCOL as La, buildHttpApiV2Event as Li, resolveBucketDeploymentObjectKey as Ln, parseSseForJsonRpc as Lr, resolveWebFunctionRuntime as Lt, DEFAULT_TERMINATE_HOOK_TIMEOUT_MS as M, webSocketApiMatchesIdentifier as Ma, isFunctionUrlOacFronted as Mi, createLocalFileKvsDataSource as Mn, a2aInvokeOnce as Mr, waitForWebFunctionReady as Mt, LocalMicrovm as N, discoverRoutes as Na, matchPreflight as Ni, createUnboundCloudFrontModule as Nn, MCP_CONTAINER_PORT as Nr, watchContainerExit as Nt, createLocalStartMicrovmCommand as O, discoverWebSocketApis as Oa, attachAuthorizers as Oi, runViewerRequest as On, bridgeAgentCoreWs as Or, containerFailure as Ot, buildMicrovmImage as P, pickRefLogicalId as Pa, matchRoute as Pi, bucketDeploymentSourceObjectKeys as Pn, MCP_PATH as Pr, WEB_FUNCTION_RUNTIMES as Pt, pollBuildHook as Q, resolveDynamicReferencesInEnv as Qa, parseConnectionsPath as Qi, addEcsAssumeRoleOptions as Qn, createLocalInvokeCommand as Qr, resolveDeployedOriginBucket as Qt, setContainerPaused as R, AGENTCORE_HTTP_PROTOCOL as Ra, buildRestV1Event as Ri, addAlbSpecificOptions as Rn, AGENTCORE_SIGV4_SERVICE as Rr, supportedWebFunctionRuntimes as Rt, StudioEventBus as S, resolveSsmParameters as Sa, verifyJwtViaDiscovery as Si, WEB_FUNCTION_ENDPOINT_TYPE as Sn, SOFT_RELOAD_COMPLETION_LOG_SUFFIX as Sr, normalizeKvsFileKeys as St, formatTargetListing as T, countTargets as Ta, evaluateCachedLambdaPolicy as Ti, WebFunctionResolutionError as Tn, attachContainerLogStreamer as Tr, resolveCloudFrontTarget as Tt, rewriteUpgradeResponseHead as U, resolveAgentCoreTarget as Ua, VtlEvaluationError as Ui, isApplicationLoadBalancer as Un, waitForAgentCorePing as Ur, buildWebFunctionLambdaView as Ut, MicrovmStateError as V, AgentCoreResolutionError as Va, selectIntegrationResponse as Vi, parseLbPortOverrides as Vn, invokeAgentCore as Vr, resolveWebFunctionArtifact as Vt, selectTargetPort as W, DynamicReferenceResolutionError as Wa, HOST_DOCKER_INTERNAL_GATEWAY as Wi, resolveAlbFrontDoor as Wn, downloadAndExtractS3Bundle as Wr, finalizeWebFunctionEnv as Wt, callRuntimeHook as X, keysOverriddenBy as Xa, buildMgmtEndpointEnvUrl as Xi, MAX_TASKS_SUBNET_RANGE_CAP as Xn, classifySourceChange as Xr, createDeployedKvsDataSource as Xt, MicrovmHookError as Y, keysNotFromTemplate as Ya, ConnectionRegistry as Yi, createLocalRunTaskCommand as Yn, toCmdArgv as Yr, resolveKvsModulesForDistribution as Yt, generateMicrovmId as Z, parseDynamicReference as Za, handleConnectionsRequest as Zi, addCommonEcsServiceOptions as Zn, addInvokeSpecificOptions as Zr, resolveDeployedKvsArnByName as Zt, filterStudioTargetGroups as _, resolveCfnFallbackRegion as _a, buildCognitoJwksUrl as _i, pickKvsLogicalIdFromArn as _n, isLocalCdkAssetImage as _r, attachAgentCoreWsBridge as _t, createLocalStudioCommand as a, EcsTaskResolutionError as aa, attachStageContext as ai, serveLambdaUrlOrigin as an, resolveSharedSidecarCredentials as ar, disposeMicrovmCodeArtifact as at, renderStudioHtml as b, CfnLocalStateProvider as ba, verifyCognitoJwt as bi, pickWebFunctionEndpointLogicalIdFromOrigin as bn, CloudMapRegistry as br, addStartCloudFrontSpecificOptions as bt, startStudioProxy as c, substituteAgainstStateAsync as ca, availableApiIdentifiers as ci, buildEdgeRequestEvent as cn, buildImageOverrideTag as cr, resolveMicrovmImageTarget as ct, createStudioDispatcher as d, LocalStateSourceError as da, groupRoutesByServer as di, httpHeadersToEdge as dn, mergeForService as dr, createLocalStartWebFunctionCommand as dt, buildDisconnectEvent as ea, createLocalStartApiCommand as ei, createS3OriginReader as en, addAwsEndpointOptions as eo, buildEcsImageResolutionContext$1 as er, runHookBody as et, filterStudioCustomResources as f, UNNAMED_WORKLOAD as fa, readMtlsMaterialsFromDisk as fi, CLOUDFRONT_DISTRIBUTION_TYPE as fn, parseImageOverrideFlags as fr, addStartAgentCoreSpecificOptions as ft, annotatePinnedEcsTargets as g, rejectExplicitCfnStackWithMultipleStacks as ga, defaultCredentialsLoader as gi, pickFunctionUrlLogicalIdFromOrigin as gn, imageOverrideKeyAliases as gr, startAgentCoreHttpServer as gt, annotateEcsTaskPinnedTargets as h, isCfnFlagPresent as ha, resolveServiceIntegrationParameters as hi, isCloudFrontDistribution as hn, describePinnedImageUri as hr, selectServeInboundAuth as ht, coerceStopRequest as i, resolveRuntimeImage as ia, createFileWatcher as ii, serveFromStaticOrigin as in, resolveEcsAssumeRoleOption as ir, MicrovmResolutionError as it, readRunHookPayload as j, parseSelectionExpressionPath as ja, buildCorsConfigFromCloudFrontChain as ji, createCloudFrontModule as jn, A2A_PATH as jr, startWebFunctionContainer as jt, finalizeMicrovmEnv as k, discoverWebSocketApisOrThrow as ka, applyCorsResponseHeaders as ki, runViewerResponse as kn, invokeAgentCoreWs as kr, planWebFunctionContainer as kt, relayServeRequest as l, substituteEnvVarsFromState as la, filterRoutesByApiIdentifier as li, buildEdgeResponseEvent as ln, canonicalizeImageOverrideKeys as lr, s3KeyOfUri as lt, annotateAlbPinnedBackingServices as m, groupWorkloadsRoutedApart as ma, resolveSelectionExpression as mi, extractKvsAssociations as mn, runImageOverrideBuilds as mr, buildAgentCoreServeAuthCheck as mt, coerceRunRequest as n, resolveRuntimeCodeMountPath as na, resolveApiTargetSubset as ni, startCloudFrontServer as nn, parseMaxTasks as nr, MICROVM_DEFAULT_INGRESS_PORT as nt, resolveServeBaseUrl as o, assertEcsTaskImagesResolvable as oa, buildStageMap as oi, applyEdgeRequestResult as on, runEcsServiceEmulator as or, readMicrovmImageConfig as ot, isCustomResourceLambdaTarget as p, createLocalStateProvider as pa, startApiServer as pi, describeS3OriginDomain as pn, resolveImageOverrides as pr, createLocalStartAgentCoreCommand as pt, MAX_RUN_HOOK_PAYLOAD_BYTES as q, deployedFillMayBeSecret as qa, resolveHostGatewayExtraHosts as qi, serviceStrategy as qn, computeCodeImageTag as qr, webFunctionFidelityWarnings as qt, coerceServeRequest as r, resolveRuntimeFileExtension as ra, createAuthorizerCache as ri, resolveErrorResponseCandidates as rn, parseRestartPolicy as rr, MICROVM_IMAGE_TYPE as rt, createStudioServeManager as s, substituteAgainstState as sa, materializeLayerFromArn as si, applyEdgeResponseResult as sn, ImageOverrideError as sr, resolveMicrovmCodeArtifact as st, addStudioSpecificOptions as t, buildMessageEvent as ta, createWatchPredicates as ti, matchBehavior as tn, awsEndpointOptions as to, ecsClusterOption as tr, waitForAppAnswer as tt, reinvoke as u, substituteEnvVarsFromStateAsync as ua, filterRoutesByApiIdentifiers as ui, edgeHeadersToHttp as un, enforceImageOverrideOrphans as ur, addStartWebFunctionSpecificOptions as ut, startStudioServer as v, resolveCfnRegion as va, buildJwksUrlFromIssuer as vi, pickLambdaEdgeFunctionLogicalId as vn, listPinnedTargets as vr, startAgentCoreWsBridge as vt, createLocalListCommand as w, resolveSingleTarget as wa, computeRequestIdentityHash as wi, WEB_FUNCTION_TYPE as wn, getContainerNetworkIp as wr, parseOriginOverrides as wt, createStudioStore as x, collectSsmParameterRefs as xa, verifyJwtAuthorizer as xi, resolveCloudFrontDistribution as xn, DEFAULT_SHADOW_READY_TIMEOUT_MS as xr, createLocalStartCloudFrontCommand as xt, toStudioTargetGroups as y, resolveCfnStackName as ya, createJwksCache as yi, pickTargetFunctionLogicalId as yn, buildCloudMapIndex as yr, LocalStartCloudFrontError as yt, MICROVM_CONTROL_PATH as z, AGENTCORE_MCP_PROTOCOL as za, evaluateResponseParameters as zi, albStrategy as zn, signAgentCoreInvocation as zr, disposeWebFunctionArtifact as zt };
|
|
32149
|
+
//# sourceMappingURL=local-studio-BR8vPfCn.js.map
|