@intentius/chant-lexicon-pulumi 0.124.102 → 0.124.103
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/change-set.d.ts +5 -0
- package/dist/change-set.js +4 -0
- package/dist/chant-floors.d.ts +36 -0
- package/dist/chant-floors.js +36 -0
- package/dist/cost-hold.d.ts +45 -0
- package/dist/cost-hold.js +49 -0
- package/dist/describe-resources.d.ts +10 -0
- package/dist/describe-resources.js +79 -3
- package/dist/disruption.d.ts +50 -0
- package/dist/disruption.js +104 -0
- package/dist/engine-graph.d.ts +1 -1
- package/dist/engine-graph.js +40 -1
- package/dist/health-targets.d.ts +25 -0
- package/dist/health-targets.js +57 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/dist/plugin.js +33 -1
- package/dist/preview-observation.d.ts +97 -0
- package/dist/preview-observation.js +218 -0
- package/dist/pulumi-up.d.ts +44 -3
- package/dist/pulumi-up.js +71 -11
- package/dist/reference-catalog.d.ts +84 -0
- package/dist/reference-catalog.js +383 -0
- package/dist/reference-props.d.ts +19 -0
- package/dist/reference-props.js +93 -0
- package/dist/stack-references.js +6 -1
- package/dist/workspace-member.js +9 -3
- package/dist/workspace-stack-reads.d.ts +12 -0
- package/dist/workspace-stack-reads.js +60 -0
- package/package.json +3 -3
package/dist/change-set.d.ts
CHANGED
|
@@ -188,6 +188,11 @@ export declare function pulumiStepsAction(steps: PulumiStep[]): {
|
|
|
188
188
|
disruption?: ChangeSetDisruption;
|
|
189
189
|
importing?: true;
|
|
190
190
|
} | undefined;
|
|
191
|
+
/** {@link statesOf} for the preview observation (`./preview-observation.ts`, #5332): one parse of the steps, not a second. */
|
|
192
|
+
export declare function pulumiStepStates(steps: PulumiStep[]): {
|
|
193
|
+
before?: PulumiStepState;
|
|
194
|
+
after?: PulumiStepState;
|
|
195
|
+
};
|
|
191
196
|
export interface PulumiPreviewPartInput {
|
|
192
197
|
/** The workspace member's name, which names its graph nodes (`<member>/<key>`). */
|
|
193
198
|
member: string;
|
package/dist/change-set.js
CHANGED
|
@@ -242,6 +242,10 @@ function statesOf(steps) {
|
|
|
242
242
|
const after = [...steps].reverse().find((s) => isObject(s.newState) && s.op !== "delete-replaced" && s.op !== "delete")?.newState;
|
|
243
243
|
return { ...(before ? { before } : {}), ...(after ? { after } : {}) };
|
|
244
244
|
}
|
|
245
|
+
/** {@link statesOf} for the preview observation (`./preview-observation.ts`, #5332): one parse of the steps, not a second. */
|
|
246
|
+
export function pulumiStepStates(steps) {
|
|
247
|
+
return statesOf(steps);
|
|
248
|
+
}
|
|
245
249
|
function attributesOf(steps, action, states) {
|
|
246
250
|
if (action !== "create" && action !== "update" && action !== "replace")
|
|
247
251
|
return [];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first pulumi lexicon release with a `referenceCatalog` (`./reference-catalog`): how the aws, gcp, azure and kubernetes providers' resources name each other by ARN, id and name, and the inputs and outputs a stack export's nodes carry for it to read (#5330).
|
|
3
|
+
*/
|
|
4
|
+
export declare const PULUMI_REFERENCE_CATALOG_FLOOR = "0.124.103";
|
|
5
|
+
/**
|
|
6
|
+
* The first pulumi lexicon release with `pulumiCostHold` (`./cost-hold`) and a `planJson` on `pulumi-up`'s artifact: the preview JSON a wave's cost hold hands a user-named command as `{planJson}` (#5341).
|
|
7
|
+
*/
|
|
8
|
+
export declare const PULUMI_COST_HOLD_FLOOR = "0.124.103";
|
|
9
|
+
/**
|
|
10
|
+
* The first pulumi lexicon release with the preview depth of `describeResources` (`CHANT_PULUMI_OBSERVE=preview`, `./preview-observation`): `pulumi preview --json` (or plunge's) marks each node with its planned operation in the terraform plan observation's attribute names, a stack with no export gets its nodes from the preview marked `planned`, and `rootReads["pulumi.members.<member>"]` says why a preview did not answer (#5332).
|
|
11
|
+
*/
|
|
12
|
+
export declare const PULUMI_PREVIEW_OBSERVATION_FLOOR = "0.124.103";
|
|
13
|
+
/**
|
|
14
|
+
* The first pulumi lexicon release whose `classifyDisruption` classifies a
|
|
15
|
+
* planned update from a preview's steps (in place, replace, destroy), with
|
|
16
|
+
* `pulumiDisruptionQueries` for a preview in hand, and whose `healthTargets`
|
|
17
|
+
* reads a stack's covered resources through the aws, azure and gcp health
|
|
18
|
+
* reads with ids from its export (#5338).
|
|
19
|
+
*/
|
|
20
|
+
export declare const PULUMI_HEALTH_DISRUPTION_FLOOR = "0.124.103";
|
|
21
|
+
/**
|
|
22
|
+
* The first pulumi lexicon release whose `classifyDisruption` also answers from the plan attributes the preview depth writes on a node (`planActions`, `planReplacePaths`), so `chant lifecycle plan` reads an in-place, replace or destroy verdict for a member observed with `CHANT_PULUMI_OBSERVE=preview` (#5378).
|
|
23
|
+
*/
|
|
24
|
+
export declare const PULUMI_PREVIEW_DISRUPTION_FLOOR = "0.124.103";
|
|
25
|
+
/**
|
|
26
|
+
* The first pulumi lexicon release whose `pulumi-up` reports its `StackReference` reads through `graphReads` (`./pulumi-up`), so `chant graph --components` and `chant workspace graph` draw an edge from a stack to each stack it reads, naming the output, and a node marked external for a stack nothing applies (#5331).
|
|
27
|
+
*/
|
|
28
|
+
export declare const PULUMI_STACK_REFERENCE_GRAPH_FLOOR = "0.124.103";
|
|
29
|
+
/**
|
|
30
|
+
* The first pulumi lexicon release that puts `facts.ownershipRows` on a plunge member's nodes (#5402): each record's `meta.engineGraph.gaps` entry as `gaps` read `graph`, and any `ownershipRows` plunge prints on a node. It needs `@intentius/chant` at `ENGINE_OWNERSHIP_ROWS_FLOOR` or later.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PULUMI_OWNERSHIP_ROWS_FLOOR = "0.124.103";
|
|
33
|
+
/**
|
|
34
|
+
* The first pulumi lexicon release whose nodes carry `component` (`IRNode.component`), the node of the component resource that registered them, from the stack export's `parent` URNs and the preview's step states, so a graph reader draws a component as a box around its children and nested components nest (#5403).
|
|
35
|
+
*/
|
|
36
|
+
export declare const PULUMI_COMPONENT_GROUPS_FLOOR = "0.124.103";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first pulumi lexicon release with a `referenceCatalog` (`./reference-catalog`): how the aws, gcp, azure and kubernetes providers' resources name each other by ARN, id and name, and the inputs and outputs a stack export's nodes carry for it to read (#5330).
|
|
3
|
+
*/
|
|
4
|
+
export const PULUMI_REFERENCE_CATALOG_FLOOR = "0.124.103";
|
|
5
|
+
/**
|
|
6
|
+
* The first pulumi lexicon release with `pulumiCostHold` (`./cost-hold`) and a `planJson` on `pulumi-up`'s artifact: the preview JSON a wave's cost hold hands a user-named command as `{planJson}` (#5341).
|
|
7
|
+
*/
|
|
8
|
+
export const PULUMI_COST_HOLD_FLOOR = "0.124.103";
|
|
9
|
+
/**
|
|
10
|
+
* The first pulumi lexicon release with the preview depth of `describeResources` (`CHANT_PULUMI_OBSERVE=preview`, `./preview-observation`): `pulumi preview --json` (or plunge's) marks each node with its planned operation in the terraform plan observation's attribute names, a stack with no export gets its nodes from the preview marked `planned`, and `rootReads["pulumi.members.<member>"]` says why a preview did not answer (#5332).
|
|
11
|
+
*/
|
|
12
|
+
export const PULUMI_PREVIEW_OBSERVATION_FLOOR = "0.124.103";
|
|
13
|
+
/**
|
|
14
|
+
* The first pulumi lexicon release whose `classifyDisruption` classifies a
|
|
15
|
+
* planned update from a preview's steps (in place, replace, destroy), with
|
|
16
|
+
* `pulumiDisruptionQueries` for a preview in hand, and whose `healthTargets`
|
|
17
|
+
* reads a stack's covered resources through the aws, azure and gcp health
|
|
18
|
+
* reads with ids from its export (#5338).
|
|
19
|
+
*/
|
|
20
|
+
export const PULUMI_HEALTH_DISRUPTION_FLOOR = "0.124.103";
|
|
21
|
+
/**
|
|
22
|
+
* The first pulumi lexicon release whose `classifyDisruption` also answers from the plan attributes the preview depth writes on a node (`planActions`, `planReplacePaths`), so `chant lifecycle plan` reads an in-place, replace or destroy verdict for a member observed with `CHANT_PULUMI_OBSERVE=preview` (#5378).
|
|
23
|
+
*/
|
|
24
|
+
export const PULUMI_PREVIEW_DISRUPTION_FLOOR = "0.124.103";
|
|
25
|
+
/**
|
|
26
|
+
* The first pulumi lexicon release whose `pulumi-up` reports its `StackReference` reads through `graphReads` (`./pulumi-up`), so `chant graph --components` and `chant workspace graph` draw an edge from a stack to each stack it reads, naming the output, and a node marked external for a stack nothing applies (#5331).
|
|
27
|
+
*/
|
|
28
|
+
export const PULUMI_STACK_REFERENCE_GRAPH_FLOOR = "0.124.103";
|
|
29
|
+
/**
|
|
30
|
+
* The first pulumi lexicon release that puts `facts.ownershipRows` on a plunge member's nodes (#5402): each record's `meta.engineGraph.gaps` entry as `gaps` read `graph`, and any `ownershipRows` plunge prints on a node. It needs `@intentius/chant` at `ENGINE_OWNERSHIP_ROWS_FLOOR` or later.
|
|
31
|
+
*/
|
|
32
|
+
export const PULUMI_OWNERSHIP_ROWS_FLOOR = "0.124.103";
|
|
33
|
+
/**
|
|
34
|
+
* The first pulumi lexicon release whose nodes carry `component` (`IRNode.component`), the node of the component resource that registered them, from the stack export's `parent` URNs and the preview's step states, so a graph reader draws a component as a box around its children and nested components nest (#5403).
|
|
35
|
+
*/
|
|
36
|
+
export const PULUMI_COMPONENT_GROUPS_FLOOR = "0.124.103";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pulumi lexicon's preset for an op wave's cost hold (#5341,
|
|
3
|
+
* `holds.cost` on the spec): a command the user names, run over each stack's
|
|
4
|
+
* preview JSON. `pulumi-up`'s plan writes that document (`steps`,
|
|
5
|
+
* `diagnostics`, `changeSummary`, the shape `pulumi preview --json` prints)
|
|
6
|
+
* and names it as `artifact.planJson`, which a wave hands the command as
|
|
7
|
+
* `{planJson}`.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const spec = { ..., step: { kind: "pulumi-up", stack: "{target}" }, holds: { cost: pulumiCostHold({ approveAbove: 100, command: ["./price-preview", "{planJson}"] }) } };
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The command reads a copy of the preview with its secrets replaced by
|
|
14
|
+
* `[redacted]` and runs without the forge tokens in its environment.
|
|
15
|
+
* `redactEnv` names variables whose values are secret though the preview does
|
|
16
|
+
* not mark them (a product's store values): each value is replaced in the
|
|
17
|
+
* copy and the variable leaves the command's environment. `dropEnv` names
|
|
18
|
+
* more variables to leave out, such as a product's own token variables. Both
|
|
19
|
+
* take names; the job's environment holds the values.
|
|
20
|
+
* No estimator ships with it. The command prints the estimate on standard
|
|
21
|
+
* output in `format`: `{ "monthlyDelta": <number>, "currency"?: "<code>" }`
|
|
22
|
+
* for `chant` (the default), or infracost's JSON for `infracost`. The hold
|
|
23
|
+
* only adds an approval when the sum is over `approveAbove`; it never lets a
|
|
24
|
+
* plan apply without one. It is off until a spec sets it.
|
|
25
|
+
*
|
|
26
|
+
* The shape is core's `OpWaveCostHold` and matches `terraformCostHold`'s,
|
|
27
|
+
* written out here so the lexicon builds against a core without it.
|
|
28
|
+
*/
|
|
29
|
+
export interface PulumiCostHold {
|
|
30
|
+
command: string[];
|
|
31
|
+
approveAbove: number;
|
|
32
|
+
format: "chant" | "infracost";
|
|
33
|
+
currency?: string;
|
|
34
|
+
redactEnv?: string[];
|
|
35
|
+
dropEnv?: string[];
|
|
36
|
+
}
|
|
37
|
+
/** A cost hold that runs `command` over each stack's preview JSON, waiting over `approveAbove` a month. `command` must name `{planJson}`. */
|
|
38
|
+
export declare function pulumiCostHold(options: {
|
|
39
|
+
approveAbove: number;
|
|
40
|
+
command: string[];
|
|
41
|
+
format?: PulumiCostHold["format"];
|
|
42
|
+
currency?: string;
|
|
43
|
+
redactEnv?: string[];
|
|
44
|
+
dropEnv?: string[];
|
|
45
|
+
}): PulumiCostHold;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pulumi lexicon's preset for an op wave's cost hold (#5341,
|
|
3
|
+
* `holds.cost` on the spec): a command the user names, run over each stack's
|
|
4
|
+
* preview JSON. `pulumi-up`'s plan writes that document (`steps`,
|
|
5
|
+
* `diagnostics`, `changeSummary`, the shape `pulumi preview --json` prints)
|
|
6
|
+
* and names it as `artifact.planJson`, which a wave hands the command as
|
|
7
|
+
* `{planJson}`.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const spec = { ..., step: { kind: "pulumi-up", stack: "{target}" }, holds: { cost: pulumiCostHold({ approveAbove: 100, command: ["./price-preview", "{planJson}"] }) } };
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The command reads a copy of the preview with its secrets replaced by
|
|
14
|
+
* `[redacted]` and runs without the forge tokens in its environment.
|
|
15
|
+
* `redactEnv` names variables whose values are secret though the preview does
|
|
16
|
+
* not mark them (a product's store values): each value is replaced in the
|
|
17
|
+
* copy and the variable leaves the command's environment. `dropEnv` names
|
|
18
|
+
* more variables to leave out, such as a product's own token variables. Both
|
|
19
|
+
* take names; the job's environment holds the values.
|
|
20
|
+
* No estimator ships with it. The command prints the estimate on standard
|
|
21
|
+
* output in `format`: `{ "monthlyDelta": <number>, "currency"?: "<code>" }`
|
|
22
|
+
* for `chant` (the default), or infracost's JSON for `infracost`. The hold
|
|
23
|
+
* only adds an approval when the sum is over `approveAbove`; it never lets a
|
|
24
|
+
* plan apply without one. It is off until a spec sets it.
|
|
25
|
+
*
|
|
26
|
+
* The shape is core's `OpWaveCostHold` and matches `terraformCostHold`'s,
|
|
27
|
+
* written out here so the lexicon builds against a core without it.
|
|
28
|
+
*/
|
|
29
|
+
/** Names of environment variables only, so no secret value sits in the spec. */
|
|
30
|
+
const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
31
|
+
function envNames(option, names) {
|
|
32
|
+
if (names === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
if (!Array.isArray(names) || !names.every((n) => typeof n === "string" && ENV_NAME.test(n)))
|
|
35
|
+
throw new Error(`pulumiCostHold: ${option} is a list of environment variable names, never their values`);
|
|
36
|
+
return names;
|
|
37
|
+
}
|
|
38
|
+
/** A cost hold that runs `command` over each stack's preview JSON, waiting over `approveAbove` a month. `command` must name `{planJson}`. */
|
|
39
|
+
export function pulumiCostHold(options) {
|
|
40
|
+
const { command } = options;
|
|
41
|
+
if (!Array.isArray(command) || command.length === 0 || !command.every((a) => typeof a === "string" && a !== "")) {
|
|
42
|
+
throw new Error("pulumiCostHold: command is the estimator's argv, a non-empty list of strings; no estimator ships with the preset");
|
|
43
|
+
}
|
|
44
|
+
if (!command.some((a) => a.includes("{planJson}")))
|
|
45
|
+
throw new Error("pulumiCostHold: the command must name {planJson}, the stack's preview JSON");
|
|
46
|
+
const redactEnv = envNames("redactEnv", options.redactEnv);
|
|
47
|
+
const dropEnv = envNames("dropEnv", options.dropEnv);
|
|
48
|
+
return { command, approveAbove: options.approveAbove, format: options.format ?? "chant", ...(options.currency ? { currency: options.currency } : {}), ...(redactEnv ? { redactEnv } : {}), ...(dropEnv ? { dropEnv } : {}) };
|
|
49
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type DescribeResourcesResult } from "@intentius/chant/observation";
|
|
2
|
+
import { type PulumiObserveDepth } from "./preview-observation.js";
|
|
2
3
|
import { type PulumiRunner } from "./run.js";
|
|
3
4
|
import type { PulumiMemberConfig } from "./workspace-member.js";
|
|
5
|
+
import type { SnapshotStore } from "@intentius/chant/lifecycle/snapshot-store";
|
|
4
6
|
/** The `describeResources` options this read uses. */
|
|
5
7
|
export interface DescribePulumiOptions {
|
|
6
8
|
entities: Map<string, {
|
|
@@ -8,6 +10,8 @@ export interface DescribePulumiOptions {
|
|
|
8
10
|
props: Record<string, unknown>;
|
|
9
11
|
}>;
|
|
10
12
|
owned?: boolean;
|
|
13
|
+
/** Read at this depth, over `CHANT_PULUMI_OBSERVE` (#5332). */
|
|
14
|
+
depth?: PulumiObserveDepth;
|
|
11
15
|
}
|
|
12
16
|
/** Injectable for tests: the member (else read from the project's config) and the plunge runner. */
|
|
13
17
|
export interface DescribePulumiDeps {
|
|
@@ -16,6 +20,12 @@ export interface DescribePulumiDeps {
|
|
|
16
20
|
/** Where the config search starts. Default: the process cwd. */
|
|
17
21
|
cwd?: string;
|
|
18
22
|
plunge?: PulumiRunner;
|
|
23
|
+
/** Runs stock pulumi, for the preview depth. */
|
|
24
|
+
run?: PulumiRunner;
|
|
25
|
+
/** The index store the preview depth reads the member's export from. Default: the project's; `null` reads the checked-in file only. */
|
|
26
|
+
exportStore?: SnapshotStore | null;
|
|
27
|
+
/** The environment the depth is read from. Default: `process.env`. */
|
|
28
|
+
env?: Record<string, string | undefined>;
|
|
19
29
|
}
|
|
20
30
|
/** The `sources` value on each entity this read answered. */
|
|
21
31
|
export declare const PLUNGE_GRAPH_SOURCE = "plunge-graph";
|
|
@@ -27,13 +27,26 @@
|
|
|
27
27
|
* A run that fails leaves every declared entity not-observed with the
|
|
28
28
|
* reason, never absent. That includes a plunge older than `plunge graph`
|
|
29
29
|
* (INTENTIUS/plunge#40).
|
|
30
|
+
*
|
|
31
|
+
* ## The preview depth (#5332)
|
|
32
|
+
*
|
|
33
|
+
* `CHANT_PULUMI_OBSERVE=preview` (or `depth: "preview"` from a caller) reads
|
|
34
|
+
* any member, stock or plunge, with its engine's preview instead
|
|
35
|
+
* (`./preview-observation.ts`): each resource gets the plan attributes the
|
|
36
|
+
* terraform plan depth uses, and a resource the graph does not hold becomes
|
|
37
|
+
* a node marked `planned`, which is every resource of a stack with no
|
|
38
|
+
* export. The member's `rootReads` entry, `pulumi.members.<member>`, says
|
|
39
|
+
* `depth: "preview"`. When the preview fails, the read above answers
|
|
40
|
+
* instead (`fellBackTo` `state` when plunge's records did, `declared` when
|
|
41
|
+
* nothing did) and `reason` is one of `PREVIEW_READ_REASONS`.
|
|
30
42
|
*/
|
|
31
43
|
import { basename, dirname, isAbsolute, resolve } from "node:path";
|
|
32
|
-
import { observation, unobservedAll } from "@intentius/chant/observation";
|
|
44
|
+
import { normalizeObservation, observation, unobservedAll } from "@intentius/chant/observation";
|
|
33
45
|
import { isPulumiNodeless, pulumiNodeKey } from "@intentius/chant/pulumi-urn";
|
|
34
46
|
import { readPlungeEngineGraph } from "./engine-graph.js";
|
|
35
47
|
import { pulumiMemberEngine } from "./member-engine.js";
|
|
36
|
-
import {
|
|
48
|
+
import { observePreview, previewReadReason, PULUMI_OBSERVE_ENV } from "./preview-observation.js";
|
|
49
|
+
import { plungeMemberGraph, previewPulumiMemberRead } from "./run.js";
|
|
37
50
|
/** The `sources` value on each entity this read answered. */
|
|
38
51
|
export const PLUNGE_GRAPH_SOURCE = "plunge-graph";
|
|
39
52
|
async function configuredMember(cwd) {
|
|
@@ -47,8 +60,71 @@ async function configuredMember(cwd) {
|
|
|
47
60
|
}
|
|
48
61
|
/** `LexiconPlugin.describeResources` for the pulumi lexicon. */
|
|
49
62
|
export async function describePulumiResources(options, deps = {}) {
|
|
50
|
-
const
|
|
63
|
+
const notes = [];
|
|
64
|
+
const depth = observeDepth(options.depth, deps.env ?? process.env, notes);
|
|
51
65
|
const member = deps.member ?? (await configuredMember(resolve(deps.cwd ?? process.cwd())));
|
|
66
|
+
if (depth !== "preview" || !member) {
|
|
67
|
+
const result = await describeFromRecords(options, deps, member);
|
|
68
|
+
return notes.length > 0 ? addNotes(result, notes) : result;
|
|
69
|
+
}
|
|
70
|
+
return describeFromPreview(options, deps, member, notes);
|
|
71
|
+
}
|
|
72
|
+
/** The depth asked for: the caller's, then `CHANT_PULUMI_OBSERVE`, else `state`. */
|
|
73
|
+
function observeDepth(asked, env, notes) {
|
|
74
|
+
if (asked)
|
|
75
|
+
return asked;
|
|
76
|
+
const value = env[PULUMI_OBSERVE_ENV];
|
|
77
|
+
if (value === "preview" || value === "state")
|
|
78
|
+
return value;
|
|
79
|
+
if (value)
|
|
80
|
+
notes.push(`${PULUMI_OBSERVE_ENV}=${JSON.stringify(value)} is neither "state" nor "preview" and was ignored`);
|
|
81
|
+
return "state";
|
|
82
|
+
}
|
|
83
|
+
function addNotes(result, notes) {
|
|
84
|
+
const n = normalizeObservation(result);
|
|
85
|
+
return observation(n.resources, n.unobserved, n.queried, [...n.notes, ...notes], n.stackExports, n.sources, n.annotations, n.rootReads, n.edges);
|
|
86
|
+
}
|
|
87
|
+
/** The first line of an engine error, for a note. */
|
|
88
|
+
const firstLine = (text) => text.split("\n").find((l) => l.trim() !== "")?.trim() ?? text;
|
|
89
|
+
/**
|
|
90
|
+
* The preview depth: the member's preview, and when it fails the records
|
|
91
|
+
* read below, with the reason on `rootReads`.
|
|
92
|
+
*/
|
|
93
|
+
async function describeFromPreview(options, deps, member, notes) {
|
|
94
|
+
const label = member.label ?? basename(member.dir);
|
|
95
|
+
const rootKey = `pulumi.members.${label}`;
|
|
96
|
+
const engine = pulumiMemberEngine(member.dir, member.engine).engine;
|
|
97
|
+
const read = await previewPulumiMemberRead({
|
|
98
|
+
member: label,
|
|
99
|
+
dir: member.dir,
|
|
100
|
+
...(member.stack ? { stack: member.stack } : {}),
|
|
101
|
+
engine,
|
|
102
|
+
...(deps.run ? { run: deps.run } : {}),
|
|
103
|
+
...(deps.plunge ? { plunge: deps.plunge } : {}),
|
|
104
|
+
...(deps.exportStore !== undefined ? { exportStore: deps.exportStore } : {}),
|
|
105
|
+
});
|
|
106
|
+
const failure = read.part.member.status === "failed" ? (read.part.member.error ?? "the preview failed") : undefined;
|
|
107
|
+
const observed = failure === undefined ? observePreview({ label, preview: read.preview, declared: options.entities }) : undefined;
|
|
108
|
+
if (observed) {
|
|
109
|
+
const note = `${rootKey}: the ${engine} preview answered${observed.unmapped > 0 ? `; ${observed.unmapped} URN(s) had an op the change set has no action for` : ""}`;
|
|
110
|
+
return observation(observed.resources, observed.unobserved, observed.queried, [...notes, note], undefined, observed.sources, undefined, { [rootKey]: { depth: "preview" } });
|
|
111
|
+
}
|
|
112
|
+
const error = failure ?? `${engine} preview --json printed no steps`;
|
|
113
|
+
const reason = previewReadReason(error);
|
|
114
|
+
const result = await describeFromRecords(options, deps, member);
|
|
115
|
+
const answered = normalizeObservation(result);
|
|
116
|
+
const fellBackTo = Object.keys(answered.resources).length > 0 ? "state" : "declared";
|
|
117
|
+
const withReason = addNotes(result, [
|
|
118
|
+
...notes,
|
|
119
|
+
`${rootKey}: the ${engine} preview failed (${reason}: ${firstLine(error)}), so ${fellBackTo === "state" ? "plunge's records answered" : "no read answered, declared only"}; plan attributes are absent`,
|
|
120
|
+
]);
|
|
121
|
+
const n = normalizeObservation(withReason);
|
|
122
|
+
return observation(n.resources, n.unobserved, n.queried, n.notes, n.stackExports, n.sources, n.annotations, { ...n.rootReads, [rootKey]: { depth: "preview", fellBackTo, reason } }, n.edges);
|
|
123
|
+
}
|
|
124
|
+
/** The records read: plunge's graph for a member on plunge, nothing for a stock member. */
|
|
125
|
+
async function describeFromRecords(options, deps, configured) {
|
|
126
|
+
const names = [...options.entities.keys()];
|
|
127
|
+
const member = configured;
|
|
52
128
|
if (!member) {
|
|
53
129
|
return observation({}, unobservedAll(names, "no-binding", "pulumi.member names no member; chant workspace graph writes it into a pulumi member's reader project", options.entities));
|
|
54
130
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `classifyDisruption` for pulumi (#5338): what applying a planned update
|
|
3
|
+
* costs, from a preview's steps.
|
|
4
|
+
*
|
|
5
|
+
* The preview says it in its ops. An `update` step is a change in place. A
|
|
6
|
+
* replacement is `create-replacement`, `replace` and `delete-replaced` on one
|
|
7
|
+
* URN, and the order says which kind: the delete after the create is a
|
|
8
|
+
* replacement made first, the delete before it (`deleteBeforeReplace`) is a
|
|
9
|
+
* window with nothing there. A `delete` step removes the resource.
|
|
10
|
+
* `replaceReasons` and a `detailedDiff` kind ending in `-replace` name the
|
|
11
|
+
* properties that forced the replacement.
|
|
12
|
+
*
|
|
13
|
+
* | steps on one URN | disruption |
|
|
14
|
+
* |---|---|
|
|
15
|
+
* | `update` | `in-place` |
|
|
16
|
+
* | `create-replacement` before `delete-replaced`, or `replace` alone | `replace` |
|
|
17
|
+
* | `delete-replaced` before `create-replacement` | `destroy` |
|
|
18
|
+
* | `import-replacement` | `replace` |
|
|
19
|
+
* | `delete` | `destroy` |
|
|
20
|
+
*
|
|
21
|
+
* The table is the change set adapter's, `pulumiStepsAction` in
|
|
22
|
+
* `./change-set.ts`, so the two agree. The classifier answers through core's
|
|
23
|
+
* contract from one of two attribute shapes:
|
|
24
|
+
*
|
|
25
|
+
* - `previewSteps` (each step's `op`, `replaceReasons` and `detailedDiff`),
|
|
26
|
+
* which {@link pulumiDisruptionQueries} builds from a `pulumi preview
|
|
27
|
+
* --json` document, one query per URN.
|
|
28
|
+
* - `planActions` and `planReplacePaths`, the attributes the preview depth of
|
|
29
|
+
* `describeResources` writes on a node (`./preview-observation.ts`). The
|
|
30
|
+
* ops of `planActions[urn]` keep the preview's order, so they run through
|
|
31
|
+
* the same table; `planReplacePaths` names what forced a replacement.
|
|
32
|
+
*
|
|
33
|
+
* `previewSteps` wins when a query carries both. A query with neither gets no
|
|
34
|
+
* verdict, which core reads as `unknown`.
|
|
35
|
+
*/
|
|
36
|
+
import type { DisruptionQuery, DisruptionVerdict } from "@intentius/chant/lexicon";
|
|
37
|
+
import { type PulumiStep } from "./change-set.js";
|
|
38
|
+
/** The verdict one URN's steps mean, or undefined for steps that change nothing existing. */
|
|
39
|
+
export declare function pulumiStepsVerdict(steps: PulumiStep[]): DisruptionVerdict | undefined;
|
|
40
|
+
/** `LexiconPlugin.classifyDisruption` for pulumi. */
|
|
41
|
+
export declare function classifyPulumiDisruption(options: {
|
|
42
|
+
environment: string;
|
|
43
|
+
changes: DisruptionQuery[];
|
|
44
|
+
}): Record<string, DisruptionVerdict>;
|
|
45
|
+
/**
|
|
46
|
+
* The queries a `pulumi preview --json` document holds: one per URN whose
|
|
47
|
+
* steps update, replace or delete something, named by the URN, with its
|
|
48
|
+
* steps' `op`, `replaceReasons` and `detailedDiff` as `previewSteps`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function pulumiDisruptionQueries(preview: unknown): DisruptionQuery[];
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { pulumiSteps, pulumiStepsAction } from "./change-set.js";
|
|
2
|
+
const DETAIL = {
|
|
3
|
+
"in-place": "the preview updates it in place",
|
|
4
|
+
replace: "the preview creates a replacement, then deletes the old one",
|
|
5
|
+
destroy: "the preview deletes it before anything replaces it",
|
|
6
|
+
};
|
|
7
|
+
const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
8
|
+
/** The properties that forced a replacement, from the steps' `replaceReasons` and `-replace` diff kinds. */
|
|
9
|
+
function forcing(steps) {
|
|
10
|
+
const out = new Set();
|
|
11
|
+
for (const s of steps) {
|
|
12
|
+
for (const r of s.replaceReasons ?? [])
|
|
13
|
+
out.add(r);
|
|
14
|
+
for (const [path, d] of Object.entries(s.detailedDiff ?? {})) {
|
|
15
|
+
if (typeof d?.kind === "string" && d.kind.endsWith("-replace"))
|
|
16
|
+
out.add(path);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return [...out].sort();
|
|
20
|
+
}
|
|
21
|
+
/** The verdict one URN's steps mean, or undefined for steps that change nothing existing. */
|
|
22
|
+
export function pulumiStepsVerdict(steps) {
|
|
23
|
+
const mapped = pulumiStepsAction(steps);
|
|
24
|
+
const disruption = mapped?.disruption;
|
|
25
|
+
if (!disruption || !(disruption in DETAIL))
|
|
26
|
+
return undefined;
|
|
27
|
+
const because = disruption === "in-place" ? [] : forcing(steps);
|
|
28
|
+
return {
|
|
29
|
+
disruption,
|
|
30
|
+
...(because.length > 0 ? { because } : {}),
|
|
31
|
+
detail: because.length > 0 ? `${DETAIL[disruption]}; ${because.join(", ")} forced it` : DETAIL[disruption],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const RANK = { "in-place": 0, replace: 1, destroy: 2 };
|
|
35
|
+
/** One attribute off the query: its observed value, else the new value of a delta on it. */
|
|
36
|
+
function attribute(query, key) {
|
|
37
|
+
if (query.attributes && key in query.attributes)
|
|
38
|
+
return query.attributes[key];
|
|
39
|
+
return query.deltas.find((d) => d.path === `attributes.${key}`)?.newValue;
|
|
40
|
+
}
|
|
41
|
+
/** The verdict a preview node's `planActions` and `planReplacePaths` mean, or undefined when it carries no plan. */
|
|
42
|
+
function planVerdict(query) {
|
|
43
|
+
const planActions = attribute(query, "planActions");
|
|
44
|
+
if (!isRecord(planActions))
|
|
45
|
+
return undefined;
|
|
46
|
+
let worst;
|
|
47
|
+
for (const ops of Object.values(planActions)) {
|
|
48
|
+
if (!Array.isArray(ops))
|
|
49
|
+
continue;
|
|
50
|
+
const verdict = pulumiStepsVerdict(ops.filter((op) => typeof op === "string").map((op) => ({ op })));
|
|
51
|
+
if (verdict && (!worst || RANK[verdict.disruption] > RANK[worst.disruption]))
|
|
52
|
+
worst = verdict;
|
|
53
|
+
}
|
|
54
|
+
if (!worst)
|
|
55
|
+
return undefined;
|
|
56
|
+
const paths = attribute(query, "planReplacePaths");
|
|
57
|
+
const because = worst.disruption !== "in-place" && Array.isArray(paths) ? paths.filter((p) => typeof p === "string") : [];
|
|
58
|
+
if (because.length === 0)
|
|
59
|
+
return worst;
|
|
60
|
+
return { disruption: worst.disruption, because, detail: `${DETAIL[worst.disruption]}; ${because.join(", ")} forced it` };
|
|
61
|
+
}
|
|
62
|
+
/** `LexiconPlugin.classifyDisruption` for pulumi. */
|
|
63
|
+
export function classifyPulumiDisruption(options) {
|
|
64
|
+
const out = {};
|
|
65
|
+
for (const query of options.changes) {
|
|
66
|
+
const raw = query.attributes?.previewSteps;
|
|
67
|
+
const verdict = Array.isArray(raw) ? pulumiStepsVerdict(raw.filter(isRecord)) : planVerdict(query);
|
|
68
|
+
if (verdict)
|
|
69
|
+
out[query.name] = verdict;
|
|
70
|
+
}
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The queries a `pulumi preview --json` document holds: one per URN whose
|
|
75
|
+
* steps update, replace or delete something, named by the URN, with its
|
|
76
|
+
* steps' `op`, `replaceReasons` and `detailedDiff` as `previewSteps`.
|
|
77
|
+
*/
|
|
78
|
+
export function pulumiDisruptionQueries(preview) {
|
|
79
|
+
const byUrn = new Map();
|
|
80
|
+
for (const s of pulumiSteps(preview) ?? []) {
|
|
81
|
+
const list = byUrn.get(s.urn) ?? [];
|
|
82
|
+
list.push(s);
|
|
83
|
+
byUrn.set(s.urn, list);
|
|
84
|
+
}
|
|
85
|
+
const out = [];
|
|
86
|
+
for (const [urn, steps] of byUrn) {
|
|
87
|
+
if (!pulumiStepsAction(steps)?.disruption)
|
|
88
|
+
continue;
|
|
89
|
+
const type = steps.map((s) => s.newState?.type ?? s.oldState?.type).find((t) => typeof t === "string");
|
|
90
|
+
out.push({
|
|
91
|
+
name: urn,
|
|
92
|
+
...(type ? { type } : {}),
|
|
93
|
+
deltas: [],
|
|
94
|
+
attributes: {
|
|
95
|
+
previewSteps: steps.map((s) => ({
|
|
96
|
+
op: s.op,
|
|
97
|
+
...(s.replaceReasons ? { replaceReasons: s.replaceReasons } : {}),
|
|
98
|
+
...(s.detailedDiff ? { detailedDiff: s.detailedDiff } : {}),
|
|
99
|
+
})),
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
package/dist/engine-graph.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* Nothing in chant decides from these facts (ruled on #4520, Q1): they ride
|
|
24
24
|
* on `IRNode.facts` for people and for readers that show the graph.
|
|
25
25
|
*/
|
|
26
|
-
import type
|
|
26
|
+
import { type EdgeGrain, type EngineFacts } from "@intentius/chant/engine-facts";
|
|
27
27
|
/** The conventional place of a plunge member's engine graph, beside the export. */
|
|
28
28
|
export declare const PULUMI_ENGINE_GRAPH_FILE = "engine-graph.json";
|
|
29
29
|
/** One node of the document: a URN, its type, and what plunge's records say about it. */
|
package/dist/engine-graph.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading plunge's engine graph document (#4529): what `plunge graph --json`
|
|
3
|
+
* prints (INTENTIUS/plunge#40, #43), in the shape chant#4520 designed and
|
|
4
|
+
* `@intentius/chant/engine-facts` types. It is a `GraphIR` at version 1 whose
|
|
5
|
+
* `meta.engineGraph` names the engine and the stack, whose node ids are full
|
|
6
|
+
* URNs, and whose nodes carry the engine's facts under `facts`.
|
|
7
|
+
*
|
|
8
|
+
* Two readers use it:
|
|
9
|
+
*
|
|
10
|
+
* - the member graph read (`./workspace-member.ts`), from a checked-in
|
|
11
|
+
* {@link PULUMI_ENGINE_GRAPH_FILE} beside `stack-export.json`. It takes the
|
|
12
|
+
* facts and the `property` edges; `dependencies` and `parent` edges keep
|
|
13
|
+
* coming from the export;
|
|
14
|
+
* - the lexicon's `describeResources` (`./describe-resources.ts`), from one
|
|
15
|
+
* `plunge graph --json --stack <stack>` run per member.
|
|
16
|
+
*
|
|
17
|
+
* Only what the schema names is copied. A fact with a value outside its
|
|
18
|
+
* set is dropped, never guessed at, so a newer plunge that adds a field or a
|
|
19
|
+
* value cannot put anything else on a node. The document holds no output
|
|
20
|
+
* value and no secret (plunge#40's rule), and this reader carries no `attrs`
|
|
21
|
+
* across, so none can reach the graph through it.
|
|
22
|
+
*
|
|
23
|
+
* Nothing in chant decides from these facts (ruled on #4520, Q1): they ride
|
|
24
|
+
* on `IRNode.facts` for people and for readers that show the graph.
|
|
25
|
+
*/
|
|
26
|
+
import { engineGapsOf, engineOwnershipRowsOf, mergeOwnershipRows, withOwnershipRows, } from "@intentius/chant/engine-facts";
|
|
1
27
|
/** The conventional place of a plunge member's engine graph, beside the export. */
|
|
2
28
|
export const PULUMI_ENGINE_GRAPH_FILE = "engine-graph.json";
|
|
3
29
|
const OWNERSHIP = new Set(["bound", "unowned", "pending", "foreign"]);
|
|
@@ -51,6 +77,9 @@ export function engineFactsOf(v) {
|
|
|
51
77
|
}
|
|
52
78
|
if (str(v.observedAt))
|
|
53
79
|
facts.observedAt = v.observedAt;
|
|
80
|
+
const rows = engineOwnershipRowsOf(v.ownershipRows);
|
|
81
|
+
if (rows)
|
|
82
|
+
facts.ownershipRows = rows;
|
|
54
83
|
return Object.keys(facts).length > 0 ? facts : undefined;
|
|
55
84
|
}
|
|
56
85
|
/**
|
|
@@ -73,11 +102,21 @@ export function readPlungeEngineGraph(doc) {
|
|
|
73
102
|
return { error: `it was printed by ${JSON.stringify(engine.name)}, not plunge` };
|
|
74
103
|
if (!Array.isArray(doc.nodes))
|
|
75
104
|
return { error: "it has no nodes list" };
|
|
105
|
+
// Each record plunge could not describe, by URN, as the node's
|
|
106
|
+
// `facts.ownershipRows.gaps` read `graph` (#5402).
|
|
107
|
+
const gapsByUrn = new Map();
|
|
108
|
+
for (const g of Array.isArray(meta.gaps) ? meta.gaps : []) {
|
|
109
|
+
if (!isObject(g) || !str(g.address))
|
|
110
|
+
continue;
|
|
111
|
+
const [gap] = engineGapsOf([{ read: "graph", reason: g.reason, detail: g.detail }]);
|
|
112
|
+
if (gap)
|
|
113
|
+
gapsByUrn.set(g.address, mergeOwnershipRows(gapsByUrn.get(g.address), { gaps: [gap] }));
|
|
114
|
+
}
|
|
76
115
|
const nodes = [];
|
|
77
116
|
for (const n of doc.nodes) {
|
|
78
117
|
if (!isObject(n) || !str(n.id) || !str(n.kind))
|
|
79
118
|
continue;
|
|
80
|
-
const facts = engineFactsOf(n.facts);
|
|
119
|
+
const facts = withOwnershipRows(engineFactsOf(n.facts), gapsByUrn.get(n.id));
|
|
81
120
|
nodes.push({ urn: n.id, kind: n.kind, ...(str(n.physicalId) ? { physicalId: n.physicalId } : {}), ...(facts ? { facts } : {}) });
|
|
82
121
|
}
|
|
83
122
|
const edges = [];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health for a pulumi stack (#5338), through the provider lexicons.
|
|
3
|
+
*
|
|
4
|
+
* A stack's `aws:ecs/service:Service` is the object the aws lexicon reads as
|
|
5
|
+
* `AWS::ECS::Service`, so `chant lifecycle health` hands it to that reader
|
|
6
|
+
* with the id the stack's export recorded. The export is the one the member
|
|
7
|
+
* read in this process loaded (the index store's, else the checked-in
|
|
8
|
+
* `stack-export.json`); nothing else is run. A resource of a type outside
|
|
9
|
+
* {@link PULUMI_HEALTH_TYPES} goes in `uncovered`, and core reports it
|
|
10
|
+
* `unknown`: nothing reads whether it is up.
|
|
11
|
+
*/
|
|
12
|
+
import type { HealthReadOptions, HealthTargetsResult } from "@intentius/chant/lexicon";
|
|
13
|
+
import { type PulumiMemberRead } from "./member-report.js";
|
|
14
|
+
/**
|
|
15
|
+
* Each pulumi resource type a provider lexicon reads health for, with that
|
|
16
|
+
* lexicon and its health type. The docs page on health lists the same table.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PULUMI_HEALTH_TYPES: Readonly<Record<string, {
|
|
19
|
+
lexicon: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}>>;
|
|
22
|
+
/** The ids an export records, keyed as the member read keys its entities (`<label>/<urn tail>`). */
|
|
23
|
+
export declare function exportIds(read: Pick<PulumiMemberRead, "label" | "doc">): Map<string, string>;
|
|
24
|
+
/** `LexiconPlugin.healthTargets` for pulumi. `read` defaults to the member read this process made. */
|
|
25
|
+
export declare function pulumiHealthTargets(options: HealthReadOptions, read?: PulumiMemberRead | undefined): Promise<HealthTargetsResult>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { pulumiNodeKey } from "@intentius/chant/pulumi-urn";
|
|
2
|
+
import { lastMemberRead } from "./member-report.js";
|
|
3
|
+
/**
|
|
4
|
+
* Each pulumi resource type a provider lexicon reads health for, with that
|
|
5
|
+
* lexicon and its health type. The docs page on health lists the same table.
|
|
6
|
+
*/
|
|
7
|
+
export const PULUMI_HEALTH_TYPES = {
|
|
8
|
+
"aws:route53/healthCheck:HealthCheck": { lexicon: "aws", type: "AWS::Route53::HealthCheck" },
|
|
9
|
+
"aws:ecs/service:Service": { lexicon: "aws", type: "AWS::ECS::Service" },
|
|
10
|
+
"azure-native:app:ContainerApp": { lexicon: "azure", type: "Microsoft.App/containerApps" },
|
|
11
|
+
"azure:containerapp/app:App": { lexicon: "azure", type: "Microsoft.App/containerApps" },
|
|
12
|
+
"gcp:cloudrunv2/service:Service": { lexicon: "gcp", type: "GCP::Run::Service" },
|
|
13
|
+
"gcp:cloudrun/service:Service": { lexicon: "gcp", type: "GCP::Run::Service" },
|
|
14
|
+
"gcp:compute/backendService:BackendService": { lexicon: "gcp", type: "GCP::Compute::BackendService" },
|
|
15
|
+
"gcp:compute/regionBackendService:RegionBackendService": { lexicon: "gcp", type: "GCP::Compute::BackendService" },
|
|
16
|
+
"gcp:projects/iAMMember:IAMMember": { lexicon: "gcp", type: "GCP::Iam::PolicyMember" },
|
|
17
|
+
};
|
|
18
|
+
/** The ids an export records, keyed as the member read keys its entities (`<label>/<urn tail>`). */
|
|
19
|
+
export function exportIds(read) {
|
|
20
|
+
const out = new Map();
|
|
21
|
+
const doc = read.doc;
|
|
22
|
+
const resources = Array.isArray(doc?.deployment?.resources) ? doc.deployment.resources : [];
|
|
23
|
+
for (const r of resources) {
|
|
24
|
+
const row = r;
|
|
25
|
+
if (typeof row?.urn !== "string" || typeof row.id !== "string" || row.id === "" || row.delete === true)
|
|
26
|
+
continue;
|
|
27
|
+
const tail = pulumiNodeKey(row.urn);
|
|
28
|
+
if (tail)
|
|
29
|
+
out.set(`${read.label}/${tail}`, row.id);
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
/** `LexiconPlugin.healthTargets` for pulumi. `read` defaults to the member read this process made. */
|
|
34
|
+
export async function pulumiHealthTargets(options, read = lastMemberRead()) {
|
|
35
|
+
const targets = {};
|
|
36
|
+
const unobserved = {};
|
|
37
|
+
const absent = [];
|
|
38
|
+
const uncovered = {};
|
|
39
|
+
const ids = read?.doc !== undefined ? exportIds(read) : undefined;
|
|
40
|
+
for (const [name, { entityType }] of options.entities) {
|
|
41
|
+
const mapped = PULUMI_HEALTH_TYPES[entityType];
|
|
42
|
+
if (!mapped) {
|
|
43
|
+
uncovered[name] = entityType;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!ids) {
|
|
47
|
+
unobserved[name] = { type: mapped.type, reason: "no-binding", detail: "no stack export was read, so there is no recorded id to read health by" };
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const id = ids.get(name);
|
|
51
|
+
if (id)
|
|
52
|
+
targets[name] = { lexicon: mapped.lexicon, type: mapped.type, engineType: entityType, physicalId: id };
|
|
53
|
+
else
|
|
54
|
+
absent.push(name);
|
|
55
|
+
}
|
|
56
|
+
return { targets, unobserved, absent, uncovered };
|
|
57
|
+
}
|