Skip to content

Commit ee22563

Browse files
committed
Add deployment data source
Expose direct project-scoped deployment metadata without logs, event streams, source fields absent from the tagged SDK, or environment values.
1 parent 3755aea commit ee22563

15 files changed

Lines changed: 784 additions & 13 deletions

File tree

.github/workflows/acceptance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ jobs:
4646
package: ./internal/datasources/app
4747
project_id_required: true
4848
app_fixture_required: true
49+
- name: Deployment data source
50+
package: ./internal/datasources/deployment
51+
project_id_required: true
52+
app_fixture_required: true
4953
# Keep the job timeout above the go test timeout so Go can report the test
5054
# timeout before the runner stops the job. Either hard timeout can bypass
5155
# t.Cleanup, so release operators still inspect for leaked test resources.

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ First public v1 release candidate:
88

99
- Provider configuration for `api_key`, `base_url`, and `project_id`.
1010
- Durable `kernel_project`, `kernel_browser_pool`, and `kernel_extension` resources.
11-
- Lookup-only `kernel_app`, `kernel_browser_pool`, `kernel_project`, `kernel_profile`, `kernel_proxy`, and `kernel_extension` data sources.
11+
- Lookup-only `kernel_app`, `kernel_browser_pool`, `kernel_deployment`, `kernel_project`, `kernel_profile`, `kernel_proxy`, and `kernel_extension` data sources.
1212
- Stable import for every registered resource, including project-qualified browser-pool and extension forms.
1313
- Unit tests, generated Terraform docs, Terraform examples, CI checks, and an opt-in live acceptance matrix.
1414

1515
Intentionally deferred from the first public v1 because their durable API, SDK, or sensitive-state contracts are incomplete:
1616

1717
- Runtime browser/session operations such as acquire, release, flush, app invocation, screenshots, logs, live view, and force recovery.
1818
- API key, profile, proxy, and deployment resources.
19-
- API key and deployment data sources.
19+
- API key data source.
2020
- `force_destroy` browser-pool deletion.
2121
- Terraform Plugin Framework code generation.
2222

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Data sources:
2222

2323
- `kernel_app`
2424
- `kernel_browser_pool`
25+
- `kernel_deployment`
2526
- `kernel_project`
2627
- `kernel_profile`
2728
- `kernel_proxy`

docs/acceptance.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Actions secrets and must not be printed.
4949
| `kernel_profile` data source | Test present | A uniquely created durable profile is read by canonical ID and exact name through explicit and provider-default project scope; metadata, no-drift planning, and post-cleanup coded `not_found` are verified. | None. |
5050
| `kernel_proxy` data source | Test present | A uniquely created managed datacenter proxy is read by canonical ID and exact name through explicit and provider-default project scope; durable type/protocol metadata, no-drift planning, and post-cleanup coded `not_found` are verified without fixture credentials. | None. |
5151
| `kernel_app` data source | Test present | A release-owned running app version is read by exact name/version through explicit and provider-default project scope; canonical deployment metadata and no-drift planning are verified without invocation. Unit coverage verifies action-name and environment-key flattening without environment values. | Keep `KERNEL_ACC_APP_NAME` and `KERNEL_ACC_APP_VERSION` pointed at exactly one running app version in the acceptance project. |
52+
| `kernel_deployment` data source | Test present | The deployment backing the release-owned app fixture is read by canonical ID through explicit and provider-default project scope; direct GET metadata and no-drift planning are verified without logs or event streams. Unit coverage verifies that only environment variable names enter state. | Keep the release-owned app fixture running so its deployment ID remains readable. |
5253
| `kernel_api_key` data source | Deferred; unregistered | No provider surface yet. | Wait for a tagged SDK with exact-name filtering, then add masked ID/name lookup acceptance. |
5354
| Profile, proxy, deployment, and API-key resources | Deferred; unregistered | No provider surfaces yet. | Enter the matrix only after their documented API/SDK/state blockers are resolved and implementation lands. |
5455

@@ -57,7 +58,7 @@ against the release commit. The release record below supplies that evidence.
5758

5859
## Current Commands
5960

60-
Run the nine existing packages independently for fast failure isolation:
61+
Run the ten existing packages independently for fast failure isolation:
6162

