Skip to content

Commit b89aab2

Browse files
committed
Enhance GCP documentation: add comprehensive provider configuration, backend options, example environments and services, module linking details, and useful commands for improved clarity and usability.
1 parent 730d48c commit b89aab2

File tree

1 file changed

+84
-1
lines changed

1 file changed

+84
-1
lines changed

docs/references/gcp.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,86 @@
11
# GCP Reference
22

3-
> Placeholder. Document provider settings, backend options (gcs or s3), and guidance for custom modules.
3+
GCP is supported for environments, services, and the embedded module catalog. This page summarizes provider configuration, backends, and module wiring for GCP.
4+
5+
## Provider and Backends
6+
- **Provider:** `provider: gcp` (or `google`) in the spec. Region comes from the selected environment entry.
7+
- **Project:** `environments.<env>.account` is treated as the GCP project ID.
8+
- **Backends:** `backend.type: gcs` (default if omitted). Set `backend.bucket` to use an existing state bucket.
9+
10+
## Example (Environment + Service)
11+
Environment:
12+
```yaml
13+
apiVersion: platform.io/v1
14+
kind: Environment
15+
metadata:
16+
name: example-gcp
17+
org: pltf
18+
provider: gcp
19+
labels:
20+
team: platform
21+
cost_center: shared
22+
environments:
23+
dev:
24+
account: "pltf-dev-project"
25+
region: us-central1
26+
modules:
27+
- id: base
28+
type: gcp_base
29+
- id: gke
30+
type: gcp_gke
31+
inputs:
32+
cluster_name: "pltf-${env_name}"
33+
node_zone_names:
34+
- us-central1-a
35+
- us-central1-b
36+
```
37+
38+
Service:
39+
```yaml
40+
apiVersion: platform.io/v1
41+
kind: Service
42+
metadata:
43+
name: data-jobs
44+
ref: ./env.yaml
45+
envRef:
46+
dev: {}
47+
modules:
48+
- id: data-bucket
49+
type: gcp_gcs
50+
inputs:
51+
bucket_name: "pltf-data-${env_name}"
52+
links:
53+
readwrite: data-sa
54+
- id: data-sa
55+
type: gcp_service_account
56+
```
57+
58+
## Modules and Fields
59+
- **id:** required and unique within the stack.
60+
- **type:** selects the module implementation; required unless `source` is a git/local path with `module.yaml`.
61+
- **source:** optional; git/paths load metadata directly.
62+
- **inputs:** key/value config for module variables.
63+
- **links:** access bindings used to connect modules (for example, GCS buckets to service accounts).
64+
65+
## Linking
66+
Linking lets a GCS module grant access to a service account:
67+
```yaml
68+
links:
69+
readwrite:
70+
- data-sa
71+
```
72+
For GCP, pltf maps these links to `read_buckets`/`write_buckets` inputs on `gcp_service_account` (or `gcp_k8s_service`).
73+
74+
## Template placeholders
75+
- `${env_name}` and `${layer_name}` become the resolved environment/service names.
76+
- `${module.<module_name>.<output_name>}` references another module’s output.
77+
- `${parent.<output_name>}` references outputs from the parent environment when authoring a service.
78+
- `${var.<name>}` references variables defined in the spec or via `--var`.
79+
80+
## Useful commands
81+
- `pltf module list -o table` — see available GCP modules.
82+
- `pltf module get gcp_gke` — inspect inputs/outputs.
83+
- `pltf generate -f env.yaml -e dev` — render Terraform for GCP.
84+
- `pltf terraform plan/apply ...` — generate + execute Terraform.
85+
86+
See the module-specific pages under “Modules (GCP)” for detailed inputs, outputs, and examples.

0 commit comments

Comments
 (0)