@microagi/alchemy-gcp 0.1.2 → 0.1.4

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,57 @@ A `serviceAccountKey` flow is also wired through `alchemy login`.
27
27
 
28
28
  ## Use
29
29
 
30
+ `alchemy.run.ts`:
31
+
30
32
  ```ts
31
33
  import * as Alchemy from "alchemy";
32
- import { inMemoryState } from "alchemy/State";
33
34
  import * as Effect from "effect/Effect";
34
35
  import * as GCP from "@microagi/alchemy-gcp";
35
36
 
36
- await Alchemy.run(
37
- Alchemy.Stack(
38
- "research",
39
- { providers: GCP.providers(), state: inMemoryState() },
40
- Effect.gen(function* () {
41
- const project = yield* GCP.Project("ResearchProj", {
42
- parent: { type: "folder", id: "<your-folder-id>" },
43
- displayName: "research",
44
- billingAccount: "billingAccounts/<your-billing-account>",
45
- });
46
-
47
- const cluster = yield* GCP.Cluster("Main", {
48
- project: project.projectId,
49
- location: "us-central1",
50
- network: "shared-vpc",
51
- subnetwork: "research-subnet",
52
- });
53
-
54
- yield* GCP.NodePool("system", {
55
- cluster,
56
- machineType: "e2-standard-4",
57
- minNodes: 1,
58
- maxNodes: 3,
59
- });
60
- }),
61
- ),
37
+ export default Alchemy.Stack(
38
+ "research",
39
+ {
40
+ providers: GCP.providers(),
41
+ state: Alchemy.localState(),
42
+ },
43
+ Effect.gen(function* () {
44
+ const project = yield* GCP.Project("ResearchProj", {
45
+ parent: { type: "folder", id: "<your-folder-id>" },
46
+ displayName: "research",
47
+ billingAccount: "billingAccounts/<your-billing-account>",
48
+ });
49
+
50
+ const cluster = yield* GCP.Cluster("Main", {
51
+ project: project.projectId,
52
+ location: "us-central1",
53
+ network: "default",
54
+ initialNodePool: {
55
+ name: "default-pool",
56
+ initialNodeCount: 1,
57
+ config: { machineType: "e2-standard-4" },
58
+ },
59
+ });
60
+
61
+ yield* GCP.NodePool("compute", {
62
+ project: project.projectId,
63
+ location: "us-central1",
64
+ clusterName: cluster.name,
65
+ initialNodeCount: 2,
66
+ config: { machineType: "n2-standard-16" },
67
+ });
68
+ }),
62
69
  );
63
70
  ```
64
71
 
65
- `inMemoryState()` works for examples and tests. For real deployments, swap it for `localState()` (file-backed) or `httpStateStore()` (server-backed) — see [`alchemy/State`](https://v2.alchemy.run/concepts/state).
72
+ Run it with the alchemy CLI:
73
+
74
+ ```sh
75
+ bun alchemy plan ./alchemy.run.ts
76
+ bun alchemy deploy ./alchemy.run.ts
77
+ bun alchemy destroy ./alchemy.run.ts
78
+ ```
79
+
80
+ `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
81
 
67
82
  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
83
 
@@ -72,10 +87,12 @@ Long-running operations (`createProjects`, `patchProjects`, GKE cluster ops) are
72
87
  - **`GCP.ApiEnable`** — project-level GCP service enablement.
73
88
  - **`GCP.Cluster`** — Standard GKE cluster.
74
89
  - **`GCP.NodePool`** — node pool attached to a cluster, including accelerator (GPU) configurations.
75
- - **`GCP.Parallelstore`** — Parallelstore filesystem instance.
76
90
  - **`GCP.Network`** — VPC network.
77
91
  - **`GCP.Subnetwork`** — VPC subnetwork.
78
- - **`GCP.PrivateServiceConnection`** — VPC peering for Google managed services (PSA).
92
+ - **`GCP.PsaConnection`** — Private Service Access peering for Google managed services.
93
+ - **`GCP.GlobalAddress`** — global IP address (typically used to reserve a PSA range).
94
+ - **`GCP.SharedVpcHost`** / **`GCP.SharedVpcServiceProject`** — Shared VPC enable/attach.
95
+ - **`GCP.ParallelstoreInstance`** — Parallelstore filesystem instance.
79
96
 
80
97
  Each resource's full prop/attribute set is documented as JSDoc on the source.
81
98
 
@@ -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/01A860-D25444-D4B584`) — that's what
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: "264228230413" },
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: "264228230413" },
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.2",
3
+ "version": "0.1.4",
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/01A860-D25444-D4B584`) — that's what
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: "264228230413" },
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: "264228230413" },
112
+ * parent: { type: "folder", id: "<your-folder-id>" },
113
113
  * });
114
114
  * ```
115
115
  */