You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module installs small, robust scripts in your workspace to create and extract tar archives from a list of files and directories. It supports optional compression (gzip or zstd). The create command prints only the resulting archive path to stdout; operational logs go to stderr. An optional stop hook can also create an archive automatically when the workspace stops, and an optional start hook can wait for an archive on-disk and extract it on start.
12
12
13
-
14
13
## Features
15
14
16
15
- Installs two commands into the workspace `$PATH`: `coder-archive-create` and `coder-archive-extract`.
@@ -28,14 +27,14 @@ Basic example:
28
27
29
28
```tf
30
29
module "archive" {
31
-
count = data.coder_workspace.me.start_count
32
-
source = "registry.coder.com/coder/archive/coder"
33
-
version = "0.0.1"
34
-
agent_id = coder_agent.example.id
30
+
count = data.coder_workspace.me.start_count
31
+
source = "registry.coder.com/coder/archive/coder"
32
+
version = "0.0.1"
33
+
agent_id = coder_agent.example.id
35
34
36
35
# Paths to include in the archive (files or directories).
37
36
directory = "~"
38
-
paths = [
37
+
paths = [
39
38
"./projects",
40
39
"./code",
41
40
]
@@ -46,29 +45,29 @@ Customize compression and output:
46
45
47
46
```tf
48
47
module "archive" {
49
-
count = data.coder_workspace.me.start_count
50
-
source = "registry.coder.com/coder/archive/coder"
51
-
version = "0.0.1"
52
-
agent_id = coder_agent.example.id
48
+
count = data.coder_workspace.me.start_count
49
+
source = "registry.coder.com/coder/archive/coder"
50
+
version = "0.0.1"
51
+
agent_id = coder_agent.example.id
53
52
54
53
directory = "/"
55
54
paths = ["/etc", "/home"]
56
-
compression = "zstd" # "gzip" | "zstd" | "none"
57
-
output_dir = "/tmp/backup" # defaults to /tmp
58
-
archive_name = "my-backup" # base name (extension is inferred from compression)
55
+
compression = "zstd" # "gzip" | "zstd" | "none"
56
+
output_dir = "/tmp/backup" # defaults to /tmp
57
+
archive_name = "my-backup" # base name (extension is inferred from compression)
59
58
}
60
59
```
61
60
62
61
Enable auto-archive on stop:
63
62
64
63
```tf
65
64
module "archive" {
66
-
count = data.coder_workspace.me.start_count
67
-
source = "registry.coder.com/coder/archive/coder"
68
-
version = "0.0.1"
69
-
agent_id = coder_agent.example.id
65
+
count = data.coder_workspace.me.start_count
66
+
source = "registry.coder.com/coder/archive/coder"
67
+
version = "0.0.1"
68
+
agent_id = coder_agent.example.id
70
69
71
-
# Creates /tmp/coder-archive.tar.gz of the users home directory (defaults).
70
+
# Creates /tmp/coder-archive.tar.gz of the users home directory (defaults).
72
71
create_on_stop = true
73
72
}
74
73
```
@@ -77,19 +76,19 @@ Extract on start:
77
76
78
77
```tf
79
78
module "archive" {
80
-
count = data.coder_workspace.me.start_count
81
-
source = "registry.coder.com/coder/archive/coder"
82
-
version = "0.0.1"
83
-
agent_id = coder_agent.example.id
79
+
count = data.coder_workspace.me.start_count
80
+
source = "registry.coder.com/coder/archive/coder"
81
+
version = "0.0.1"
82
+
agent_id = coder_agent.example.id
84
83
85
84
# Where to look for the archive file to extract:
86
-
output_dir = "/tmp"
87
-
archive_name = "my-archive"
88
-
compression = "gzip"
85
+
output_dir = "/tmp"
86
+
archive_name = "my-archive"
87
+
compression = "gzip"
89
88
90
-
# Waits up to 5 minutes for /tmp/my-archive.tar.gz to be present.
91
-
extract_on_start = true
92
-
extract_wait_timeout_seconds = 300
89
+
# Waits up to 5 minutes for /tmp/my-archive.tar.gz to be present.
0 commit comments