Skip to content

Commit a5edad7

Browse files
committed
chore(examples): add MODULE_NAME.tftest.hcl to new module sample and make run.sh optional
1 parent fb657b8 commit a5edad7

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
run "plan_with_required_vars" {
2+
command = plan
3+
4+
variables {
5+
agent_id = "example-agent-id"
6+
}
7+
}
8+
9+
run "app_url_uses_port" {
10+
command = plan
11+
12+
variables {
13+
agent_id = "example-agent-id"
14+
port = 19999
15+
}
16+
17+
assert {
18+
condition = resource.coder_app.MODULE_NAME.url == "http://localhost:19999"
19+
error_message = "Expected MODULE_NAME app URL to include configured port"
20+
}
21+
}

scripts/new_module.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if [ -d "registry/$NAMESPACE/modules/$MODULE_NAME" ]; then
3131
fi
3232
mkdir -p "registry/${NAMESPACE}/modules/${MODULE_NAME}"
3333

34-
# Copy required files from the example module
34+
# Copy required files from the example module (includes Terraform tests)
3535
cp -r examples/modules/* "registry/${NAMESPACE}/modules/${MODULE_NAME}/"
3636

3737
# Change to module directory
@@ -48,5 +48,7 @@ else
4848
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" README.md
4949
fi
5050

51-
# Make run.sh executable
52-
chmod +x run.sh
51+
# Make run.sh executable (if present)
52+
if [ -f run.sh ]; then
53+
chmod +x run.sh
54+
fi

0 commit comments

Comments
 (0)