@microagi/alchemy-gcp 0.1.2 → 0.1.3
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/README.md
CHANGED
|
@@ -27,42 +27,59 @@ A `serviceAccountKey` flow is also wired through `alchemy login`.
|
|
|
27
27
|
|
|
28
28
|
## Use
|
|
29
29
|
|
|
30
|
+
Alchemy stacks are TypeScript files that `export default` an `Alchemy.Stack`. The `alchemy` CLI consumes that default export — there is no programmatic `run` wrapper.
|
|
31
|
+
|
|
32
|
+
`alchemy.run.ts`:
|
|
33
|
+
|
|
30
34
|
```ts
|
|
31
35
|
import * as Alchemy from "alchemy";
|
|
32
|
-
import { inMemoryState } from "alchemy/State";
|
|
33
36
|
import * as Effect from "effect/Effect";
|
|
34
37
|
import * as GCP from "@microagi/alchemy-gcp";
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
machineType: "e2-standard-4",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
export default Alchemy.Stack(
|
|
40
|
+
"research",
|
|
41
|
+
{
|
|
42
|
+
providers: GCP.providers(),
|
|
43
|
+
state: Alchemy.localState(),
|
|
44
|
+
},
|
|
45
|
+
Effect.gen(function* () {
|
|
46
|
+
const project = yield* GCP.Project("ResearchProj", {
|
|
47
|
+
parent: { type: "folder", id: "<your-folder-id>" },
|
|
48
|
+
displayName: "research",
|
|
49
|
+
billingAccount: "billingAccounts/<your-billing-account>",
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const cluster = yield* GCP.Cluster("Main", {
|
|
53
|
+
project: project.projectId,
|
|
54
|
+
location: "us-central1",
|
|
55
|
+
network: "default",
|
|
56
|
+
initialNodePool: {
|
|
57
|
+
name: "default-pool",
|
|
58
|
+
initialNodeCount: 1,
|
|
59
|
+
config: { machineType: "e2-standard-4" },
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
yield* GCP.NodePool("compute", {
|
|
64
|
+
project: project.projectId,
|
|
65
|
+
location: "us-central1",
|
|
66
|
+
clusterName: cluster.name,
|
|
67
|
+
initialNodeCount: 2,
|
|
68
|
+
config: { machineType: "n2-standard-16" },
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
62
71
|
);
|
|
63
72
|
```
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
Run it with the alchemy CLI:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
bun alchemy plan ./alchemy.run.ts
|
|
78
|
+
bun alchemy deploy ./alchemy.run.ts
|
|
79
|
+
bun alchemy destroy ./alchemy.run.ts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`Alchemy.localState()` writes Alchemy's resource state to `.alchemy/` next to the stack file. `Alchemy.inMemoryState()` is fine for tests but loses state between runs. For team use, swap in `httpStateStore()`.
|
|
66
83
|
|
|
67
84
|
Long-running operations (`createProjects`, `patchProjects`, GKE cluster ops) are polled internally; reconcilers follow the [Alchemy reconciler doctrine](https://v2.alchemy.run/concepts/resource-lifecycle) (single observe → ensure → sync → return flow that converges from any starting state, including adoption).
|
|
68
85
|
|
|
@@ -72,10 +89,12 @@ Long-running operations (`createProjects`, `patchProjects`, GKE cluster ops) are
|
|
|
72
89
|
- **`GCP.ApiEnable`** — project-level GCP service enablement.
|
|
73
90
|
- **`GCP.Cluster`** — Standard GKE cluster.
|
|
74
91
|
- **`GCP.NodePool`** — node pool attached to a cluster, including accelerator (GPU) configurations.
|
|
75
|
-
- **`GCP.Parallelstore`** — Parallelstore filesystem instance.
|
|
76
92
|
- **`GCP.Network`** — VPC network.
|
|
77
93
|
- **`GCP.Subnetwork`** — VPC subnetwork.
|
|
78
|
-
- **`GCP.
|
|
94
|
+
- **`GCP.PsaConnection`** — Private Service Access peering for Google managed services.
|
|
95
|
+
- **`GCP.GlobalAddress`** — global IP address (typically used to reserve a PSA range).
|
|
96
|
+
- **`GCP.SharedVpcHost`** / **`GCP.SharedVpcServiceProject`** — Shared VPC enable/attach.
|
|
97
|
+
- **`GCP.ParallelstoreInstance`** — Parallelstore filesystem instance.
|
|
79
98
|
|
|
80
99
|
Each resource's full prop/attribute set is documented as JSDoc on the source.
|
|
81
100
|
|
|
@@ -41,7 +41,7 @@ export type ProjectProps = {
|
|
|
41
41
|
/**
|
|
42
42
|
* Billing account to attach to the project. Must be the
|
|
43
43
|
* fully-qualified resource name `billingAccounts/{id}` (e.g.
|
|
44
|
-
* `billingAccounts
|
|
44
|
+
* `billingAccounts/<your-billing-account>`) — that's what
|
|
45
45
|
* `cloudbilling.projects.updateBillingInfo` accepts in
|
|
46
46
|
* `billingAccountName`; passing the bare id returns `400 Request
|
|
47
47
|
* contains an invalid argument`. The prefix is enforced at the
|
|
@@ -88,7 +88,7 @@ export type BillingAccountName = `billingAccounts/${string}`;
|
|
|
88
88
|
* @example Project under a folder
|
|
89
89
|
* ```typescript
|
|
90
90
|
* const project = yield* GCP.Project("Research", {
|
|
91
|
-
* parent: { type: "folder", id: "
|
|
91
|
+
* parent: { type: "folder", id: "<your-folder-id>" },
|
|
92
92
|
* displayName: "Research Cluster",
|
|
93
93
|
* });
|
|
94
94
|
* ```
|
|
@@ -97,7 +97,7 @@ export type BillingAccountName = `billingAccounts/${string}`;
|
|
|
97
97
|
* ```typescript
|
|
98
98
|
* const project = yield* GCP.Project("Research", {
|
|
99
99
|
* projectId: "microagi-research-001",
|
|
100
|
-
* parent: { type: "folder", id: "
|
|
100
|
+
* parent: { type: "folder", id: "<your-folder-id>" },
|
|
101
101
|
* });
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microagi/alchemy-gcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "GCP provider for Alchemy v2 (Effect-based IaC). Resources for Project, Cluster, NodePool, Parallelstore, Compute, ServiceUsage, ServiceNetworking, with ADC-backed credentials.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alchemy",
|
|
@@ -51,7 +51,7 @@ export type ProjectProps = {
|
|
|
51
51
|
/**
|
|
52
52
|
* Billing account to attach to the project. Must be the
|
|
53
53
|
* fully-qualified resource name `billingAccounts/{id}` (e.g.
|
|
54
|
-
* `billingAccounts
|
|
54
|
+
* `billingAccounts/<your-billing-account>`) — that's what
|
|
55
55
|
* `cloudbilling.projects.updateBillingInfo` accepts in
|
|
56
56
|
* `billingAccountName`; passing the bare id returns `400 Request
|
|
57
57
|
* contains an invalid argument`. The prefix is enforced at the
|
|
@@ -100,7 +100,7 @@ export type BillingAccountName = `billingAccounts/${string}`;
|
|
|
100
100
|
* @example Project under a folder
|
|
101
101
|
* ```typescript
|
|
102
102
|
* const project = yield* GCP.Project("Research", {
|
|
103
|
-
* parent: { type: "folder", id: "
|
|
103
|
+
* parent: { type: "folder", id: "<your-folder-id>" },
|
|
104
104
|
* displayName: "Research Cluster",
|
|
105
105
|
* });
|
|
106
106
|
* ```
|
|
@@ -109,7 +109,7 @@ export type BillingAccountName = `billingAccounts/${string}`;
|
|
|
109
109
|
* ```typescript
|
|
110
110
|
* const project = yield* GCP.Project("Research", {
|
|
111
111
|
* projectId: "microagi-research-001",
|
|
112
|
-
* parent: { type: "folder", id: "
|
|
112
|
+
* parent: { type: "folder", id: "<your-folder-id>" },
|
|
113
113
|
* });
|
|
114
114
|
* ```
|
|
115
115
|
*/
|