Skip to content

Commit 14f0470

Browse files
committed
chore: update envbox template legacy parameters
1 parent a77b48a commit 14f0470

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

examples/templates/envbox/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ The following environment variables can be used to configure various aspects of
2727
| `CODER_CPUS` | Dictates the number of CPUs to allocate the inner container. It is recommended to set this using the Kubernetes [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-container-fields-as-values-for-environment-variables). | false |
2828
| `CODER_MEMORY` | Dictates the max memory (in bytes) to allocate the inner container. It is recommended to set this using the Kubernetes [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-container-fields-as-values-for-environment-variables). | false |
2929

30+
# Migrating Existing Envbox Templates
31+
32+
Due to the [deprecation and removal of legacy parameters](https://coder.com/docs/v2/latest/templates/parameters#legacy)
33+
it may be necessary to migrate existing envbox templates on newer versions of
34+
Coder. Consult the [migration](https://coder.com/docs/v2/latest/templates/parameters#migration)
35+
documentation for details on how to do so.
36+
37+
To supply values to existing existing Terraform variables you can specify the
38+
`--variable` flag. For example
39+
40+
```bash
41+
coder templates create test --variable namespace="mynamespace" --variable max_cpus=2 --variable min_cpus=1 --variable max_memory=4 --variable min_memory=1
42+
```
43+
3044
## Contributions
3145

3246
Contributions are welcome and can be made against the [envbox repo](https://github.com/coder/envbox).

examples/templates/envbox/main.tf

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ data "coder_parameter" "home_disk" {
2727
variable "use_kubeconfig" {
2828
type = bool
2929
sensitive = true
30+
default = true
3031
description = <<-EOF
3132
Use host kubeconfig? (true/false)
3233
Set this to false if the Coder host is itself running as a Pod on the same
@@ -36,6 +37,10 @@ variable "use_kubeconfig" {
3637
EOF
3738
}
3839

40+
provider "coder" {
41+
feature_use_managed_variables = "true"
42+
}
43+
3944
variable "namespace" {
4045
type = string
4146
sensitive = true
@@ -46,12 +51,14 @@ variable "create_tun" {
4651
type = bool
4752
sensitive = true
4853
description = "Add a TUN device to the workspace."
54+
default = false
4955
}
5056

5157
variable "create_fuse" {
5258
type = bool
5359
description = "Add a FUSE device to the workspace."
5460
sensitive = true
61+
default = false
5562
}
5663

5764
variable "max_cpus" {
@@ -138,11 +145,15 @@ resource "kubernetes_persistent_volume_claim" "home" {
138145

139146
resource "kubernetes_pod" "main" {
140147
count = data.coder_workspace.me.start_count
148+
141149
metadata {
142150
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
143151
namespace = var.namespace
144152
}
153+
145154
spec {
155+
restart_policy = "Never"
156+
146157
container {
147158
name = "dev"
148159
image = "ghcr.io/coder/envbox:latest"

0 commit comments

Comments
 (0)