Skip to content

Commit 63cad25

Browse files
fix(amazon-q): pass workdir variable into agentapi folder variable (#478)
Co-authored-by: DevCats <christofer@coder.com>
1 parent cd759bd commit 63cad25

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

registry/coder/modules/amazon-q/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run [Amazon Q](https://aws.amazon.com/q/) in your workspace to access Amazon's A
1313
```tf
1414
module "amazon-q" {
1515
source = "registry.coder.com/coder/amazon-q/coder"
16-
version = "2.1.0"
16+
version = "2.1.1"
1717
agent_id = coder_agent.example.id
1818
workdir = "/home/coder"
1919
@@ -102,7 +102,7 @@ data "coder_parameter" "ai_prompt" {
102102
103103
module "amazon-q" {
104104
source = "registry.coder.com/coder/amazon-q/coder"
105-
version = "2.1.0"
105+
version = "2.1.1"
106106
agent_id = coder_agent.example.id
107107
workdir = "/home/coder"
108108
auth_tarball = var.amazon_q_auth_tarball
@@ -228,7 +228,7 @@ If no custom `agent_config` is provided, the default agent name "agent" is used.
228228
```tf
229229
module "amazon-q" {
230230
source = "registry.coder.com/coder/amazon-q/coder"
231-
version = "2.1.0"
231+
version = "2.1.1"
232232
agent_id = coder_agent.example.id
233233
workdir = "/home/coder"
234234
auth_tarball = var.amazon_q_auth_tarball
@@ -258,7 +258,7 @@ This example will:
258258
```tf
259259
module "amazon-q" {
260260
source = "registry.coder.com/coder/amazon-q/coder"
261-
version = "2.1.0"
261+
version = "2.1.1"
262262
agent_id = coder_agent.example.id
263263
workdir = "/home/coder"
264264
auth_tarball = var.amazon_q_auth_tarball
@@ -279,7 +279,7 @@ module "amazon-q" {
279279
```tf
280280
module "amazon-q" {
281281
source = "registry.coder.com/coder/amazon-q/coder"
282-
version = "2.1.0"
282+
version = "2.1.1"
283283
agent_id = coder_agent.example.id
284284
workdir = "/home/coder"
285285
auth_tarball = var.amazon_q_auth_tarball
@@ -305,7 +305,7 @@ module "amazon-q" {
305305
```tf
306306
module "amazon-q" {
307307
source = "registry.coder.com/coder/amazon-q/coder"
308-
version = "2.1.0"
308+
version = "2.1.1"
309309
agent_id = coder_agent.example.id
310310
workdir = "/home/coder"
311311
auth_tarball = var.amazon_q_auth_tarball
@@ -319,7 +319,7 @@ module "amazon-q" {
319319
```tf
320320
module "amazon-q" {
321321
source = "registry.coder.com/coder/amazon-q/coder"
322-
version = "2.1.0"
322+
version = "2.1.1"
323323
agent_id = coder_agent.example.id
324324
workdir = "/home/coder"
325325
auth_tarball = var.amazon_q_auth_tarball
@@ -340,7 +340,7 @@ module "amazon-q" {
340340
```tf
341341
module "amazon-q" {
342342
source = "registry.coder.com/coder/amazon-q/coder"
343-
version = "2.1.0"
343+
version = "2.1.1"
344344
agent_id = coder_agent.example.id
345345
workdir = "/home/coder"
346346
auth_tarball = var.amazon_q_auth_tarball
@@ -358,7 +358,7 @@ For environments without direct internet access, you can host Amazon Q installat
358358
```tf
359359
module "amazon-q" {
360360
source = "registry.coder.com/coder/amazon-q/coder"
361-
version = "2.1.0"
361+
version = "2.1.1"
362362
agent_id = coder_agent.example.id
363363
workdir = "/home/coder"
364364
auth_tarball = var.amazon_q_auth_tarball

registry/coder/modules/amazon-q/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ variable "workdir" {
9696
description = "The folder to run Amazon Q in."
9797
}
9898

99-
# ---------------------------------------------
100-
10199
variable "install_amazon_q" {
102100
type = bool
103101
description = "Whether to install Amazon Q."
@@ -190,6 +188,7 @@ resource "coder_env" "auth_tarball" {
190188

191189
locals {
192190
app_slug = "amazonq"
191+
workdir = trimsuffix(var.workdir, "/")
193192
install_script = file("${path.module}/scripts/install.sh")
194193
start_script = file("${path.module}/scripts/start.sh")
195194
module_dir_name = ".amazonq-module"
@@ -218,6 +217,7 @@ module "agentapi" {
218217
version = "1.2.0"
219218

220219
agent_id = var.agent_id
220+
folder = local.workdir
221221
web_app_slug = local.app_slug
222222
web_app_order = var.order
223223
web_app_group = var.group

registry/coder/modules/amazon-q/scripts/install.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ function install_amazon_q() {
9494
function extract_auth_tarball() {
9595
if [ -n "$ARG_AUTH_TARBALL" ]; then
9696
echo "Extracting auth tarball..."
97+
98+
if ! command_exists zstd; then
99+
echo "Error: zstd is required to extract the authentication tarball but is not installed."
100+
echo "Please install zstd using the pre_install_script parameter."
101+
exit 1
102+
fi
103+
97104
PREV_DIR="$PWD"
98105
echo "$ARG_AUTH_TARBALL" | base64 -d > /tmp/auth.tar.zst
99106
rm -rf ~/.local/share/amazon-q

0 commit comments

Comments
 (0)