@intentius/chant-lexicon-aws 0.18.20 → 0.18.22

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/src/plugin.ts CHANGED
@@ -475,6 +475,7 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
475
475
  environment: string;
476
476
  buildOutput: string;
477
477
  entityNames: string[];
478
+ stack?: string;
478
479
  owned?: boolean;
479
480
  }): Promise<Record<string, ResourceMetadata>> {
480
481
  const { getRuntime } = await import("@intentius/chant/runtime-adapter");
@@ -490,9 +491,10 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
490
491
  );
491
492
  }
492
493
 
493
- // Derive stack name: environment-based convention
494
- // Try to parse the build output to detect stack name from Metadata or use convention
495
- const stackName = `${options.environment}`;
494
+ // Derive stack name. A multi-stack project passes the explicit CloudFormation
495
+ // stack this observation targets (see `stacks` in ChantConfig); otherwise the
496
+ // single-stack convention is the stack named after the environment (#932).
497
+ const stackName = options.stack ?? `${options.environment}`;
496
498
 
497
499
  // Describe stack resources. Inject --endpoint-url from AWS_ENDPOINT_URL so a
498
500
  // local emulator (Floci) is observed instead of real AWS (#926) — behold
@@ -577,14 +579,16 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
577
579
 
578
580
  async exportResources(options: {
579
581
  environment: string;
582
+ stack?: string;
580
583
  selector?: ResourceSelector;
581
584
  owned?: boolean;
582
585
  }): Promise<ExportedTemplate> {
583
586
  const { getRuntime } = await import("@intentius/chant/runtime-adapter");
584
587
  const rt = getRuntime();
585
588
 
586
- // Same stack-name convention as describeResources.
587
- const stackName = `${options.environment}`;
589
+ // Same stack-name convention as describeResources: an explicit multi-stack
590
+ // stack name (#932), else the stack named after the environment.
591
+ const stackName = options.stack ?? `${options.environment}`;
588
592
 
589
593
  const result = await rt.spawn(applyAwsEndpointArgv([
590
594
  "aws", "cloudformation", "get-template",
@@ -614,8 +618,8 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
614
618
  // describe-stack-resources is too thin; the deployed template (exportResources)
615
619
  // carries the references. Resolve its `{Ref}`/`{Fn::GetAtt}` intrinsics to bare
616
620
  // logical ids so the reference resolver matches them.
617
- async enrichLiveAttrs(options: { environment: string; owned?: boolean }): Promise<Record<string, Record<string, unknown>>> {
618
- const template = await this.exportResources!({ environment: options.environment, owned: options.owned });
621
+ async enrichLiveAttrs(options: { environment: string; stack?: string; owned?: boolean }): Promise<Record<string, Record<string, unknown>>> {
622
+ const template = await this.exportResources!({ environment: options.environment, stack: options.stack, owned: options.owned });
619
623
  return resolveTemplateAttrs(template);
620
624
  },
621
625