mirror of
https://github.com/coder/registry.git
synced 2026-06-03 04:58:15 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b4f485d72 |
+16
-11
@@ -24,7 +24,7 @@ The Coder Registry is a collection of Terraform modules and templates for Coder
|
|||||||
|
|
||||||
### Install Dependencies
|
### Install Dependencies
|
||||||
|
|
||||||
Install Bun:
|
Install Bun (for formatting and scripts):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL https://bun.sh/install | bash
|
curl -fsSL https://bun.sh/install | bash
|
||||||
@@ -124,19 +124,23 @@ This script generates:
|
|||||||
- Accurate description and usage examples
|
- Accurate description and usage examples
|
||||||
- Correct icon path (usually `../../../../.icons/your-icon.svg`)
|
- Correct icon path (usually `../../../../.icons/your-icon.svg`)
|
||||||
- Proper tags that describe your module
|
- Proper tags that describe your module
|
||||||
3. **Create `main.test.ts`** to test your module
|
3. **Create at least one `.tftest.hcl`** to test your module with `terraform test`
|
||||||
4. **Add any scripts** or additional files your module needs
|
4. **Add any scripts** or additional files your module needs
|
||||||
|
|
||||||
### 4. Test and Submit
|
### 4. Test and Submit
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Test your module
|
# Test your module (from the module directory)
|
||||||
bun test -t 'module-name'
|
terraform init -upgrade
|
||||||
|
terraform test -verbose
|
||||||
|
|
||||||
|
# Or run all tests in the repo
|
||||||
|
./scripts/terraform_test_all.sh
|
||||||
|
|
||||||
# Format code
|
# Format code
|
||||||
bun fmt
|
bun run fmt
|
||||||
|
|
||||||
# Commit and create PR
|
# Commit and create PR (do not push to main directly)
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Add [module-name] module"
|
git commit -m "Add [module-name] module"
|
||||||
git push origin your-branch
|
git push origin your-branch
|
||||||
@@ -335,11 +339,12 @@ coder templates push test-[template-name] -d .
|
|||||||
### 2. Test Your Changes
|
### 2. Test Your Changes
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Test a specific module
|
# Test a specific module (from the module directory)
|
||||||
bun test -t 'module-name'
|
terraform init -upgrade
|
||||||
|
terraform test -verbose
|
||||||
|
|
||||||
# Test all modules
|
# Test all modules
|
||||||
bun test
|
./scripts/terraform_test_all.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Maintain Backward Compatibility
|
### 3. Maintain Backward Compatibility
|
||||||
@@ -388,7 +393,7 @@ Example: `https://github.com/coder/registry/compare/main...your-branch?template=
|
|||||||
### Every Module Must Have
|
### Every Module Must Have
|
||||||
|
|
||||||
- `main.tf` - Terraform code
|
- `main.tf` - Terraform code
|
||||||
- `main.test.ts` - Working tests
|
- One or more `.tftest.hcl` files - Working tests with `terraform test`
|
||||||
- `README.md` - Documentation with frontmatter
|
- `README.md` - Documentation with frontmatter
|
||||||
|
|
||||||
### Every Template Must Have
|
### Every Template Must Have
|
||||||
@@ -488,6 +493,6 @@ When reporting bugs, include:
|
|||||||
2. **No tests** or broken tests
|
2. **No tests** or broken tests
|
||||||
3. **Hardcoded values** instead of variables
|
3. **Hardcoded values** instead of variables
|
||||||
4. **Breaking changes** without defaults
|
4. **Breaking changes** without defaults
|
||||||
5. **Not running** `bun fmt` before submitting
|
5. **Not running** formatting (`bun run fmt`) and tests (`terraform test`) before submitting
|
||||||
|
|
||||||
Happy contributing! 🚀
|
Happy contributing! 🚀
|
||||||
|
|||||||
+2
-2
@@ -18,9 +18,9 @@ sudo apt install golang-go
|
|||||||
|
|
||||||
Check that PRs have:
|
Check that PRs have:
|
||||||
|
|
||||||
- [ ] All required files (`main.tf`, `main.test.ts`, `README.md`)
|
- [ ] All required files (`main.tf`, `README.md`, at least one `.tftest.hcl`)
|
||||||
- [ ] Proper frontmatter in README
|
- [ ] Proper frontmatter in README
|
||||||
- [ ] Working tests (`bun test`)
|
- [ ] Working tests (`terraform test`)
|
||||||
- [ ] Formatted code (`bun run fmt`)
|
- [ ] Formatted code (`bun run fmt`)
|
||||||
- [ ] Avatar image for new namespaces (`avatar.png` or `avatar.svg` in `.images/`)
|
- [ ] Avatar image for new namespaces (`avatar.png` or `avatar.svg` in `.images/`)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
run "plan_with_required_vars" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "example-agent-id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run "app_url_uses_port" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "example-agent-id"
|
||||||
|
port = 19999
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {
|
||||||
|
condition = resource.coder_app.MODULE_NAME.url == "http://localhost:19999"
|
||||||
|
error_message = "Expected MODULE_NAME app URL to include configured port"
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
"fmt": "bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt -recursive -diff",
|
"fmt": "bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt -recursive -diff",
|
||||||
"fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check -recursive -diff",
|
"fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check -recursive -diff",
|
||||||
"terraform-validate": "./scripts/terraform_validate.sh",
|
"terraform-validate": "./scripts/terraform_validate.sh",
|
||||||
"test": "bun test",
|
"test": "./scripts/terraform_test_all.sh",
|
||||||
"update-version": "./update-version.sh"
|
"update-version": "./update-version.sh"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user