@intentius/chant-lexicon-aws 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/codegen/generate-lexicon.d.ts +2 -0
- package/dist/codegen/generate-lexicon.js +7 -0
- package/dist/generated/lexicon-aws.json +6860 -5
- package/dist/identity-observe.d.ts +5 -0
- package/dist/identity-observe.js +10 -0
- package/dist/index-import.d.ts +4 -0
- package/dist/index-import.js +24 -1
- package/dist/integrity.json +3 -3
- package/dist/json-text-references.d.ts +10 -0
- package/dist/json-text-references.js +114 -0
- package/dist/manifest.json +1 -1
- package/dist/meta.json +6860 -5
- package/dist/plugin.js +12 -3
- package/dist/properties.d.ts +26 -0
- package/dist/properties.js +75 -0
- package/dist/reference-catalog.js +8 -0
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -23,7 +23,7 @@ import { awsDeepNormalizationHooks, observeResourcesDeepAws } from "./deep-obser
|
|
|
23
23
|
import { awsDisruption } from "./disruption.js";
|
|
24
24
|
import { awsReferenceCatalog } from "./reference-catalog.js";
|
|
25
25
|
import { AMBIENT_KINDS } from "./ambient.js";
|
|
26
|
-
import { canDescribe, describeOwnProperties, stampRegion } from "./properties.js";
|
|
26
|
+
import { canDescribe, describeCloudControlProperties, describeOwnProperties, stampRegion } from "./properties.js";
|
|
27
27
|
import { stampProviderDefaults } from "./defaults.js";
|
|
28
28
|
import { resolveTemplateAttrs } from "./live-attrs.js";
|
|
29
29
|
import { CFParser } from "./import/parser.js";
|
|
@@ -685,7 +685,7 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
|
|
|
685
685
|
const stackMarker = stackTags ? readOwnership(stackTags, AWS_TAG_OWNERSHIP_KEYS) : undefined;
|
|
686
686
|
const stackOwnership = stackTags === undefined ? "unknown" : stackMarker ? "owned" : "foreign";
|
|
687
687
|
// `owned: true` withheld nothing, so say why whenever the marker did not resolve.
|
|
688
|
-
|
|
688
|
+
let notes = options.owned && stackMarker === undefined ? unresolvedNotes : undefined;
|
|
689
689
|
// The outputs are the stack's, not any member's (#1279). They used to be
|
|
690
690
|
// copied onto every resource's `attributes`, so a VPC carried the stack's
|
|
691
691
|
// `expWebIp` and no `CidrBlock`. They ride the envelope once, keyed by the
|
|
@@ -724,7 +724,16 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
|
|
|
724
724
|
// the stack's exports replicated onto every member, so no instance carried
|
|
725
725
|
// its own `VpcId`.
|
|
726
726
|
const own = await describeOwnProperties(resources, options.region);
|
|
727
|
-
|
|
727
|
+
// The other kinds' own properties (#4525), read through Cloud Control and
|
|
728
|
+
// normalized as an index of the same account is, so `attr:` answers the
|
|
729
|
+
// same under `search --live` and `search --index`. A kind it could not
|
|
730
|
+
// read keeps its identity and gets a note, not a hole: before this read
|
|
731
|
+
// existed those resources carried no properties and were observed.
|
|
732
|
+
const cc = await describeCloudControlProperties(own.resources, client);
|
|
733
|
+
const ccNotes = [...cc.failures.values()].map((detail) => `[aws] ${detail}; those resources carry their stack identity without their properties`);
|
|
734
|
+
if (ccNotes.length > 0)
|
|
735
|
+
notes = [...(notes ?? []), ...ccNotes];
|
|
736
|
+
const withProperties = stampProviderDefaults(stampRegion(cc.resources, options.region));
|
|
728
737
|
// The own-property read is still a CLI shell-out while the stack reads are
|
|
729
738
|
// not (#1206), so the two halves can now fail independently. When the
|
|
730
739
|
// enrichment could not run at all, the resources it would have described are
|
package/dist/properties.d.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* kept underneath its own properties, which win a name collision because they
|
|
22
22
|
* are the resource's.
|
|
23
23
|
*/
|
|
24
|
+
import type { AwsReadClientOptions } from "./api/read-client.js";
|
|
24
25
|
import type { ResourceMetadata } from "@intentius/chant/lexicon";
|
|
25
26
|
/**
|
|
26
27
|
* Stamp the region each resource was observed in (#1279).
|
|
@@ -62,3 +63,28 @@ export interface OwnPropertiesResult {
|
|
|
62
63
|
* has to declare rather than a thinner set of facts.
|
|
63
64
|
*/
|
|
64
65
|
export declare function describeOwnProperties(resources: Record<string, ResourceMetadata>, region?: string): Promise<OwnPropertiesResult>;
|
|
66
|
+
/** What {@link describeCloudControlProperties} read, and why each kind it could not read failed. */
|
|
67
|
+
export interface CloudControlPropertiesResult {
|
|
68
|
+
resources: Record<string, ResourceMetadata>;
|
|
69
|
+
/** Why each failed kind failed, keyed by CloudFormation type. */
|
|
70
|
+
failures: Map<string, string>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Every other stack member's own properties, through Cloud Control (#4525).
|
|
74
|
+
*
|
|
75
|
+
* {@link DESCRIBE} covers four EC2 kinds, so a bucket or a role read through
|
|
76
|
+
* the stack carried no properties at all, and `chant search "attr:Path=/"
|
|
77
|
+
* --live` matched nothing that the same query over an index of the same
|
|
78
|
+
* account matched. The index lists through Cloud Control and normalizes each
|
|
79
|
+
* model with the deep-observe hooks (`typeListing`, chant#4521). This reads
|
|
80
|
+
* the same model for the same resource and normalizes it the same way, so a
|
|
81
|
+
* bound row has the same attributes on both paths.
|
|
82
|
+
*
|
|
83
|
+
* A kind is read when its primary identifier is one part: CloudFormation's
|
|
84
|
+
* physical id for it is then the Cloud Control identifier. `GetResource` per
|
|
85
|
+
* resource; an endpoint that answers `UnsupportedOperation` (floci) gets one
|
|
86
|
+
* `ListResources` for the kind, joined back by identifier. Best-effort per
|
|
87
|
+
* kind: a kind that fails keeps the stack's identity and status, and its
|
|
88
|
+
* failure is reported for the caller to note.
|
|
89
|
+
*/
|
|
90
|
+
export declare function describeCloudControlProperties(resources: Record<string, ResourceMetadata>, client: AwsReadClientOptions): Promise<CloudControlPropertiesResult>;
|
package/dist/properties.js
CHANGED
|
@@ -164,3 +164,78 @@ export async function describeOwnProperties(resources, region) {
|
|
|
164
164
|
}
|
|
165
165
|
return { resources: merged, transportFailed: failures.size === wanted.size, failures };
|
|
166
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Every other stack member's own properties, through Cloud Control (#4525).
|
|
169
|
+
*
|
|
170
|
+
* {@link DESCRIBE} covers four EC2 kinds, so a bucket or a role read through
|
|
171
|
+
* the stack carried no properties at all, and `chant search "attr:Path=/"
|
|
172
|
+
* --live` matched nothing that the same query over an index of the same
|
|
173
|
+
* account matched. The index lists through Cloud Control and normalizes each
|
|
174
|
+
* model with the deep-observe hooks (`typeListing`, chant#4521). This reads
|
|
175
|
+
* the same model for the same resource and normalizes it the same way, so a
|
|
176
|
+
* bound row has the same attributes on both paths.
|
|
177
|
+
*
|
|
178
|
+
* A kind is read when its primary identifier is one part: CloudFormation's
|
|
179
|
+
* physical id for it is then the Cloud Control identifier. `GetResource` per
|
|
180
|
+
* resource; an endpoint that answers `UnsupportedOperation` (floci) gets one
|
|
181
|
+
* `ListResources` for the kind, joined back by identifier. Best-effort per
|
|
182
|
+
* kind: a kind that fails keeps the stack's identity and status, and its
|
|
183
|
+
* failure is reported for the caller to note.
|
|
184
|
+
*/
|
|
185
|
+
export async function describeCloudControlProperties(resources, client) {
|
|
186
|
+
const { primaryIdentifierParts } = await import("./identity-observe.js");
|
|
187
|
+
const wanted = new Map();
|
|
188
|
+
for (const [name, meta] of Object.entries(resources)) {
|
|
189
|
+
if (!meta.physicalId || canDescribe(meta.type))
|
|
190
|
+
continue;
|
|
191
|
+
if (primaryIdentifierParts(meta.type)?.length !== 1)
|
|
192
|
+
continue;
|
|
193
|
+
const byId = wanted.get(meta.type) ?? new Map();
|
|
194
|
+
byId.set(meta.physicalId, [...(byId.get(meta.physicalId) ?? []), name]);
|
|
195
|
+
wanted.set(meta.type, byId);
|
|
196
|
+
}
|
|
197
|
+
const failures = new Map();
|
|
198
|
+
if (wanted.size === 0)
|
|
199
|
+
return { resources, failures };
|
|
200
|
+
const { normalizeDeepProperties } = await import("@intentius/chant/deep-observation");
|
|
201
|
+
const { awsDeepNormalizationHooks } = await import("./deep-observe.js");
|
|
202
|
+
const { AwsReadError, getResource, listResources } = await import("./api/read-client.js");
|
|
203
|
+
const merged = { ...resources };
|
|
204
|
+
const detail = (err) => err instanceof AwsReadError && err.code ? `${err.code}: ${err.message}` : err instanceof Error ? err.message : String(err);
|
|
205
|
+
for (const [kind, byId] of wanted) {
|
|
206
|
+
const found = new Map();
|
|
207
|
+
try {
|
|
208
|
+
let listed = false;
|
|
209
|
+
for (const id of byId.keys()) {
|
|
210
|
+
try {
|
|
211
|
+
const d = await getResource(kind, id, client);
|
|
212
|
+
if (d)
|
|
213
|
+
found.set(id, d.properties);
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
if (!(err instanceof AwsReadError) || err.code !== "UnsupportedOperation")
|
|
217
|
+
throw err;
|
|
218
|
+
listed = true;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (listed) {
|
|
223
|
+
for (const d of await listResources(kind, client)) {
|
|
224
|
+
if (byId.has(d.identifier))
|
|
225
|
+
found.set(d.identifier, d.properties);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
failures.set(kind, `Cloud Control read of ${kind} failed: ${detail(err)}`);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
for (const [id, properties] of found) {
|
|
234
|
+
const attrs = normalizeDeepProperties(properties, { entityType: kind, side: "live", hooks: awsDeepNormalizationHooks });
|
|
235
|
+
for (const name of byId.get(id) ?? []) {
|
|
236
|
+
merged[name] = { ...merged[name], attributes: { ...(merged[name].attributes ?? {}), ...attrs } };
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return { resources: merged, failures };
|
|
241
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsonTextRules } from "./json-text-references.js";
|
|
1
2
|
/**
|
|
2
3
|
* AWS reference catalog (#778, epic #776 v1) — how observed AWS resources
|
|
3
4
|
* reference each other, so `chant graph --live` can reconstruct the topology.
|
|
@@ -42,6 +43,8 @@ export const awsReferenceCatalog = {
|
|
|
42
43
|
// workload's env var carries (behold#166, ../../k8s/src/reference-catalog.ts).
|
|
43
44
|
{ kind: "AWS::Route53::RecordSet", ids: ["Name"] },
|
|
44
45
|
{ kind: "AWS::S3::Bucket", ids: ["BucketName"] },
|
|
46
|
+
// #5245: a secret by its name, which is what an ExternalSecret's key carries (../../k8s/src/reference-catalog.ts).
|
|
47
|
+
{ kind: "AWS::SecretsManager::Secret", ids: ["Name"] },
|
|
45
48
|
],
|
|
46
49
|
refs: [
|
|
47
50
|
// ── containment (→ boundary boxes, #779) ──
|
|
@@ -136,6 +139,11 @@ export const awsReferenceCatalog = {
|
|
|
136
139
|
// latency record for gcp points at gcp.three-cloud.example.). Optional,
|
|
137
140
|
// since most record values are addresses or hostnames outside it.
|
|
138
141
|
{ from: "AWS::Route53::RecordSet", path: "ResourceRecords[]", targetKind: "AWS::Route53::RecordSet", relation: "reference", label: "aliases", optional: true },
|
|
142
|
+
// ── ARNs inside JSON text (#5285) ──
|
|
143
|
+
// A queue's RedrivePolicy and the Resource and Principal ARNs of a policy
|
|
144
|
+
// document, each at a named path (./json-text-references.ts). Indexed
|
|
145
|
+
// nodes only: a declared graph's rules read values, not JSON text.
|
|
146
|
+
...jsonTextRules(),
|
|
139
147
|
],
|
|
140
148
|
// Tags that name a cloud id in their key or value (behold#1023 Q5). Used
|
|
141
149
|
// over indexed nodes only. No rule matches equal tag values in general.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-aws",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.104",
|
|
4
4
|
"description": "AWS CloudFormation lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -82,6 +82,6 @@
|
|
|
82
82
|
"typescript": "^5.9.3"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"@intentius/chant": "^0.124.
|
|
85
|
+
"@intentius/chant": "^0.124.105"
|
|
86
86
|
}
|
|
87
87
|
}
|