@intentius/behold 0.29.52 → 0.29.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +98 -18
- package/example-three-cloud/README.md +1 -1
- package/example-three-cloud/aws/src/site.ts +15 -8
- package/example-three-cloud/azure/src/site.ts +2 -5
- package/example-three-cloud/gcp/src/site.ts +29 -6
- package/example-three-cloud/package-lock.json +19 -19
- package/example-three-cloud/package.json +4 -4
- package/example-three-cloud/scripts/front-door.ts +1 -13
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -17746,6 +17746,8 @@ function projectAzureLogical(ir, env) {
|
|
|
17746
17746
|
(refOut.get(e.from) ?? refOut.set(e.from, /* @__PURE__ */ new Set()).get(e.from)).add(e.to);
|
|
17747
17747
|
}
|
|
17748
17748
|
const RG_TITLE = env ? `resource group ${env}` : "resource group";
|
|
17749
|
+
const subscription = azure.map((n) => JSON.stringify(n).match(/\/subscriptions\/([0-9a-f-]{36})\//i)?.[1]).find(Boolean);
|
|
17750
|
+
const SUBSCRIPTION_TITLE = subscription ? `Azure subscription ${subscription}` : "Azure subscription";
|
|
17749
17751
|
const vnetTitle = (v) => `VNet ${vnetCidr(v) ?? resourceName(v) ?? v.id}`;
|
|
17750
17752
|
const subnetTitle = (s) => `subnet ${strAttr(s, "addressPrefix") ?? subnetShortName(s) ?? s.id}`;
|
|
17751
17753
|
const guardedBy = /* @__PURE__ */ new Map();
|
|
@@ -17877,6 +17879,7 @@ function projectAzureLogical(ir, env) {
|
|
|
17877
17879
|
const nsg = guardedSubnet ? guardedBy.get(guardedSubnet.id) : void 0;
|
|
17878
17880
|
return nsg ? { ...n, attrs: { ...n.attrs, _nsg: nsg } } : n;
|
|
17879
17881
|
});
|
|
17882
|
+
if (byContainer[RG_TITLE]) child(SUBSCRIPTION_TITLE, RG_TITLE);
|
|
17880
17883
|
return { ir: { nodes, edges, groups: {} }, byContainer };
|
|
17881
17884
|
}
|
|
17882
17885
|
|
|
@@ -17909,6 +17912,22 @@ var GCP_FABRIC_KINDS = /* @__PURE__ */ new Set([
|
|
|
17909
17912
|
// chant's own annotation carrier
|
|
17910
17913
|
"chant:gcp:defaultAnnotations"
|
|
17911
17914
|
]);
|
|
17915
|
+
var SUBNETWORK_KIND = "GCP::Compute::Subnetwork";
|
|
17916
|
+
function metadataName(node) {
|
|
17917
|
+
const name = node.attrs?.metadata?.name;
|
|
17918
|
+
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
17919
|
+
}
|
|
17920
|
+
function subnetsNamed(value, out = []) {
|
|
17921
|
+
if (!value || typeof value !== "object") return out;
|
|
17922
|
+
for (const [k, v] of Object.entries(value)) {
|
|
17923
|
+
if (k === "subnetworkRef" && v && typeof v === "object") {
|
|
17924
|
+
const name = v.name ?? v.external;
|
|
17925
|
+
if (typeof name === "string") out.push(name.split("/").pop());
|
|
17926
|
+
} else if (k === "subnetwork" && typeof v === "string") out.push(v.split("/").pop());
|
|
17927
|
+
else subnetsNamed(v, out);
|
|
17928
|
+
}
|
|
17929
|
+
return out;
|
|
17930
|
+
}
|
|
17912
17931
|
var PROJECT_ID_ANNOTATION = "cnrm.cloud.google.com/project-id";
|
|
17913
17932
|
function strAttr2(node, key3) {
|
|
17914
17933
|
const v = node.attrs?.[key3];
|
|
@@ -17920,6 +17939,10 @@ function declaredProject(nodes) {
|
|
|
17920
17939
|
const value = annotations?.[PROJECT_ID_ANNOTATION];
|
|
17921
17940
|
if (typeof value === "string" && value.length > 0) return value;
|
|
17922
17941
|
}
|
|
17942
|
+
for (const n of nodes) {
|
|
17943
|
+
const ref2 = n.attrs?.projectRef ?? n.attrs?.spec?.projectRef;
|
|
17944
|
+
if (typeof ref2?.external === "string" && ref2.external.length > 0) return ref2.external.replace(/^projects\//, "");
|
|
17945
|
+
}
|
|
17923
17946
|
return void 0;
|
|
17924
17947
|
}
|
|
17925
17948
|
function collectRefs(v, out) {
|
|
@@ -17934,7 +17957,7 @@ function projectGcpLogical(ir, env) {
|
|
|
17934
17957
|
const componentOf = componentNamer(gcp, ir.groups);
|
|
17935
17958
|
const byId = new Map(gcp.map((n) => [n.id, n]));
|
|
17936
17959
|
const project = declaredProject(gcp) ?? env;
|
|
17937
|
-
const PROJECT_TITLE = project ? `project ${project}` : "project";
|
|
17960
|
+
const PROJECT_TITLE = project ? `GCP project ${project}` : "GCP project";
|
|
17938
17961
|
const GLOBAL = "global";
|
|
17939
17962
|
const locationTitle = (loc) => `location ${loc}`;
|
|
17940
17963
|
const refOut = /* @__PURE__ */ new Map();
|
|
@@ -17957,14 +17980,28 @@ function projectGcpLogical(ir, env) {
|
|
|
17957
17980
|
};
|
|
17958
17981
|
const locations = /* @__PURE__ */ new Set();
|
|
17959
17982
|
for (const n of gcp) {
|
|
17960
|
-
const loc = strAttr2(n, "location");
|
|
17983
|
+
const loc = strAttr2(n, "location") ?? (n.kind === SUBNETWORK_KIND ? strAttr2(n, "region") : void 0);
|
|
17961
17984
|
if (loc) locations.add(loc);
|
|
17962
17985
|
}
|
|
17963
17986
|
for (const loc of [...locations].sort()) child(PROJECT_TITLE, locationTitle(loc));
|
|
17987
|
+
const subnetBox = /* @__PURE__ */ new Map();
|
|
17988
|
+
const regionOfBox = /* @__PURE__ */ new Map();
|
|
17989
|
+
for (const n of gcp) {
|
|
17990
|
+
if (n.kind !== SUBNETWORK_KIND) continue;
|
|
17991
|
+
const name = metadataName(n) ?? n.id;
|
|
17992
|
+
const cidr = strAttr2(n, "ipCidrRange");
|
|
17993
|
+
const network = n.attrs?.networkRef?.name;
|
|
17994
|
+
const title = `subnet ${cidr ?? name}${typeof network === "string" ? ` \xB7 ${network}` : ""}`;
|
|
17995
|
+
const region = strAttr2(n, "region") ?? strAttr2(n, "location");
|
|
17996
|
+
child(region ? locationTitle(region) : PROJECT_TITLE, title);
|
|
17997
|
+
subnetBox.set(name, title);
|
|
17998
|
+
if (region) regionOfBox.set(title, region);
|
|
17999
|
+
}
|
|
17964
18000
|
const placeOf = /* @__PURE__ */ new Map();
|
|
17965
18001
|
for (const n of headline) {
|
|
18002
|
+
const subnet = subnetsNamed(n.attrs).map((name) => subnetBox.get(name)).find(Boolean);
|
|
17966
18003
|
const loc = strAttr2(n, "location");
|
|
17967
|
-
placeOf.set(n.id, loc ? locationTitle(loc) : GLOBAL);
|
|
18004
|
+
placeOf.set(n.id, subnet ?? (loc ? locationTitle(loc) : GLOBAL));
|
|
17968
18005
|
}
|
|
17969
18006
|
const byComponent = /* @__PURE__ */ new Map();
|
|
17970
18007
|
for (const n of headline) {
|
|
@@ -17988,7 +18025,7 @@ function projectGcpLogical(ir, env) {
|
|
|
17988
18025
|
}
|
|
17989
18026
|
for (const place of places) {
|
|
17990
18027
|
if (place === GLOBAL) child(PROJECT_TITLE, GLOBAL);
|
|
17991
|
-
const part = `${component} \xB7 ${place.replace(/^location /, "")}`;
|
|
18028
|
+
const part = `${component} \xB7 ${regionOfBox.get(place) ?? place.replace(/^location /, "")}`;
|
|
17992
18029
|
child(place, part);
|
|
17993
18030
|
for (const m of members) if (placeOf.get(m.id) === place) child(part, m.id);
|
|
17994
18031
|
}
|
|
@@ -18406,6 +18443,7 @@ var NO_CONTRACT_KINDS = /* @__PURE__ */ new Set([
|
|
|
18406
18443
|
"AWS::EC2::SecurityGroupIngress"
|
|
18407
18444
|
]);
|
|
18408
18445
|
var REGION_RE = /\b([a-z]{2}-[a-z]+-\d)\b/;
|
|
18446
|
+
var ACCOUNT_RE = /arn:aws[a-z-]*:[a-z0-9-]*:[a-z0-9-]*:(\d{12}):/;
|
|
18409
18447
|
var WORD_RE = /[A-Za-z][A-Za-z0-9]*/g;
|
|
18410
18448
|
function isExample(node) {
|
|
18411
18449
|
return (node.sourceLoc?.file ?? "").includes("examples/");
|
|
@@ -18693,13 +18731,36 @@ function projectLogical(ir) {
|
|
|
18693
18731
|
};
|
|
18694
18732
|
const subnetTitle = (subnetId) => `${subnetScope(subnetId)} subnet ${strAttr3(byId.get(subnetId), "CidrBlock") ?? subnetId}`;
|
|
18695
18733
|
const GLOBAL = "regional & global";
|
|
18734
|
+
const memberOf = memberNamer(ir.groups);
|
|
18735
|
+
const ownRefs = /* @__PURE__ */ new Map();
|
|
18736
|
+
for (const [from, tos] of refOut) {
|
|
18737
|
+
const m = memberOf(byId.get(from));
|
|
18738
|
+
ownRefs.set(from, new Set([...tos].filter((t2) => memberOf(byId.get(t2)) === m)));
|
|
18739
|
+
}
|
|
18740
|
+
const subnetsOf = (start) => {
|
|
18741
|
+
const seen = /* @__PURE__ */ new Set([start]);
|
|
18742
|
+
let frontier = [...ownRefs.get(start) ?? []];
|
|
18743
|
+
for (let depth = 0; depth < 8 && frontier.length; depth++) {
|
|
18744
|
+
const hit = [...new Set(frontier.filter((id) => subnetIds.has(id)))];
|
|
18745
|
+
if (hit.length) return hit.sort();
|
|
18746
|
+
const next = [];
|
|
18747
|
+
for (const id of frontier) {
|
|
18748
|
+
if (seen.has(id)) continue;
|
|
18749
|
+
seen.add(id);
|
|
18750
|
+
for (const r of ownRefs.get(id) ?? []) if (!seen.has(r)) next.push(r);
|
|
18751
|
+
}
|
|
18752
|
+
frontier = next;
|
|
18753
|
+
}
|
|
18754
|
+
return [];
|
|
18755
|
+
};
|
|
18696
18756
|
const headline = aws.filter((n) => HEADLINE_KINDS.has(n.kind));
|
|
18697
18757
|
const placeOf = /* @__PURE__ */ new Map();
|
|
18698
18758
|
for (const n of headline) {
|
|
18699
|
-
const
|
|
18700
|
-
|
|
18759
|
+
const subnets = subnetsOf(n.id);
|
|
18760
|
+
const scopes = new Set(subnets.map(subnetScope));
|
|
18761
|
+
if (subnets.length && scopes.size === 1) placeOf.set(n.id, { kind: "subnet", subnets, vpc: nearestByRef(subnets[0], vpcIds, ownRefs) });
|
|
18701
18762
|
else {
|
|
18702
|
-
const vpc = nearestByRef(n.id, vpcIds,
|
|
18763
|
+
const vpc = (subnets.length ? nearestByRef(subnets[0], vpcIds, ownRefs) : void 0) ?? nearestByRef(n.id, vpcIds, ownRefs) ?? igwToVpc.get(n.id);
|
|
18703
18764
|
placeOf.set(n.id, vpc ? { kind: "vpc", vpc } : { kind: "global" });
|
|
18704
18765
|
}
|
|
18705
18766
|
}
|
|
@@ -18708,26 +18769,41 @@ function projectLogical(ir) {
|
|
|
18708
18769
|
const arr6 = byContainer[parent] ?? (byContainer[parent] = []);
|
|
18709
18770
|
if (!arr6.includes(c)) arr6.push(c);
|
|
18710
18771
|
};
|
|
18711
|
-
const
|
|
18712
|
-
|
|
18772
|
+
const subnetVpc = new Map([...subnetIds].map((id) => [id, nearestByRef(id, vpcIds, ownRefs)]));
|
|
18773
|
+
const tierOf = (id) => [...subnetIds].filter((s) => subnetVpc.get(s) === subnetVpc.get(id) && subnetScope(s) === subnetScope(id)).sort();
|
|
18774
|
+
const tierTitle = (ids) => {
|
|
18775
|
+
const tier = tierOf(ids[0]);
|
|
18776
|
+
return tier.length === 1 ? subnetTitle(tier[0]) : `${subnetScope(tier[0])} subnets ${tier.map((id) => strAttr3(byId.get(id), "CidrBlock") ?? id).join(", ")}`;
|
|
18777
|
+
};
|
|
18778
|
+
const ensureSubnet = (ids, vpcId) => {
|
|
18779
|
+
const t2 = tierTitle(ids);
|
|
18713
18780
|
if (vpcId) child(vpcTitle(vpcId), t2);
|
|
18714
18781
|
return t2;
|
|
18715
18782
|
};
|
|
18783
|
+
const placeTitle = (p) => p.kind === "subnet" ? ensureSubnet(p.subnets, p.vpc) : p.kind === "vpc" ? vpcTitle(p.vpc) : GLOBAL;
|
|
18784
|
+
const placeKey = (p) => p.kind === "subnet" ? `s:${tierOf(p.subnets[0]).join(",")}` : p.kind === "vpc" ? `v:${p.vpc}` : "g";
|
|
18716
18785
|
const byComponent = /* @__PURE__ */ new Map();
|
|
18717
18786
|
for (const n of headline) (byComponent.get(componentOf(n)) ?? byComponent.set(componentOf(n), []).get(componentOf(n))).push(n);
|
|
18718
18787
|
for (const [component, members] of byComponent) {
|
|
18719
18788
|
const places = members.map((m) => placeOf.get(m.id));
|
|
18720
|
-
const
|
|
18789
|
+
const keys = new Set(places.map(placeKey));
|
|
18721
18790
|
const vpcs = new Set(places.map((p) => p.kind === "subnet" ? p.vpc : p.kind === "vpc" ? p.vpc : void 0).filter((v) => !!v));
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
const
|
|
18725
|
-
|
|
18726
|
-
}
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18791
|
+
if (keys.size === 1) {
|
|
18792
|
+
child(placeTitle(places[0]), component);
|
|
18793
|
+
for (const m of members) child(component, m.id);
|
|
18794
|
+
continue;
|
|
18795
|
+
}
|
|
18796
|
+
if (vpcs.size === 1 && places.every((p) => p.kind !== "global")) {
|
|
18797
|
+
for (const [i, m] of members.entries()) {
|
|
18798
|
+
const p = places[i];
|
|
18799
|
+
const title = placeTitle(p);
|
|
18800
|
+
const part = p.kind === "subnet" ? `${component} \xB7 ${subnetScope(p.subnets[0])}` : component;
|
|
18801
|
+
child(title, part);
|
|
18802
|
+
child(part, m.id);
|
|
18803
|
+
}
|
|
18804
|
+
continue;
|
|
18730
18805
|
}
|
|
18806
|
+
const parent = vpcs.size >= 1 ? vpcTitle([...vpcs][0]) : GLOBAL;
|
|
18731
18807
|
child(parent, component);
|
|
18732
18808
|
for (const m of members) child(component, m.id);
|
|
18733
18809
|
}
|
|
@@ -18825,6 +18901,10 @@ function projectLogical(ir) {
|
|
|
18825
18901
|
frontier = next;
|
|
18826
18902
|
}
|
|
18827
18903
|
}
|
|
18904
|
+
const accountId = aws.map((n) => JSON.stringify(n).match(ACCOUNT_RE)?.[1]).find(Boolean);
|
|
18905
|
+
const ACCOUNT = accountId ? `AWS account ${accountId}` : "AWS account";
|
|
18906
|
+
const nested = new Set(Object.values(byContainer).flat());
|
|
18907
|
+
for (const key3 of Object.keys(byContainer)) if (!nested.has(key3)) child(ACCOUNT, key3);
|
|
18828
18908
|
return { ir: { nodes: headline, edges, groups: {} }, byContainer };
|
|
18829
18909
|
}
|
|
18830
18910
|
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import { FargateAlb,
|
|
1
|
+
import { FargateAlb, VpcDefault, output } from "@intentius/chant-lexicon-aws";
|
|
2
2
|
|
|
3
3
|
// The website on ECS Fargate in us-east-1, behind its own load balancer: the
|
|
4
|
-
// ALB's DNS name is the stable hostname Route 53 points at. The
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
// ALB's DNS name is the stable hostname Route 53 points at. The network is
|
|
5
|
+
// declared here as production has it: a VPC across two zones, public subnets
|
|
6
|
+
// for the load balancer and private ones for the tasks, which reach out
|
|
7
|
+
// through a NAT gateway.
|
|
8
|
+
export const network = VpcDefault({
|
|
9
|
+
cidr: "10.20.0.0/16",
|
|
10
|
+
publicSubnet1Cidr: "10.20.0.0/24",
|
|
11
|
+
publicSubnet2Cidr: "10.20.1.0/24",
|
|
12
|
+
privateSubnet1Cidr: "10.20.10.0/24",
|
|
13
|
+
privateSubnet2Cidr: "10.20.11.0/24",
|
|
14
|
+
});
|
|
8
15
|
|
|
9
16
|
export const web = FargateAlb({
|
|
10
17
|
image: "traefik/whoami:v1.10",
|
|
11
18
|
containerPort: 80,
|
|
12
19
|
desiredCount: 1,
|
|
13
|
-
vpcId:
|
|
14
|
-
publicSubnetIds:
|
|
15
|
-
privateSubnetIds:
|
|
20
|
+
vpcId: network.vpc.VpcId,
|
|
21
|
+
publicSubnetIds: [network.publicSubnet1.SubnetId, network.publicSubnet2.SubnetId],
|
|
22
|
+
privateSubnetIds: [network.privateSubnet1.SubnetId, network.privateSubnet2.SubnetId],
|
|
16
23
|
logRetentionDays: 7,
|
|
17
24
|
});
|
|
18
25
|
|
|
@@ -24,14 +24,11 @@ export const identity = new ManagedIdentity({ name: "three-cloud-web", location
|
|
|
24
24
|
export const env = new managedEnvironments({
|
|
25
25
|
name: "three-cloud",
|
|
26
26
|
location,
|
|
27
|
-
|
|
28
|
-
// chant 0.124.34's apply evaluates the latter to the wrong path (fixed by
|
|
29
|
-
// INTENTIUS/chant#4234, not yet released).
|
|
30
|
-
vnetConfiguration: { infrastructureSubnetId: "[concat(resourceId('Microsoft.Network/virtualNetworks', 'three-cloud-vnet'), '/subnets/apps')]", internal: false },
|
|
27
|
+
vnetConfiguration: { infrastructureSubnetId: "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'three-cloud-vnet', 'apps')]", internal: false },
|
|
31
28
|
appLogsConfiguration: {
|
|
32
29
|
destination: "log-analytics",
|
|
33
30
|
logAnalyticsConfiguration: {
|
|
34
|
-
customerId: "[reference('three-cloud-logs').customerId]",
|
|
31
|
+
customerId: "[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'three-cloud-logs')).customerId]",
|
|
35
32
|
sharedKey: "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', 'three-cloud-logs'), '2023-09-01').primarySharedKey]",
|
|
36
33
|
},
|
|
37
34
|
},
|
|
@@ -5,20 +5,22 @@ import {
|
|
|
5
5
|
ForwardingRule,
|
|
6
6
|
GCPServiceAccount,
|
|
7
7
|
RegionNetworkEndpointGroup,
|
|
8
|
+
Subnetwork,
|
|
8
9
|
TargetHTTPProxy,
|
|
9
10
|
URLMap,
|
|
11
|
+
VPCNetwork,
|
|
10
12
|
output,
|
|
11
13
|
} from "@intentius/chant-lexicon-gcp";
|
|
12
14
|
|
|
13
|
-
// The website on Cloud Run in Tokyo, running as its own service account
|
|
14
|
-
//
|
|
15
|
+
// The website on Cloud Run in Tokyo, running as its own service account with
|
|
16
|
+
// its egress in a VPC subnet, behind a global external Application Load
|
|
17
|
+
// Balancer as production sets it up: a
|
|
15
18
|
// static address and a forwarding rule, an HTTP proxy, a URL map, a backend
|
|
16
19
|
// service, and a serverless network endpoint group that names the service.
|
|
17
|
-
// The load balancer kinds apply with chant 0.124.35 or newer (chant#4233).
|
|
18
20
|
//
|
|
19
|
-
// Each reference is Config Connector's `{ name }`, spelled out: chant
|
|
20
|
-
//
|
|
21
|
-
//
|
|
21
|
+
// Each reference is Config Connector's `{ name }`, spelled out: chant 0.124.36
|
|
22
|
+
// writes a `.name` reference correctly but its live read can't resolve one
|
|
23
|
+
// (reported to chant), and behold joins these by name.
|
|
22
24
|
const region = "asia-northeast1";
|
|
23
25
|
|
|
24
26
|
export const runtime = new GCPServiceAccount({
|
|
@@ -26,6 +28,17 @@ export const runtime = new GCPServiceAccount({
|
|
|
26
28
|
displayName: "three-cloud website runtime",
|
|
27
29
|
});
|
|
28
30
|
|
|
31
|
+
// The network Cloud Run sends its egress into (Direct VPC egress), a custom
|
|
32
|
+
// VPC with one subnet in the service's region.
|
|
33
|
+
export const vpc = new VPCNetwork({ metadata: { name: "three-cloud-vpc" }, autoCreateSubnetworks: false, routingMode: "REGIONAL" });
|
|
34
|
+
|
|
35
|
+
export const subnet = new Subnetwork({
|
|
36
|
+
metadata: { name: "three-cloud-apps" },
|
|
37
|
+
region,
|
|
38
|
+
ipCidrRange: "10.30.0.0/24",
|
|
39
|
+
networkRef: { name: "three-cloud-vpc" },
|
|
40
|
+
});
|
|
41
|
+
|
|
29
42
|
export const web = CloudRunServiceComposite({
|
|
30
43
|
name: "three-cloud-site",
|
|
31
44
|
image: "traefik/whoami:v1.10",
|
|
@@ -36,6 +49,16 @@ export const web = CloudRunServiceComposite({
|
|
|
36
49
|
maxInstanceCount: 1,
|
|
37
50
|
publicAccess: true,
|
|
38
51
|
serviceAccount: "three-cloud-run",
|
|
52
|
+
defaults: {
|
|
53
|
+
service: {
|
|
54
|
+
template: {
|
|
55
|
+
vpcAccess: {
|
|
56
|
+
egress: "PRIVATE_RANGES_ONLY",
|
|
57
|
+
networkInterfaces: [{ networkRef: { name: "three-cloud-vpc" }, subnetworkRef: { name: "three-cloud-apps" } }],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
39
62
|
});
|
|
40
63
|
|
|
41
64
|
export const neg = new RegionNetworkEndpointGroup({
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"": {
|
|
7
7
|
"name": "behold-example-three-cloud",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@intentius/chant": "^0.124.
|
|
10
|
-
"@intentius/chant-lexicon-aws": "^0.124.
|
|
11
|
-
"@intentius/chant-lexicon-azure": "^0.124.
|
|
12
|
-
"@intentius/chant-lexicon-gcp": "^0.124.
|
|
9
|
+
"@intentius/chant": "^0.124.36",
|
|
10
|
+
"@intentius/chant-lexicon-aws": "^0.124.36",
|
|
11
|
+
"@intentius/chant-lexicon-azure": "^0.124.36",
|
|
12
|
+
"@intentius/chant-lexicon-gcp": "^0.124.36"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@dagrejs/dagre": {
|
|
@@ -444,9 +444,9 @@
|
|
|
444
444
|
}
|
|
445
445
|
},
|
|
446
446
|
"node_modules/@intentius/chant": {
|
|
447
|
-
"version": "0.124.
|
|
448
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.
|
|
449
|
-
"integrity": "sha512-
|
|
447
|
+
"version": "0.124.36",
|
|
448
|
+
"resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.36.tgz",
|
|
449
|
+
"integrity": "sha512-KcsdALy1O+P5i9bxL2FkIgW546zmyJnwzm0xS556YRSC4EytexW9okRVhv/hwhlj8dtcXJAxoyZmwh8qgznanA==",
|
|
450
450
|
"license": "Apache-2.0",
|
|
451
451
|
"dependencies": {
|
|
452
452
|
"@dagrejs/dagre": "^3.0.0",
|
|
@@ -473,34 +473,34 @@
|
|
|
473
473
|
}
|
|
474
474
|
},
|
|
475
475
|
"node_modules/@intentius/chant-lexicon-aws": {
|
|
476
|
-
"version": "0.124.
|
|
477
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.
|
|
478
|
-
"integrity": "sha512-
|
|
476
|
+
"version": "0.124.36",
|
|
477
|
+
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.36.tgz",
|
|
478
|
+
"integrity": "sha512-AdhC24jnc7gnvdDfFYzDJ+OKmaNJt4tki/oHmxzJkun0TiH12mZjdA/mR6LxK5GJkvNidK9TwyR/LtAwZAnU6Q==",
|
|
479
479
|
"license": "Apache-2.0",
|
|
480
480
|
"dependencies": {
|
|
481
481
|
"fflate": "^0.8.2",
|
|
482
482
|
"js-yaml": "^4.3.1"
|
|
483
483
|
},
|
|
484
484
|
"peerDependencies": {
|
|
485
|
-
"@intentius/chant": "^0.124.
|
|
485
|
+
"@intentius/chant": "^0.124.36"
|
|
486
486
|
}
|
|
487
487
|
},
|
|
488
488
|
"node_modules/@intentius/chant-lexicon-azure": {
|
|
489
|
-
"version": "0.124.
|
|
490
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.
|
|
491
|
-
"integrity": "sha512-
|
|
489
|
+
"version": "0.124.36",
|
|
490
|
+
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.36.tgz",
|
|
491
|
+
"integrity": "sha512-Ge/gqsqceUCCEo628DD7uxWxk35thZk9W1pCrbiwtr1j1IAQsY2hFtzL3PnBpuXpFUh9nAtx73SiNxrur0PGAA==",
|
|
492
492
|
"license": "Apache-2.0",
|
|
493
493
|
"dependencies": {
|
|
494
494
|
"fflate": "^0.8.2"
|
|
495
495
|
},
|
|
496
496
|
"peerDependencies": {
|
|
497
|
-
"@intentius/chant": "^0.124.
|
|
497
|
+
"@intentius/chant": "^0.124.36"
|
|
498
498
|
}
|
|
499
499
|
},
|
|
500
500
|
"node_modules/@intentius/chant-lexicon-gcp": {
|
|
501
|
-
"version": "0.124.
|
|
502
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.
|
|
503
|
-
"integrity": "sha512-
|
|
501
|
+
"version": "0.124.36",
|
|
502
|
+
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.36.tgz",
|
|
503
|
+
"integrity": "sha512-g1xfRaMpm6bfJLfHkddMv0Y9w1lsCOvPqpsnJ+QwYOBsMSawkTC7Dd/ep8Cfp8AAH24uk7qngMc6MJZFIAcRMw==",
|
|
504
504
|
"license": "Apache-2.0",
|
|
505
505
|
"dependencies": {
|
|
506
506
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
"js-yaml": "^4.3.1"
|
|
509
509
|
},
|
|
510
510
|
"peerDependencies": {
|
|
511
|
-
"@intentius/chant": "^0.124.
|
|
511
|
+
"@intentius/chant": "^0.124.36"
|
|
512
512
|
}
|
|
513
513
|
},
|
|
514
514
|
"node_modules/@types/js-yaml": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"front-door": "tsx scripts/front-door.ts all --out export"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@intentius/chant": "^0.124.
|
|
12
|
-
"@intentius/chant-lexicon-aws": "^0.124.
|
|
13
|
-
"@intentius/chant-lexicon-azure": "^0.124.
|
|
14
|
-
"@intentius/chant-lexicon-gcp": "^0.124.
|
|
11
|
+
"@intentius/chant": "^0.124.36",
|
|
12
|
+
"@intentius/chant-lexicon-aws": "^0.124.36",
|
|
13
|
+
"@intentius/chant-lexicon-azure": "^0.124.36",
|
|
14
|
+
"@intentius/chant-lexicon-gcp": "^0.124.36"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -157,9 +157,7 @@ async function azureOn(): Promise<void> {
|
|
|
157
157
|
|
|
158
158
|
/** The aws member, or why it could not be applied. */
|
|
159
159
|
async function applyAws(): Promise<{ endpoint: string } | { refused: string }> {
|
|
160
|
-
const
|
|
161
|
-
const subnets = await defaultSubnets();
|
|
162
|
-
const params = withDefaults(template, { vpcId: subnets.vpc, subnetIds: subnets.ids.join(",") });
|
|
160
|
+
const params = build("aws");
|
|
163
161
|
// A stack that rolled back on its first create can't be updated; start it again.
|
|
164
162
|
if ((await stackStatus("three-cloud-aws")) === "ROLLBACK_COMPLETE") {
|
|
165
163
|
await awsDelete({ templatePath: params, stackName: "three-cloud-aws", endpoint: AWS, timeoutMs: 180_000 });
|
|
@@ -340,16 +338,6 @@ async function awsQuery(service: string, form: Record<string, string>): Promise<
|
|
|
340
338
|
return text;
|
|
341
339
|
}
|
|
342
340
|
|
|
343
|
-
async function defaultSubnets(): Promise<{ vpc: string; ids: string[] }> {
|
|
344
|
-
const vpcs = await awsQuery("ec2", { Action: "DescribeVpcs", Version: "2016-11-15", "Filter.1.Name": "isDefault", "Filter.1.Value.1": "true" });
|
|
345
|
-
const vpc = /<vpcId>([^<]+)<\/vpcId>/.exec(vpcs)?.[1];
|
|
346
|
-
if (!vpc) throw new Refusal("aws: the emulator has no default VPC");
|
|
347
|
-
const subnets = await awsQuery("ec2", { Action: "DescribeSubnets", Version: "2016-11-15", "Filter.1.Name": "vpc-id", "Filter.1.Value.1": vpc });
|
|
348
|
-
const ids = [...subnets.matchAll(/<subnetId>([^<]+)<\/subnetId>/g)].map((m) => m[1]!).slice(0, 2);
|
|
349
|
-
if (ids.length < 2) throw new Refusal(`aws: the default VPC ${vpc} has fewer than two subnets`);
|
|
350
|
-
return { vpc, ids };
|
|
351
|
-
}
|
|
352
|
-
|
|
353
341
|
async function stackStatus(stack: string): Promise<string | undefined> {
|
|
354
342
|
try {
|
|
355
343
|
const xml = await awsQuery("cloudformation", { Action: "DescribeStacks", Version: "2010-05-15", StackName: stack });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.53",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@hono/node-server": "^2.0.5",
|
|
50
|
-
"@intentius/chant": "^0.124.
|
|
50
|
+
"@intentius/chant": "^0.124.36",
|
|
51
51
|
"@intentius/chant-k8s-client": "^0.124.24",
|
|
52
52
|
"@intentius/pinhole": "^0.5.0",
|
|
53
53
|
"ajv": "^8.20.0",
|