Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3379347

Browse files
docs(modules): linting
1 parentba1bba3 commit3379347

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

‎docs/about/contributing/modules.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Browse available modules at [registry.coder.com](https://registry.coder.com).
110110

111111
Every module consists of exactly four files:
112112

113-
```
113+
```text
114114
module-name/
115115
├── main.tf # Terraform configuration with Coder resources
116116
├── main.test.ts # Test suite
@@ -136,12 +136,14 @@ The Coder Terraform provider offers several resource types for different aspects
136136
Execute commands during workspace lifecycle events. This is the primary mechanism for software installation, service configuration, and environment setup.
137137

138138
**When to use**:
139+
139140
- Installing software packages, binaries, or development tools
140141
- Configuring services and generating configuration files
141142
- Setting up directories, permissions, and initial workspace state
142143
- Running background services or daemons
143144

144145
**Key properties**:
146+
145147
-`agent_id`: The Coder agent to execute the script on
146148
-`display_name`: Name shown in the Coder dashboard during execution
147149
-`run_on_start`: Execute when workspace starts (most common)
@@ -150,6 +152,7 @@ Execute commands during workspace lifecycle events. This is the primary mechanis
150152
-`start_blocks_login`: Whether script completion is required before user access
151153

152154
Example:
155+
153156
```tf
154157
resource "coder_script" "install" {
155158
agent_id = var.agent_id
@@ -168,18 +171,21 @@ resource "coder_script" "install" {
168171
Create accessible applications in the Coder workspace interface, providing users with one-click access to tools and services.
169172

170173
**When to use**:
174+
171175
- Exposing web-based development tools (IDEs, dashboards)
172176
- Creating links to desktop applications via custom protocols
173177
- Providing access to running services
174178

175179
**Key properties**:
180+
176181
-`agent_id`: The Coder agent
177182
-`external`:`true` for protocol handlers,`false` for web apps
178183
-`healthcheck`: Monitor service availability
179184
-`subdomain`: Access method for web apps
180185
-`url`: Service URL or protocol handler
181186

182187
Example:
188+
183189
```tf
184190
resource "coder_app" "service" {
185191
agent_id = var.agent_id
@@ -199,11 +205,13 @@ resource "coder_app" "service" {
199205
Set environment variables in workspace sessions for tool configuration and authentication.
200206

201207
**When to use**:
208+
202209
- Configuring development tools and CLIs
203210
- Providing authentication tokens
204211
- Setting service endpoints
205212

206213
Example:
214+
207215
```tf
208216
resource "coder_env" "config" {
209217
agent_id = var.agent_id
@@ -230,6 +238,7 @@ data "coder_workspace_owner" "me" {}
230238
###Variable Design
231239

232240
**Required Variables**:
241+
233242
```tf
234243
variable "agent_id" {
235244
type = string
@@ -239,6 +248,7 @@ variable "agent_id" {
239248
```
240249

241250
**Optional Variables with Validation**:
251+
242252
```tf
243253
variable "version" {
244254
type = string
@@ -252,6 +262,7 @@ variable "version" {
252262
```
253263

254264
**Complex Configuration Objects**:
265+
255266
```tf
256267
variable "service_config" {
257268
type = object({
@@ -266,6 +277,7 @@ variable "service_config" {
266277
```
267278

268279
**Sensitive Variables**:
280+
269281
```tf
270282
variable "api_key" {
271283
type = string
@@ -278,6 +290,7 @@ variable "api_key" {
278290
###Script Development
279291

280292
**Template-driven scripts** pass variables to your`run.sh`:
293+
281294
```tf
282295
resource "coder_script" "install" {
283296
agent_id = var.agent_id
@@ -292,6 +305,7 @@ resource "coder_script" "install" {
292305
```
293306

294307
**Error handling** in your shell scripts:
308+
295309
```bash
296310
#!/bin/bash
297311
set -euo pipefail
@@ -313,6 +327,7 @@ fi
313327
###Integration Patterns
314328

315329
**Conditional resources** using`start_count`:
330+
316331
```tf
317332
resource "coder_app" "service" {
318333
count = data.coder_workspace.me.start_count
@@ -322,6 +337,7 @@ resource "coder_app" "service" {
322337
```
323338

324339
**Multi-step installation** with dependencies:
340+
325341
```tf
326342
resource "coder_script" "install_deps" {
327343
agent_id = var.agent_id
@@ -338,6 +354,7 @@ resource "coder_script" "configure_service" {
338354
```
339355

340356
**Health checks** for web services:
357+
341358
```tf
342359
resource "coder_app" "service" {
343360
agent_id = var.agent_id
@@ -363,6 +380,7 @@ While not mandatory, **tests are recommended** for all modules. A `main.test.ts`
363380
-**Required variables** are properly validated
364381

365382
The test framework provides utilities from`~test` import to:
383+
366384
- Initialize Terraform in the module directory
367385
- Apply Terraform with test variables
368386
- Validate the resulting infrastructure state

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp