@intentius/chant-lexicon-pulumi 0.124.102 → 0.124.104
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/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { pulumiPlugin } from "./plugin.js";
|
|
2
|
+
export { PULUMI_REFERENCE_CATALOG, CATALOGUED_KINDS, REFERENCES_NOTHING, isUnresolvedKind } from "./reference-catalog.js";
|
|
3
|
+
export { PULUMI_REFERENCE_CATALOG_FLOOR, PULUMI_COST_HOLD_FLOOR, PULUMI_PREVIEW_OBSERVATION_FLOOR, PULUMI_STACK_REFERENCE_GRAPH_FLOOR } from "./chant-floors.js";
|
|
4
|
+
export { pulumiCostHold, type PulumiCostHold } from "./cost-hold.js";
|
|
5
|
+
export { observePreview, PLANNED_STATUS, PREVIEW_ATTRIBUTE_NAMES, PREVIEW_READ_REASONS, PREVIEW_SOURCE, previewReadReason, PULUMI_OBSERVE_ENV, type PulumiObserveDepth, type PreviewReadReason } from "./preview-observation.js";
|
|
2
6
|
export { pulumiSerializer } from "./serializer.js";
|
|
3
7
|
export { pulumiConfigSchema, pulumiMemberConfigSchema, type PulumiConfig } from "./config.js";
|
|
4
8
|
export { readPulumiMember, PULUMI_EXPORT_FILE, type PulumiMemberConfig, type PulumiMemberReport } from "./workspace-member.js";
|
|
@@ -24,3 +28,6 @@ export { parsePlungeAdoptView, pulumiAdoptDigest, adoptBucketTarget, type Plunge
|
|
|
24
28
|
export { pulumiPreview as pulumiPreviewStep, pulumiDrift as pulumiDriftStep } from "./op/builders.js";
|
|
25
29
|
export { pulumiExitOf, pulumiPlanMoved, PULUMI_EXIT, PLUNGE_PLAN_MOVED_EXIT } from "./exit-codes.js";
|
|
26
30
|
export { pulumiPlannedOutputChanges, type PulumiOutputChange, type PulumiPlannedOutputChanges } from "./planned-output-changes.js";
|
|
31
|
+
export { classifyPulumiDisruption, pulumiDisruptionQueries, pulumiStepsVerdict } from "./disruption.js";
|
|
32
|
+
export { PULUMI_HEALTH_TYPES, pulumiHealthTargets, exportIds as pulumiExportIds } from "./health-targets.js";
|
|
33
|
+
export { PULUMI_HEALTH_DISRUPTION_FLOOR, PULUMI_PREVIEW_DISRUPTION_FLOOR, PULUMI_OWNERSHIP_ROWS_FLOOR, PULUMI_COMPONENT_GROUPS_FLOOR } from "./chant-floors.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { pulumiPlugin } from "./plugin.js";
|
|
2
|
+
export { PULUMI_REFERENCE_CATALOG, CATALOGUED_KINDS, REFERENCES_NOTHING, isUnresolvedKind } from "./reference-catalog.js";
|
|
3
|
+
export { PULUMI_REFERENCE_CATALOG_FLOOR, PULUMI_COST_HOLD_FLOOR, PULUMI_PREVIEW_OBSERVATION_FLOOR, PULUMI_STACK_REFERENCE_GRAPH_FLOOR } from "./chant-floors.js";
|
|
4
|
+
export { pulumiCostHold } from "./cost-hold.js";
|
|
5
|
+
export { observePreview, PLANNED_STATUS, PREVIEW_ATTRIBUTE_NAMES, PREVIEW_READ_REASONS, PREVIEW_SOURCE, previewReadReason, PULUMI_OBSERVE_ENV } from "./preview-observation.js";
|
|
2
6
|
export { pulumiSerializer } from "./serializer.js";
|
|
3
7
|
export { pulumiConfigSchema, pulumiMemberConfigSchema } from "./config.js";
|
|
4
8
|
export { readPulumiMember, PULUMI_EXPORT_FILE } from "./workspace-member.js";
|
|
@@ -29,3 +33,7 @@ export { pulumiPreview as pulumiPreviewStep, pulumiDrift as pulumiDriftStep } fr
|
|
|
29
33
|
export { pulumiExitOf, pulumiPlanMoved, PULUMI_EXIT, PLUNGE_PLAN_MOVED_EXIT } from "./exit-codes.js";
|
|
30
34
|
// Which stack outputs a preview changes, traced through the export (#4635).
|
|
31
35
|
export { pulumiPlannedOutputChanges } from "./planned-output-changes.js";
|
|
36
|
+
// Disruption from a preview's steps and health through the provider lexicons (#5338).
|
|
37
|
+
export { classifyPulumiDisruption, pulumiDisruptionQueries, pulumiStepsVerdict } from "./disruption.js";
|
|
38
|
+
export { PULUMI_HEALTH_TYPES, pulumiHealthTargets, exportIds as pulumiExportIds } from "./health-targets.js";
|
|
39
|
+
export { PULUMI_HEALTH_DISRUPTION_FLOOR, PULUMI_PREVIEW_DISRUPTION_FLOOR, PULUMI_OWNERSHIP_ROWS_FLOOR, PULUMI_COMPONENT_GROUPS_FLOOR } from "./chant-floors.js";
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "433f8f0ab61453c51b6bb7f21ab08a4021b5181225350a074f11b7b984407d33",
|
|
5
5
|
"meta.json": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
|
|
6
6
|
"types/index.d.ts": "883bcdf6a960e21360e79df010ca2087719fffec60fc39541c5ecd32d661e328",
|
|
7
7
|
"rules/member-dir-absolute.ts": "4805d5e247ad544f942e1b2c36fc15a5087ca0aacaf804183a269021bd60e276",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"skills/chant-pulumi-stack-export.md": "aadd67f5e067de61dfda43d57492bca08bd22429e4baf314d6856a810dc0e8dc",
|
|
26
26
|
"skills/chant-pulumi-plunge.md": "8a7f2f9f1124744dee9645905f141057ca01f5a88e34e1bc3858d69406d7ff3a"
|
|
27
27
|
},
|
|
28
|
-
"composite": "
|
|
28
|
+
"composite": "45dddda999aca2ecb82bfda2b158b830f77b959f8ac622f517a1dd409f34d63e"
|
|
29
29
|
}
|
package/dist/manifest.json
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
* - `describeResources`, engine facts for a member on plunge from `plunge
|
|
22
22
|
* graph --json` (`./describe-resources.ts`, #4529), and a plunge member's
|
|
23
23
|
* checked-in `engine-graph.json` in the member read (`./engine-graph.ts`);
|
|
24
|
+
* - a `referenceCatalog` (`./reference-catalog.ts`, #5330): ARN, id and name
|
|
25
|
+
* references among the aws, gcp, azure and kubernetes providers' resources,
|
|
26
|
+
* read by `chant workspace graph`'s catalog pass;
|
|
24
27
|
* - the checks a pulumi surface admits (#4468): PUL101 over `pulumi.member`
|
|
25
28
|
* in source, PUL001 and PUL002 over the member read (`./lint/`);
|
|
26
29
|
* - completion and hover over `Pulumi.yaml`, a stack's `Pulumi.<stack>.yaml`,
|
|
@@ -35,7 +38,10 @@
|
|
|
35
38
|
* a `Pulumi.yaml`, and three `chant init` templates (`./init-templates.ts`);
|
|
36
39
|
* - review stacks in a pull request's environment (#4609): `prEnvTemplate`
|
|
37
40
|
* takes a `<project>/<stack>` template, and `prEnvTeardown` removes the
|
|
38
|
-
* environment's `pr-<n>` stacks (`./review-stack.ts`)
|
|
41
|
+
* environment's `pr-<n>` stacks (`./review-stack.ts`);
|
|
42
|
+
* - `classifyDisruption` from a preview's steps (`./disruption.ts`) and
|
|
43
|
+
* `healthTargets`, health through the provider lexicons with ids from the
|
|
44
|
+
* stack's export (`./health-targets.ts`), #5338.
|
|
39
45
|
*/
|
|
40
46
|
import { pulumiCheckSteps } from "./check-step.js";
|
|
41
47
|
import { pulumiCiSetup } from "./ci-setup.js";
|
|
@@ -52,6 +58,7 @@ import { hover } from "./lsp/hover.js";
|
|
|
52
58
|
import { PULUMI_RUNTIME_NAMES } from "./lsp/keys.js";
|
|
53
59
|
import { pulumiInitTemplates } from "./init-templates.js";
|
|
54
60
|
import { pulumiTemplateStack, reviewStackTeardown } from "./review-stack.js";
|
|
61
|
+
import { PULUMI_REFERENCE_CATALOG } from "./reference-catalog.js";
|
|
55
62
|
const loadSkills = createSkillsLoader(import.meta.url, [
|
|
56
63
|
{
|
|
57
64
|
file: "chant-pulumi.md",
|
|
@@ -71,6 +78,8 @@ const loadSkills = createSkillsLoader(import.meta.url, [
|
|
|
71
78
|
]);
|
|
72
79
|
export const pulumiPlugin = {
|
|
73
80
|
name: "pulumi",
|
|
81
|
+
// How a stack's resources name each other, for chant's catalog pass over a declared graph (#5330); see its module doc.
|
|
82
|
+
referenceCatalog: PULUMI_REFERENCE_CATALOG,
|
|
74
83
|
serializer: pulumiSerializer,
|
|
75
84
|
configSchema: pulumiConfigSchema,
|
|
76
85
|
// #4550: the engine install lines for the pull request pipeline's default image.
|
|
@@ -97,6 +106,11 @@ export const pulumiPlugin = {
|
|
|
97
106
|
const words = activeProductWords();
|
|
98
107
|
return pulumiTipsDetail({ member: input.member, changeSet: input.changeSet, words: { product: words.product, noun: words.noun } });
|
|
99
108
|
},
|
|
109
|
+
// StackReference reads between pulumi members, for `chant workspace graph` (#5331); see ./workspace-stack-reads.ts.
|
|
110
|
+
async workspaceStackReads(ctx) {
|
|
111
|
+
const { pulumiWorkspaceStackReads } = await import("./workspace-stack-reads.js");
|
|
112
|
+
return pulumiWorkspaceStackReads(ctx);
|
|
113
|
+
},
|
|
100
114
|
// A pulumi workspace member's reader project (#3179): its stack export from
|
|
101
115
|
// the index store, else the checked-in one, never the program. See ./workspace-member.ts. `chant workspace
|
|
102
116
|
// graph` writes `dir` absolute; a project that writes the namespace itself
|
|
@@ -155,6 +169,24 @@ export const pulumiPlugin = {
|
|
|
155
169
|
* refresh --preview-only --target` per resource, or `plunge drift
|
|
156
170
|
* --resource --stream` for a member on plunge. See `./drift-read.ts`.
|
|
157
171
|
*/
|
|
172
|
+
/**
|
|
173
|
+
* What applying a planned update costs, from a preview's steps (#5338). A
|
|
174
|
+
* query carries the steps as `previewSteps` or a preview node's `planActions`; `pulumiDisruptionQueries`
|
|
175
|
+
* builds them from `pulumi preview --json`. See `./disruption.ts`.
|
|
176
|
+
*/
|
|
177
|
+
async classifyDisruption(options) {
|
|
178
|
+
const { classifyPulumiDisruption } = await import("./disruption.js");
|
|
179
|
+
return classifyPulumiDisruption(options);
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* Health for a stack's resources through the provider lexicons (#5338):
|
|
183
|
+
* each covered type mapped to its provider's health type, with the id from
|
|
184
|
+
* the stack's export. See `./health-targets.ts`.
|
|
185
|
+
*/
|
|
186
|
+
async healthTargets(options) {
|
|
187
|
+
const { pulumiHealthTargets } = await import("./health-targets.js");
|
|
188
|
+
return pulumiHealthTargets(options);
|
|
189
|
+
},
|
|
158
190
|
async readDrift(options) {
|
|
159
191
|
const { readPulumiDrift } = await import("./drift-read.js");
|
|
160
192
|
return readPulumiDrift(options);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The preview depth (#5332): `pulumi preview --json`, or `plunge preview`
|
|
3
|
+
* for a member on plunge, read as an observation of the member. It is the
|
|
4
|
+
* pulumi counterpart of the terraform lexicon's plan depth
|
|
5
|
+
* (`CHANT_TERRAFORM_OBSERVE=plan`, `plan-observation.ts`), and carries the
|
|
6
|
+
* same attribute names so one reader serves both.
|
|
7
|
+
*
|
|
8
|
+
* The steps are parsed by `./change-set.ts` (`pulumiSteps`,
|
|
9
|
+
* `pulumiStepsAction`, `pulumiStepStates`); this module only projects them.
|
|
10
|
+
*
|
|
11
|
+
* | preview | node attribute |
|
|
12
|
+
* |---|---|
|
|
13
|
+
* | the URN's steps, as one action | `planAction` (`create`, `update`, `replace`, `delete`, `no-op`, `read`, `forget`) |
|
|
14
|
+
* | the ops of each step | `planActions`, by URN |
|
|
15
|
+
* | a replace that deletes first, an import | `planActionReason` |
|
|
16
|
+
* | `replaceReasons` | `planReplacePaths` |
|
|
17
|
+
* | inputs that hold the unknown sentinel | `planAfterUnknown` |
|
|
18
|
+
* | inputs that differ on an update or replace | `planChanges`, one entry per leaf |
|
|
19
|
+
* | the step state's `parent`, when the graph holds that node | `ResourceMetadata.component`, the node's `IRNode.component` (#5403) |
|
|
20
|
+
*
|
|
21
|
+
* A resource the member's graph already has (declared by the export) gets
|
|
22
|
+
* these on its node. A resource it does not have, which is every resource
|
|
23
|
+
* when the stack has no export, becomes a node of its own with status
|
|
24
|
+
* `planned`, carrying the same inputs a node read from an export carries
|
|
25
|
+
* (`./reference-props.ts`) beside the plan attributes. A declared resource
|
|
26
|
+
* the preview lists no step for is not observed (`not-reached`).
|
|
27
|
+
*
|
|
28
|
+
* ## What never reaches a node
|
|
29
|
+
*
|
|
30
|
+
* The filter is `./reference-props.ts`'s: a secret (the envelope or the
|
|
31
|
+
* blinded `"[secret]"`), a value under a key that reads as a credential, the
|
|
32
|
+
* `data`, `stringData` and `binaryData` of a Kubernetes Secret or ConfigMap,
|
|
33
|
+
* and a string longer than a name are left out of `planChanges`, of
|
|
34
|
+
* `planReplacePaths` and of the inputs. A change under such a key is not
|
|
35
|
+
* listed at all, so it can't show a secret's before or after. Only leaves
|
|
36
|
+
* are emitted. An unknown after value reads {@link KNOWN_AFTER_APPLY}.
|
|
37
|
+
*
|
|
38
|
+
* ## Why a read did not answer
|
|
39
|
+
*
|
|
40
|
+
* {@link previewReadReason} turns the engine's error into one of
|
|
41
|
+
* {@link PREVIEW_READ_REASONS}, written on the member's `rootReads` entry
|
|
42
|
+
* (`pulumi.members.<member>`) with `depth: "preview"`.
|
|
43
|
+
*/
|
|
44
|
+
import type { ResourceMetadata } from "@intentius/chant/lexicon";
|
|
45
|
+
import type { UnobservedEntity } from "@intentius/chant/observation";
|
|
46
|
+
/** The environment variable that sets how deep a pulumi member is read (#5332). */
|
|
47
|
+
export declare const PULUMI_OBSERVE_ENV = "CHANT_PULUMI_OBSERVE";
|
|
48
|
+
/** `state` is the default read (the export and plunge's records); `preview` adds the engine's preview. */
|
|
49
|
+
export type PulumiObserveDepth = "state" | "preview";
|
|
50
|
+
/** The `sources` value on each resource the preview answered. */
|
|
51
|
+
export declare const PREVIEW_SOURCE = "preview";
|
|
52
|
+
/** What stands in for a value the preview can't know yet, as in the terraform plan observation. */
|
|
53
|
+
export declare const KNOWN_AFTER_APPLY = "(known after apply)";
|
|
54
|
+
/** The status of a node that exists only in the preview. */
|
|
55
|
+
export declare const PLANNED_STATUS = "planned";
|
|
56
|
+
/** Every attribute the preview depth adds to a node, named as the terraform plan depth names them. */
|
|
57
|
+
export declare const PREVIEW_ATTRIBUTE_NAMES: readonly ["planAction", "planActions", "planActionReason", "planReplacePaths", "planAfterUnknown", "planChanges"];
|
|
58
|
+
/** Why a preview read did not answer, on `rootReads[...].reason`. */
|
|
59
|
+
export declare const PREVIEW_READ_REASONS: {
|
|
60
|
+
readonly "no-credentials": "the cloud provider or the backend refused the engine's credentials, or none were found";
|
|
61
|
+
readonly "needs-install": "the program's dependencies or a provider plugin are not installed; chant never runs `pulumi install` on a read";
|
|
62
|
+
readonly "no-stack": "the member names no stack and the engine has none selected, or the stack does not exist";
|
|
63
|
+
readonly "no-binary": "the engine binary is not on PATH";
|
|
64
|
+
readonly "preview-failed": "the preview failed for another reason; the engine's first error line is in the note";
|
|
65
|
+
};
|
|
66
|
+
export type PreviewReadReason = keyof typeof PREVIEW_READ_REASONS;
|
|
67
|
+
/** The reason an engine error maps to. First match wins, in the order of {@link PREVIEW_READ_REASONS} less `preview-failed`. */
|
|
68
|
+
export declare function previewReadReason(error: string): PreviewReadReason;
|
|
69
|
+
/** One leaf that differs between the two sides of a planned change. Same fields as the terraform plan depth's. */
|
|
70
|
+
export interface PreviewValueChange {
|
|
71
|
+
path: string;
|
|
72
|
+
before: unknown;
|
|
73
|
+
after: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** Render one path as one string: keys joined with `.`, indexes and non-identifier keys in brackets. */
|
|
76
|
+
export declare function renderPath(segments: ReadonlyArray<string | number>): string;
|
|
77
|
+
/** What the preview says about a member, in the shape `describeResources` returns. */
|
|
78
|
+
export interface PreviewObserved {
|
|
79
|
+
resources: Record<string, ResourceMetadata>;
|
|
80
|
+
unobserved: Record<string, UnobservedEntity>;
|
|
81
|
+
queried: Record<string, string>;
|
|
82
|
+
sources: Record<string, string>;
|
|
83
|
+
/** Steps whose op the change set has no action for; their `planAction` lists the ops. */
|
|
84
|
+
unmapped: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The member's preview as resources keyed `<label>/<urn tail>`, the key the
|
|
88
|
+
* graph read uses. `declared` are the entities the graph already holds.
|
|
89
|
+
* Returns undefined when the document has no steps.
|
|
90
|
+
*/
|
|
91
|
+
export declare function observePreview(opts: {
|
|
92
|
+
label: string;
|
|
93
|
+
preview: unknown;
|
|
94
|
+
declared: ReadonlyMap<string, {
|
|
95
|
+
entityType: string;
|
|
96
|
+
}>;
|
|
97
|
+
}): PreviewObserved | undefined;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { isPulumiNodeless, pulumiNodeKey } from "@intentius/chant/pulumi-urn";
|
|
2
|
+
import { pulumiStepStates, pulumiSteps, pulumiStepsAction } from "./change-set.js";
|
|
3
|
+
import { isNameSized, mayCarryKey, referenceProps } from "./reference-props.js";
|
|
4
|
+
import { holdsUnknown, isObject, isSecret, isUnknown, propertyKeys, propertyPathSegments, sameJson, topLevelKey } from "./values.js";
|
|
5
|
+
/** The environment variable that sets how deep a pulumi member is read (#5332). */
|
|
6
|
+
export const PULUMI_OBSERVE_ENV = "CHANT_PULUMI_OBSERVE";
|
|
7
|
+
/** The `sources` value on each resource the preview answered. */
|
|
8
|
+
export const PREVIEW_SOURCE = "preview";
|
|
9
|
+
/** What stands in for a value the preview can't know yet, as in the terraform plan observation. */
|
|
10
|
+
export const KNOWN_AFTER_APPLY = "(known after apply)";
|
|
11
|
+
/** The status of a node that exists only in the preview. */
|
|
12
|
+
export const PLANNED_STATUS = "planned";
|
|
13
|
+
/** Every attribute the preview depth adds to a node, named as the terraform plan depth names them. */
|
|
14
|
+
export const PREVIEW_ATTRIBUTE_NAMES = ["planAction", "planActions", "planActionReason", "planReplacePaths", "planAfterUnknown", "planChanges"];
|
|
15
|
+
/** Why a preview read did not answer, on `rootReads[...].reason`. */
|
|
16
|
+
export const PREVIEW_READ_REASONS = {
|
|
17
|
+
"no-credentials": "the cloud provider or the backend refused the engine's credentials, or none were found",
|
|
18
|
+
"needs-install": "the program's dependencies or a provider plugin are not installed; chant never runs `pulumi install` on a read",
|
|
19
|
+
"no-stack": "the member names no stack and the engine has none selected, or the stack does not exist",
|
|
20
|
+
"no-binary": "the engine binary is not on PATH",
|
|
21
|
+
"preview-failed": "the preview failed for another reason; the engine's first error line is in the note",
|
|
22
|
+
};
|
|
23
|
+
/** The reason an engine error maps to. First match wins, in the order of {@link PREVIEW_READ_REASONS} less `preview-failed`. */
|
|
24
|
+
export function previewReadReason(error) {
|
|
25
|
+
if (/binary was not found|command not found|ENOENT/i.test(error))
|
|
26
|
+
return "no-binary";
|
|
27
|
+
if (/no stack selected|no stacks? (found|exist)|no stack named|stack ['"]?[\w./:-]+['"]? (does not exist|not found)|stack not found/i.test(error))
|
|
28
|
+
return "no-stack";
|
|
29
|
+
if (/pulumi install|npm install|yarn install|pnpm install|cannot find module|node_modules|no resource plugin|failed to load language plugin|could not find (a )?(compatible )?plugin|ModuleNotFoundError|No module named/i.test(error)) {
|
|
30
|
+
return "needs-install";
|
|
31
|
+
}
|
|
32
|
+
if (/no valid credential sources|NoCredentialProviders|could not find default credentials|InvalidAccessKeyId|failed to refresh cached credentials|AADSTS|token has expired|PULUMI_ACCESS_TOKEN|not logged in|you must be logged in|no credentials|unauthorized|authentication required/i.test(error)) {
|
|
33
|
+
return "no-credentials";
|
|
34
|
+
}
|
|
35
|
+
return "preview-failed";
|
|
36
|
+
}
|
|
37
|
+
/** Render one path as one string: keys joined with `.`, indexes and non-identifier keys in brackets. */
|
|
38
|
+
export function renderPath(segments) {
|
|
39
|
+
let out = "";
|
|
40
|
+
for (const segment of segments) {
|
|
41
|
+
if (typeof segment === "number")
|
|
42
|
+
out += `[${segment}]`;
|
|
43
|
+
else if (/^[A-Za-z_][A-Za-z0-9_-]*$/.test(segment))
|
|
44
|
+
out += out ? `.${segment}` : segment;
|
|
45
|
+
else
|
|
46
|
+
out += `[${JSON.stringify(segment)}]`;
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
const containerOf = (v) => Array.isArray(v) || isObject(v);
|
|
51
|
+
/** A scalar for the before side of an unknown, or null. */
|
|
52
|
+
function scalar(v) {
|
|
53
|
+
if (v === undefined || v === null || containerOf(v) || isSecret(v))
|
|
54
|
+
return null;
|
|
55
|
+
if (typeof v === "string" && !isNameSized(v))
|
|
56
|
+
return null;
|
|
57
|
+
return v;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The leaves where two input values differ, filtered as the module comment
|
|
61
|
+
* says. `unknownPaths` collects every path whose after side is unknown.
|
|
62
|
+
*/
|
|
63
|
+
function diffValues(type, before, after, at, changes, unknownPaths) {
|
|
64
|
+
const last = at[at.length - 1];
|
|
65
|
+
if (typeof last === "string" && !mayCarryKey(last, { type, topLevel: at.length === 1 }))
|
|
66
|
+
return;
|
|
67
|
+
if (isSecret(before) || isSecret(after))
|
|
68
|
+
return;
|
|
69
|
+
const path = renderPath(at) || "*";
|
|
70
|
+
if (isUnknown(after)) {
|
|
71
|
+
unknownPaths.push(path);
|
|
72
|
+
changes.push({ path, before: scalar(before), after: KNOWN_AFTER_APPLY });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (sameJson(before, after))
|
|
76
|
+
return;
|
|
77
|
+
if (Array.isArray(before) || Array.isArray(after)) {
|
|
78
|
+
const b = Array.isArray(before) ? before : [];
|
|
79
|
+
const a = Array.isArray(after) ? after : [];
|
|
80
|
+
for (let i = 0; i < Math.max(b.length, a.length); i++)
|
|
81
|
+
diffValues(type, b[i], a[i], [...at, i], changes, unknownPaths);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (isObject(before) || isObject(after)) {
|
|
85
|
+
const b = isObject(before) ? before : {};
|
|
86
|
+
const a = isObject(after) ? after : {};
|
|
87
|
+
for (const key of [...new Set([...Object.keys(b), ...Object.keys(a)])].sort()) {
|
|
88
|
+
if (key.startsWith("__"))
|
|
89
|
+
continue;
|
|
90
|
+
diffValues(type, b[key], a[key], [...at, key], changes, unknownPaths);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if ((typeof before === "string" && !isNameSized(before)) || (typeof after === "string" && !isNameSized(after)))
|
|
95
|
+
return;
|
|
96
|
+
changes.push({ path, before: before === undefined ? null : before, after: after === undefined ? null : after });
|
|
97
|
+
}
|
|
98
|
+
/** The plan attributes of one URN's steps. */
|
|
99
|
+
function attributesOf(urn, steps) {
|
|
100
|
+
const states = pulumiStepStates(steps);
|
|
101
|
+
const mapped = pulumiStepsAction(steps);
|
|
102
|
+
const type = states.after?.type ?? states.before?.type ?? "unknown";
|
|
103
|
+
const knownId = [states.after?.id, states.before?.id].find((v) => typeof v === "string" && v !== "" && !isUnknown(v));
|
|
104
|
+
const ops = steps.map((s) => s.op ?? "");
|
|
105
|
+
const action = mapped ? mapped.action : ops.join(",");
|
|
106
|
+
const after = isObject(states.after?.inputs) ? states.after.inputs : {};
|
|
107
|
+
const before = isObject(states.before?.inputs) ? states.before.inputs : {};
|
|
108
|
+
const named = new Set();
|
|
109
|
+
const replaceReasons = [];
|
|
110
|
+
for (const s of steps) {
|
|
111
|
+
for (const k of s.diffReasons ?? [])
|
|
112
|
+
named.add(topLevelKey(k));
|
|
113
|
+
for (const [path] of Object.entries(s.detailedDiff ?? {}))
|
|
114
|
+
named.add(topLevelKey(path));
|
|
115
|
+
for (const k of s.replaceReasons ?? [])
|
|
116
|
+
if (!replaceReasons.includes(k))
|
|
117
|
+
replaceReasons.push(k);
|
|
118
|
+
}
|
|
119
|
+
const changes = [];
|
|
120
|
+
const unknownPaths = [];
|
|
121
|
+
if (mapped?.action === "create") {
|
|
122
|
+
for (const k of propertyKeys(after).sort()) {
|
|
123
|
+
if (holdsUnknown(after[k]))
|
|
124
|
+
diffValues(type, undefined, after[k], [k], [], unknownPaths);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (mapped?.action === "update" || mapped?.action === "replace") {
|
|
128
|
+
const keys = new Set([...named, ...propertyKeys(after).filter((k) => holdsUnknown(after[k]))]);
|
|
129
|
+
for (const k of [...keys].filter((k) => !k.startsWith("__")).sort())
|
|
130
|
+
diffValues(type, before[k], after[k], [k], changes, unknownPaths);
|
|
131
|
+
}
|
|
132
|
+
const reasons = [];
|
|
133
|
+
if (mapped?.action === "replace" && mapped.disruption === "destroy")
|
|
134
|
+
reasons.push("delete-before-replace");
|
|
135
|
+
if (mapped?.importing)
|
|
136
|
+
reasons.push("import");
|
|
137
|
+
const replacePaths = replaceReasons
|
|
138
|
+
.filter((p) => propertyPathSegments(p).every((seg, i) => typeof seg === "number" || mayCarryKey(seg, { type, topLevel: i === 0 })))
|
|
139
|
+
.map((p) => renderPath(propertyPathSegments(p)));
|
|
140
|
+
return {
|
|
141
|
+
type,
|
|
142
|
+
...(knownId ? { id: knownId } : {}),
|
|
143
|
+
attributes: {
|
|
144
|
+
urn,
|
|
145
|
+
planAction: action,
|
|
146
|
+
planActions: { [urn]: ops },
|
|
147
|
+
...(reasons.length > 0 ? { planActionReason: reasons.join(",") } : {}),
|
|
148
|
+
...(replacePaths.length > 0 ? { planReplacePaths: replacePaths.sort() } : {}),
|
|
149
|
+
...(unknownPaths.length > 0 ? { planAfterUnknown: [...new Set(unknownPaths)].sort() } : {}),
|
|
150
|
+
...(changes.length > 0 ? { planChanges: changes } : {}),
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The member's preview as resources keyed `<label>/<urn tail>`, the key the
|
|
156
|
+
* graph read uses. `declared` are the entities the graph already holds.
|
|
157
|
+
* Returns undefined when the document has no steps.
|
|
158
|
+
*/
|
|
159
|
+
export function observePreview(opts) {
|
|
160
|
+
const steps = pulumiSteps(opts.preview);
|
|
161
|
+
if (steps === undefined)
|
|
162
|
+
return undefined;
|
|
163
|
+
const byUrn = new Map();
|
|
164
|
+
for (const s of steps) {
|
|
165
|
+
const list = byUrn.get(s.urn) ?? [];
|
|
166
|
+
list.push(s);
|
|
167
|
+
byUrn.set(s.urn, list);
|
|
168
|
+
}
|
|
169
|
+
const resources = {};
|
|
170
|
+
const queried = {};
|
|
171
|
+
const sources = {};
|
|
172
|
+
const parents = new Map();
|
|
173
|
+
let unmapped = 0;
|
|
174
|
+
for (const [urn, list] of byUrn) {
|
|
175
|
+
const key = pulumiNodeKey(urn);
|
|
176
|
+
if (key === null)
|
|
177
|
+
continue;
|
|
178
|
+
const { type, id, attributes } = attributesOf(urn, list);
|
|
179
|
+
if (isPulumiNodeless(type))
|
|
180
|
+
continue;
|
|
181
|
+
const name = `${opts.label}/${key}`;
|
|
182
|
+
if (!pulumiStepsAction(list))
|
|
183
|
+
unmapped++;
|
|
184
|
+
const declared = opts.declared.has(name);
|
|
185
|
+
const states = pulumiStepStates(list);
|
|
186
|
+
const parent = states.after?.parent ?? states.before?.parent;
|
|
187
|
+
const parentKey = typeof parent === "string" ? pulumiNodeKey(parent) : null;
|
|
188
|
+
if (parentKey !== null && parentKey !== key)
|
|
189
|
+
parents.set(name, `${opts.label}/${parentKey}`);
|
|
190
|
+
const inputs = declared ? {} : referenceProps({ type, id, inputs: states.after?.inputs ?? states.before?.inputs, outputs: states.before?.outputs });
|
|
191
|
+
resources[name] = {
|
|
192
|
+
type,
|
|
193
|
+
...(id ? { physicalId: id } : {}),
|
|
194
|
+
status: declared ? "recorded" : PLANNED_STATUS,
|
|
195
|
+
// Never a verdict: a preview says what would run, not whose the resource is.
|
|
196
|
+
ownership: "unknown",
|
|
197
|
+
attributes: { ...inputs, ...attributes },
|
|
198
|
+
};
|
|
199
|
+
queried[name] = `${urn} (preview)`;
|
|
200
|
+
sources[name] = PREVIEW_SOURCE;
|
|
201
|
+
}
|
|
202
|
+
// The component that registered each node (#5403), when the graph will hold it.
|
|
203
|
+
for (const [name, parent] of parents) {
|
|
204
|
+
if (resources[parent] || opts.declared.has(parent))
|
|
205
|
+
resources[name].component = parent;
|
|
206
|
+
}
|
|
207
|
+
const unobserved = {};
|
|
208
|
+
for (const [name, entity] of opts.declared) {
|
|
209
|
+
if (resources[name])
|
|
210
|
+
continue;
|
|
211
|
+
unobserved[name] = {
|
|
212
|
+
type: entity.entityType,
|
|
213
|
+
reason: "not-reached",
|
|
214
|
+
detail: `the preview lists no step for ${name}; a preview narrowed with --target lists only its targets`,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return { resources, unobserved, queried, sources, unmapped };
|
|
218
|
+
}
|
package/dist/pulumi-up.d.ts
CHANGED
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
* `pr-env up` keeps on the environment's record and `pr-env down` and the
|
|
136
136
|
* TTL sweep read back to destroy and remove it (`reviewStackTeardown`).
|
|
137
137
|
*/
|
|
138
|
-
import type { Capability, DeclaredRead, DeclaredReadMember, DeclaredReadsContext, ReleaseInputs, ReleaseInputsContext, ReleaseInputsUnbound } from "@intentius/chant/components/capability";
|
|
138
|
+
import type { Capability, DeclaredRead, DeclaredReadMember, DeclaredReadsContext, GraphRead, ReleaseInputs, ReleaseInputsContext, ReleaseInputsUnbound } from "@intentius/chant/components/capability";
|
|
139
139
|
import { type PlanShape } from "@intentius/chant/components/covered-round";
|
|
140
140
|
import type { GatePolicyFindings } from "@intentius/chant/gate-policy";
|
|
141
141
|
import type { SnapshotStore } from "@intentius/chant/lifecycle/snapshot-store";
|
|
@@ -236,6 +236,12 @@ export interface PulumiUpArtifact {
|
|
|
236
236
|
scratch: string;
|
|
237
237
|
/** plunge's saved plan. plunge only. */
|
|
238
238
|
planFile?: string;
|
|
239
|
+
/**
|
|
240
|
+
* The preview as a JSON document (`steps`, `diagnostics`, `changeSummary`),
|
|
241
|
+
* in `scratch`, for a wave's cost hold to price as `{planJson}` (#5341).
|
|
242
|
+
* Both engines write it.
|
|
243
|
+
*/
|
|
244
|
+
planJson?: string;
|
|
239
245
|
/** The scratch copy of the stack's config, when the step has `config`. */
|
|
240
246
|
configFile?: string;
|
|
241
247
|
/** CrossGuard's findings from the plan's preview. */
|
|
@@ -376,9 +382,33 @@ export declare function pulumiReviewStep(input: PulumiUpStepInput, env: string |
|
|
|
376
382
|
export declare function pulumiUpEngineBin(input: Pick<PulumiUpStepInput, "engineVersion" | "engineRoot">, engine: PulumiMemberEngine): string | undefined;
|
|
377
383
|
/** When the exported stack last updated (#4617): `deployment.manifest.time`, when it is a time. */
|
|
378
384
|
export declare function exportUpdatedAt(exported: unknown): string | undefined;
|
|
385
|
+
/** One step `StackReference` reads resolved: who reads, which stack, and the outputs the export recorded. */
|
|
386
|
+
export interface PulumiStackRead {
|
|
387
|
+
reader: string;
|
|
388
|
+
index: number;
|
|
389
|
+
ref: string;
|
|
390
|
+
/** The component that deploys the stack read, or the stack as `org/project/stack` (`project/stack` with no org named) when none does. */
|
|
391
|
+
target: {
|
|
392
|
+
upstream: string;
|
|
393
|
+
} | {
|
|
394
|
+
external: string;
|
|
395
|
+
};
|
|
396
|
+
/** Recorded outputs, secret ones left out (a secret one has no value to wire). */
|
|
397
|
+
outputs: string[];
|
|
398
|
+
/** Recorded outputs that are secret. Their names are read; no value is. */
|
|
399
|
+
secretOutputs: string[];
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* The one reader behind `declaredReads` (#4547) and `graphReads` (#5331):
|
|
403
|
+
* each step's `StackReference`s, read from its export (the index store's,
|
|
404
|
+
* else the checked-in one), each resolved to the one other `pulumi-up` step
|
|
405
|
+
* whose project and stack it names, else to the stack it names.
|
|
406
|
+
*/
|
|
407
|
+
export declare function pulumiStackReads(ctx: DeclaredReadsContext, members: readonly DeclaredReadMember[], opts?: {
|
|
408
|
+
exportStore?: SnapshotStore | null;
|
|
409
|
+
}): Promise<PulumiStackRead[]>;
|
|
379
410
|
/**
|
|
380
|
-
* `declaredReads` (#4547): each step's `StackReference`s
|
|
381
|
-
* export (the index store's, else the checked-in one), as reads of the one
|
|
411
|
+
* `declaredReads` (#4547): each step's `StackReference`s as reads of the one
|
|
382
412
|
* other `pulumi-up` step whose project and stack the reference names, one
|
|
383
413
|
* per output the export recorded that is not secret, placed at
|
|
384
414
|
* `/stackReferences/<reference name>/<output>`.
|
|
@@ -386,6 +416,15 @@ export declare function exportUpdatedAt(exported: unknown): string | undefined;
|
|
|
386
416
|
export declare function pulumiDeclaredReads(ctx: DeclaredReadsContext, members: readonly DeclaredReadMember[], opts?: {
|
|
387
417
|
exportStore?: SnapshotStore | null;
|
|
388
418
|
}): Promise<DeclaredRead[]>;
|
|
419
|
+
/**
|
|
420
|
+
* `graphReads` (#5331): the same reads, for `chant graph --components`. One
|
|
421
|
+
* per output the reference recorded, secret ones included by name, or one
|
|
422
|
+
* with no output when the export recorded none. A stack no `pulumi-up` step
|
|
423
|
+
* applies is `external`.
|
|
424
|
+
*/
|
|
425
|
+
export declare function pulumiGraphReads(ctx: DeclaredReadsContext, members: readonly DeclaredReadMember[], opts?: {
|
|
426
|
+
exportStore?: SnapshotStore | null;
|
|
427
|
+
}): Promise<GraphRead[]>;
|
|
389
428
|
/**
|
|
390
429
|
* What a failed `up`'s stream still says (#4579): its `summaryEvent`, or,
|
|
391
430
|
* when the engine stopped before printing one, the per-resource timings
|
|
@@ -397,4 +436,6 @@ export declare function failedUpSummary(stream: string): PulumiApplySummary | un
|
|
|
397
436
|
export declare function pulumiReleaseInputs(input: PulumiUpStepInput, ctx: ReleaseInputsContext): ReleaseInputs | ReleaseInputsUnbound | null;
|
|
398
437
|
/** The `pulumi-up` capability, with injectable runners for tests. */
|
|
399
438
|
export declare function createPulumiUpCapability(opts?: PulumiUpOptions): Capability<PulumiUpStepInput, PulumiUpStepOutput>;
|
|
439
|
+
/** The outputs `pulumi stack output --show-secrets=false` printed as `[secret]` (#5345), sorted. */
|
|
440
|
+
export declare function pulumiSecretOutputNames(outputs: Record<string, unknown>): string[];
|
|
400
441
|
export declare const pulumiUpCapability: Capability<PulumiUpStepInput, PulumiUpStepOutput>;
|