Skip to content

Commit eaedba1

Browse files
committed
update
1 parent a7d288e commit eaedba1

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

docs/resources/deployment.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ subcategory: ""
55
description: |-
66
Creates a deployment for a Spice.ai app.
77
A deployment uses the app's current spicepod configuration and deploys it to the Spice.ai cloud infrastructure. Deployments are immutable - any changes to deployment parameters will create a new deployment.
8+
~> Note: Deployments are append-only log entries. Removing this resource from your configuration will only remove it from Terraform state - it will NOT stop or affect the running instance. To deploy new changes, modify the configuration or triggers to create a new deployment.
89
Example Usage
10+
Basic Deployment
911
1012
resource "spiceai_deployment" "example" {
1113
app_id = spiceai_app.example.id
@@ -20,6 +22,20 @@ description: |-
2022
commit_sha = "abc123def456"
2123
commit_message = "Deploy via Terraform"
2224
}
25+
26+
Deployment with Triggers
27+
Use triggers to force a new deployment when external values change (similar to null_resource):
28+
29+
resource "spiceai_deployment" "example" {
30+
app_id = spiceai_app.example.id
31+
32+
# Trigger new deployment when spicepod config changes
33+
triggers = {
34+
spicepod_hash = sha256(spiceai_app.example.spicepod)
35+
# Or trigger on any value change
36+
# deployment_version = "v1.2.3"
37+
}
38+
}
2339
---
2440

2541
# spiceai_deployment (Resource)
@@ -28,8 +44,12 @@ Creates a deployment for a Spice.ai app.
2844

2945
A deployment uses the app's current spicepod configuration and deploys it to the Spice.ai cloud infrastructure. Deployments are immutable - any changes to deployment parameters will create a new deployment.
3046

47+
~> **Note:** Deployments are append-only log entries. Removing this resource from your configuration will only remove it from Terraform state - it will NOT stop or affect the running instance. To deploy new changes, modify the configuration or triggers to create a new deployment.
48+
3149
## Example Usage
3250

51+
### Basic Deployment
52+
3353
```hcl
3454
resource "spiceai_deployment" "example" {
3555
app_id = spiceai_app.example.id
@@ -46,6 +66,23 @@ resource "spiceai_deployment" "example" {
4666
}
4767
```
4868

69+
### Deployment with Triggers
70+
71+
Use triggers to force a new deployment when external values change (similar to `null_resource`):
72+
73+
```hcl
74+
resource "spiceai_deployment" "example" {
75+
app_id = spiceai_app.example.id
76+
77+
# Trigger new deployment when spicepod config changes
78+
triggers = {
79+
spicepod_hash = sha256(spiceai_app.example.spicepod)
80+
# Or trigger on any value change
81+
# deployment_version = "v1.2.3"
82+
}
83+
}
84+
```
85+
4986
## Example Usage
5087

5188
```terraform
@@ -106,6 +143,7 @@ resource "spiceai_deployment" "production" {
106143
- `debug` (Boolean) Enable debug mode for this deployment. Changing this forces a new deployment to be created.
107144
- `image_tag` (String) Override the Spice.ai runtime image tag for this deployment. If not specified, uses the app's configured image tag. Changing this forces a new deployment to be created.
108145
- `replicas` (Number) Override the number of replicas for this deployment. Must be between 1 and 10. If not specified, uses the app's configured replicas. Changing this forces a new deployment to be created.
146+
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force a new deployment to be created. Use this to trigger deployments based on external changes, such as spicepod configuration updates. Similar to `triggers` in `null_resource`.
109147

110148
### Read-Only
111149

examples/local-spice-api/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ resource "spiceai_app" "test" {
2828
spicepod = file("${path.module}/spicepod.yaml")
2929

3030
# # Runtime configuration
31-
image_tag = "1.10.0-enterprise-models"
32-
replicas = 1
31+
image_tag = "1.10.0-enterprise-models"
32+
replicas = 1
3333
# production_branch = "main"
3434
}
3535

0 commit comments

Comments
 (0)