Skip to content

Commit d58b699

Browse files
committed
Update Terraform code blocks to use tf language
1 parent 470b917 commit d58b699

32 files changed

+113
-98
lines changed

docs/admin/infrastructure/validated-architectures/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ compute as users start/stop workspaces at the beginning and end of their day.
161161
Set nodeSelectors, affinities, and tolerations in Coder templates to assign
162162
workspaces to the given node group:
163163

164-
```hcl
164+
```tf
165165
resource "kubernetes_deployment" "coder" {
166166
spec {
167167
template {

docs/admin/integrations/jfrog-artifactory.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CODER_EXTERNAL_AUTH_1_SCOPES="applied-permissions/user"
9494
[JFrog-OAuth](https://registry.coder.com/modules/jfrog-oauth) module to
9595
configure the integration.
9696

97-
```hcl
97+
```tf
9898
module "jfrog" {
9999
source = "registry.coder.com/modules/jfrog-oauth/coder"
100100
version = "1.0.0"
@@ -129,7 +129,7 @@ To set this up, follow these steps:
129129
store the token in a sensitive terraform variable to prevent it from being
130130
displayed in plain text in the terraform state.
131131

132-
```hcl
132+
```tf
133133
variable "artifactory_access_token" {
134134
type = string
135135
sensitive = true

docs/admin/integrations/multiple-kube-clusters.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can start from our
6161
From there, add [template parameters](../../templates/concepts/parameters.md) to
6262
allow developers to pick their desired cluster.
6363

64-
```hcl
64+
```tf
6565
# main.tf
6666
6767
data "coder_parameter" "kube_context" {
@@ -159,7 +159,7 @@ rolebinding.rbac.authorization.k8s.io/coder-v2 created
159159
You can start from our
160160
[example template](https://github.com/coder/coder/tree/main/examples/templates/kubernetes).
161161

162-
```hcl
162+
```tf
163163
variable "host" {
164164
description = "Cluster host address"
165165
sensitive = true

docs/admin/networking/port-forwarding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ workspace's template. This approach shows a visual application icon in the
6767
dashboard. See the following `coder_app` example for a Node React app and note
6868
the `subdomain` and `share` settings:
6969

70-
```hcl
70+
```tf
7171
# node app
7272
resource "coder_app" "node-react-app" {
7373
agent_id = coder_agent.dev.id

docs/admin/security/secrets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ which excludes obscure API providers.
4949

5050
Dynamic secrets can be implemented in your template code like so:
5151

52-
```hcl
52+
```tf
5353
resource "twilio_iam_api_key" "api_key" {
5454
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
5555
friendly_name = "Test API Key"
@@ -80,7 +80,7 @@ can also show them in the Workspace UI with
8080

8181
Can be produced with
8282

83-
```hcl
83+
```tf
8484
resource "twilio_iam_api_key" "api_key" {
8585
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
8686
friendly_name = "Test API Key"

docs/admin/templates/extending-templates/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ There are a variety of Coder-native features to extend the configuration of your
88

99
For users to connect to a workspace, the template must include a [`coder_agent`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent). The associated agent will facilitate [workspace connections](../../../user-guides/workspace-access/README.md) via SSH, port forwarding, and IDEs. The agent may also display real-time [workspace metadata](./agent-metadata.md) like resource usage.
1010

11-
```hcl
11+
```tf
1212
resource "coder_agent" "dev" {
1313
os = "linux"
1414
arch = "amd64"

docs/admin/templates/extending-templates/agent-metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ usage about the workspace's host.
2222

2323
Here's a standard set of metadata snippets for Linux agents:
2424

25-
```hcl
25+
```tf
2626
resource "coder_agent" "main" {
2727
os = "linux"
2828
...

docs/admin/templates/extending-templates/docker-in-workspaces.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ inside Coder workspaces. See [Systemd in Docker](#systemd-in-docker).
2323
After [installing Sysbox](https://github.com/nestybox/sysbox#installation) on
2424
the Coder host, modify your template to use the sysbox-runc runtime:
2525

26-
```hcl
26+
```tf
2727
resource "docker_container" "workspace" {
2828
# ...
2929
name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
@@ -55,7 +55,7 @@ After
5555
modify your template to use the sysbox-runc RuntimeClass. This requires the
5656
Kubernetes Terraform provider version 2.16.0 or greater.
5757

58-
```hcl
58+
```tf
5959
terraform {
6060
required_providers {
6161
coder = {
@@ -175,7 +175,7 @@ $ kubectl create secret docker-registry <name> \
175175
--docker-email=<service-account-email>
176176
```
177177

178-
```hcl
178+
```tf
179179
env {
180180
name = "CODER_IMAGE_PULL_SECRET"
181181
value_from {
@@ -278,7 +278,7 @@ your nodes cannot run Sysbox.
278278
279279
### Use a privileged sidecar container in Docker-based templates
280280
281-
```hcl
281+
```tf
282282
resource "coder_agent" "main" {
283283
os = "linux"
284284
arch = "amd64"
@@ -315,7 +315,7 @@ resource "docker_container" "workspace" {
315315
316316
### Use a privileged sidecar container in Kubernetes-based templates
317317
318-
```hcl
318+
```tf
319319
terraform {
320320
required_providers {
321321
coder = {
@@ -387,7 +387,7 @@ After
387387
modify your template to use the sysbox-runc RuntimeClass. This requires the
388388
Kubernetes Terraform provider version 2.16.0 or greater.
389389
390-
```hcl
390+
```tf
391391
terraform {
392392
required_providers {
393393
coder = {

docs/admin/templates/extending-templates/external-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ If the token is required to be inserted into the workspace, for example
7070
template. This token will not auto-refresh. The following example will
7171
authenticate via GitHub and auto-clone a repo into the `~/coder` directory.
7272

73-
```hcl
73+
```tf
7474
data "coder_external_auth" "github" {
7575
# Matches the ID of the external auth provider in Coder.
7676
id = "github"

docs/admin/templates/extending-templates/icons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ come bundled with your Coder deployment.
2222

2323
These can all be configured to use an icon by setting the `icon` field.
2424

25-
```hcl
25+
```tf
2626
data "coder_parameter" "my_parameter" {
2727
icon = "/icon/coder.svg"
2828

docs/admin/templates/extending-templates/modules.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can store these modules externally from your Coder deployment, like in a git
88
repository or a Terraform registry. This example shows how to reference a module
99
from your template:
1010

11-
```hcl
11+
```tf
1212
data "coder_workspace" "me" {}
1313
1414
module "coder-base" {
@@ -82,7 +82,7 @@ to resolve modules via [Artifactory](https://jfrog.com/artifactory/).
8282
5. Create a file `.terraformrc` with following content and mount at
8383
`/home/coder/.terraformrc` within the Coder provisioner.
8484

85-
```hcl
85+
```tf
8686
provider_installation {
8787
direct {
8888
exclude = ["registry.terraform.io/*/*"]
@@ -95,7 +95,7 @@ to resolve modules via [Artifactory](https://jfrog.com/artifactory/).
9595

9696
6. Update module source as,
9797

98-
```hcl
98+
```tf
9999
module "module-name" {
100100
source = "https://example.jfrog.io/tf__coder/module-name/coder"
101101
version = "1.0.0"

docs/admin/templates/extending-templates/parameters.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ parameters like instance size, geographical location, repository URL, etc.
1414

1515
This example lets a developer choose a Docker host for the workspace:
1616

17-
```hcl
17+
```tf
1818
data "coder_parameter" "docker_host" {
1919
name = "Region"
2020
description = "Which region would you like to deploy to?"
@@ -44,7 +44,7 @@ data "coder_parameter" "docker_host" {
4444

4545
From there, a template can refer to a parameter's value:
4646

47-
```hcl
47+
```tf
4848
provider "docker" {
4949
host = data.coder_parameter.docker_host.value
5050
}
@@ -64,7 +64,7 @@ JSON array and the Terraform
6464
[jsonencode](https://developer.hashicorp.com/terraform/language/functions/jsonencode)
6565
function. For example:
6666

67-
```hcl
67+
```tf
6868
data "coder_parameter" "security_groups" {
6969
name = "Security groups"
7070
icon = "/icon/aws.png"
@@ -83,7 +83,7 @@ data "coder_parameter" "security_groups" {
8383

8484
A `string` parameter can provide a set of options to limit the user's choices:
8585

86-
```hcl
86+
```tf
8787
data "coder_parameter" "docker_host" {
8888
name = "Region"
8989
description = "Which region would you like to deploy to?"
@@ -145,7 +145,7 @@ Example:
145145
A parameter is _required_ if it doesn't have the `default` property. The user
146146
**must** provide a value to this parameter before creating a workspace:
147147

148-
```hcl
148+
```tf
149149
data "coder_parameter" "account_name" {
150150
name = "Account name"
151151
description = "Cloud account name"
@@ -156,7 +156,7 @@ data "coder_parameter" "account_name" {
156156
If a parameter contains the `default` property, Coder will use this value if the
157157
user does not specify any:
158158

159-
```hcl
159+
```tf
160160
data "coder_parameter" "base_image" {
161161
name = "Base image"
162162
description = "Base machine image to download"
@@ -167,7 +167,7 @@ data "coder_parameter" "base_image" {
167167
Admins can also set the `default` property to an empty value so that the
168168
parameter field can remain empty:
169169

170-
```hcl
170+
```tf
171171
data "coder_parameter" "dotfiles_url" {
172172
name = "dotfiles URL"
173173
description = "Git repository with dotfiles"
@@ -189,7 +189,7 @@ resources like volumes, regions, and so on.
189189

190190
Example:
191191

192-
```hcl
192+
```tf
193193
data "coder_parameter" "region" {
194194
name = "Region"
195195
description = "Region where the workspace is hosted"
@@ -212,7 +212,7 @@ project without using cache.
212212
Since these parameters are ephemeral in nature, subsequent builds proceed in the
213213
standard manner:
214214

215-
```hcl
215+
```tf
216216
data "coder_parameter" "force_rebuild" {
217217
name = "force_rebuild"
218218
type = "bool"
@@ -236,7 +236,7 @@ You can also specify its monotonicity as `increasing` or `decreasing` to verify
236236
the current and new values. Use the `monotonic` attribute for resources that
237237
can't be shrunk or grown without implications, like disk volume size.
238238

239-
```hcl
239+
```tf
240240
data "coder_parameter" "instances" {
241241
name = "Instances"
242242
type = "number"
@@ -253,7 +253,7 @@ It is possible to override the default `error` message for a `number` parameter,
253253
along with its associated `min` and/or `max` properties. The following message
254254
placeholders are available `{min}`, `{max}`, and `{value}`.
255255

256-
```hcl
256+
```tf
257257
data "coder_parameter" "instances" {
258258
name = "Instances"
259259
type = "number"
@@ -276,7 +276,7 @@ validations such as `monotonic`.
276276
You can validate a `string` parameter to match a regular expression. The `regex`
277277
property requires a corresponding `error` property.
278278

279-
```hcl
279+
```tf
280280
data "coder_parameter" "project_id" {
281281
name = "Project ID"
282282
description = "Alpha-numeric project ID"

docs/admin/templates/extending-templates/resource-metadata.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You can also present automatically updating, dynamic values with
2525
Expose the disk size, deployment name, and persistent directory in a Kubernetes
2626
template with:
2727

28-
```hcl
28+
```tf
2929
resource "kubernetes_persistent_volume_claim" "root" {
3030
...
3131
}
@@ -64,7 +64,7 @@ Some resources don't need to be exposed in the dashboard's UI. This helps keep
6464
the workspace view clean for developers. To hide a resource, use the `hide`
6565
attribute:
6666

67-
```hcl
67+
```tf
6868
resource "coder_metadata" "hide_serviceaccount" {
6969
count = data.coder_workspace.me.start_count
7070
resource_id = kubernetes_service_account.user_data.id
@@ -81,7 +81,7 @@ resource "coder_metadata" "hide_serviceaccount" {
8181
To use custom icons for your resource metadata, use the `icon` attribute. It
8282
must be a valid path or URL.
8383

84-
```hcl
84+
```tf
8585
resource "coder_metadata" "resource_with_icon" {
8686
count = data.coder_workspace.me.start_count
8787
resource_id = kubernetes_service_account.user_data.id

docs/admin/templates/extending-templates/resource-ordering.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The `order` property of `coder_parameter` resource allows specifying the order
1616
of parameters in UI forms. In the below example, `project_id` will appear
1717
_before_ `account_id`:
1818

19-
```hcl
19+
```tf
2020
data "coder_parameter" "project_id" {
2121
name = "project_id"
2222
display_name = "Project ID"
@@ -37,7 +37,7 @@ data "coder_parameter" "account_id" {
3737
Agent resources within the UI left pane are sorted based on the `order`
3838
property, followed by `name`, ensuring a consistent and intuitive arrangement.
3939

40-
```hcl
40+
```tf
4141
resource "coder_agent" "primary" {
4242
...
4343
@@ -59,7 +59,7 @@ The `coder_agent` exposes metadata to present operational metrics in the UI.
5959
Metrics defined with Terraform `metadata` blocks can be ordered using additional
6060
`order` property; otherwise, they are sorted by `key`.
6161

62-
```hcl
62+
```tf
6363
resource "coder_agent" "main" {
6464
...
6565
@@ -107,7 +107,7 @@ workspace view.
107107
Only template defined applications can be arranged. _VS Code_ or _Terminal_
108108
buttons are static.
109109

110-
```hcl
110+
```tf
111111
resource "coder_app" "code-server" {
112112
agent_id = coder_agent.main.id
113113
slug = "code-server"
@@ -135,7 +135,7 @@ The options for Coder parameters maintain the same order as in the file
135135
structure. This simplifies management and ensures consistency between
136136
configuration files and UI presentation.
137137

138-
```hcl
138+
```tf
139139
data "coder_parameter" "database_region" {
140140
name = "database_region"
141141
display_name = "Database Region"
@@ -166,7 +166,7 @@ In cases where multiple item properties exist, the order is inherited from the
166166
file, facilitating seamless integration between a Coder template and UI
167167
presentation.
168168

169-
```hcl
169+
```tf
170170
resource "coder_metadata" "attached_volumes" {
171171
resource_id = docker_image.main.id
172172

0 commit comments

Comments
 (0)