6263
```sh
6364
go test -count=1 -timeout=30m -v ./internal/resources/project -run TestAcc
@@ -68,6 +69,7 @@ go test -count=1 -timeout=30m -v ./internal/datasources/extension -run TestAcc
6869
go test -count=1 -timeout=30m -v ./internal/datasources/profile -run TestAcc
6970
go test -count=1 -timeout=30m -v ./internal/datasources/proxy -run TestAcc
7071
go test -count=1 -timeout=30m -v ./internal/datasources/app -run TestAcc
72+
go test -count=1 -timeout=30m -v ./internal/datasources/deployment -run TestAcc
7173
go test -count=1 -timeout=30m -v ./internal/datasources/browserpool -run TestAcc
7274
```
7375

docs/architecture.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ tagged SDK exposes source provenance, the API supports deterministic durable
8484
readback, and the write-only environment/token plus metadata-only import design
8585
is accepted. Its current status may be exposed only as computed inspection
8686
metadata: it cannot be configured, drive a diff, or be populated from an event
87-
stream. The `kernel_deployment` data source is limited to fields returned by a
88-
durable deployment GET; app name, version, and actions remain the responsibility
89-
of the exact-lookup `kernel_app` data source until deployment reads expose them
90-
directly. The resource omits `force` until the API implements and tests the
91-
documented overwrite behavior. `kernel_app` remains lookup-only.
87+
stream. The registered `kernel_deployment` data source is limited to fields the
88+
tagged SDK returns from a durable deployment GET; source provenance remains
89+
omitted until it reaches a tagged SDK. App name, version, and actions remain the
90+
responsibility of the exact-lookup `kernel_app` data source until deployment
91+
reads expose them directly. The resource omits `force` until the API implements
92+
and tests the documented overwrite behavior. `kernel_app` remains lookup-only.
9293

9394
Terraform schema and model code generation remains deferred. The current tool produced valid output but did not reduce code or review complexity, and broad OpenAPI-driven generation would further weaken the durable allowlist.
9495

docs/data-sources/deployment.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "kernel_deployment Data Source - Kernel"
4+
subcategory: ""
5+
description: |-
6+
Lookup a Kernel deployment by canonical ID without reading logs or event streams.
7+
---
8+
9+
# kernel_deployment (Data Source)
10+
11+
Lookup a Kernel deployment by canonical ID without reading logs or event streams.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `id` (String) Canonical deployment ID.
21+
22+
### Optional
23+
24+
- `project_id` (String) Project to look the deployment up in. Defaults to the provider `project_id`; when neither is set, the API key's project binding determines the project.
25+
26+
### Read-Only
27+
28+
- `created_at` (String) Deployment creation timestamp.
29+
- `entrypoint_rel_path` (String) Relative path to the deployed application entrypoint, if recorded.
30+
- `env_var_keys` (Set of String) Environment variable names configured for the deployment. Values are never exposed.
31+
- `region` (String) Deployment region.
32+
- `status` (String) Current deployment status for inspection only.
33+
- `status_reason` (String) Current status reason, if provided by Kernel.
34+
- `updated_at` (String) Deployment update timestamp, if available.

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Use local development overrides while the provider is unreleased. See the root [
1818
- [basic-browser-pool](basic-browser-pool) creates a minimal durable browser pool.
1919
- [design-preview-browser-pool](design-preview-browser-pool) shows a browser pool shaped for repeated design-preview checks without modeling the browser sessions themselves.
2020
- [extension](extension) uploads an immutable extension archive and tracks exact content changes with `filesha256`.
21-
- [lookups](lookups) shows read-only app, browser-pool, project, profile, proxy, and extension data sources.
21+
- [lookups](lookups) shows read-only app, browser-pool, deployment, project, profile, proxy, and extension data sources.
2222
- [project](project) creates a durable Kernel project with an explicit unique name.
2323
- [project-scoped-browser-pool](project-scoped-browser-pool) places a browser pool in an explicit project, overriding the provider-level `project_id` default.

examples/lookups/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ data "kernel_app" "selected" {
7373
project_id = data.kernel_project.selected.id
7474
}
7575

76+
data "kernel_deployment" "selected" {
77+
id = data.kernel_app.selected.deployment_id
78+
project_id = data.kernel_project.selected.id
79+
}
80+
7681
output "kernel_ids" {
7782
value = {
7883
project_id = data.kernel_project.selected.id
@@ -81,6 +86,6 @@ output "kernel_ids" {
8186
proxy_id = data.kernel_proxy.selected.id
8287
extension_id = data.kernel_extension.selected.id
8388
app_id = data.kernel_app.selected.id
84-
deployment_id = data.kernel_app.selected.deployment_id
89+
deployment_id = data.kernel_deployment.selected.id
8590
}
8691
}

0 commit comments

Comments
 (0)