From 5ff2a38b7a8a20c8aa906b509da83802eb98bf3b Mon Sep 17 00:00:00 2001 From: "coder[bot]" <137810501+coder[bot]@users.noreply.github.com> Date: Fri, 9 Oct 2026 12:05:18 +0000 Subject: [PATCH 1/3] docs(git-clone): add example for cloning multiple repositories --- registry/coder/modules/git-clone/README.md | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index 7fa594874..6d43af63e 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -35,6 +35,29 @@ module "git-clone" { } ``` +### Clone multiple repositories + +The `url` variable accepts a single repository. To clone several, use `for_each` on the module. Terraform doesn't allow `count` and `for_each` on the same block, so move the `start_count` check into the `for_each` expression: + +```tf +locals { + repos = { + coder = "https://github.com/coder/coder" + registry = "https://github.com/coder/registry" + } +} + +module "git-clone" { + for_each = data.coder_workspace.me.start_count > 0 ? local.repos : {} + source = "registry.coder.com/coder/git-clone/coder" + version = "2.0.5" + agent_id = coder_agent.example.id + url = each.value +} +``` + +Each instance clones into its own folder, named after the repository by default, with separate scripts and logs. If two repositories share a name (for example `org-a/api` and `org-b/api`), set `folder_name = each.key` so they don't collide. Outputs are available per repository, for example `module.git-clone["coder"].folder_name`. + ### Git Authentication To use with [Git Authentication](https://coder.com/docs/v2/latest/admin/git-providers), add the provider by ID to your template: From 2b43dec8b1d5dfcceef264a07ea27b6c9a85e002 Mon Sep 17 00:00:00 2001 From: "coder[bot]" <137810501+coder[bot]@users.noreply.github.com> Date: Fri, 9 Oct 2026 13:04:53 +0000 Subject: [PATCH 2/3] chore: bump module versions (patch) --- registry/coder/modules/git-clone/README.md | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index 6d43af63e..dc817c70e 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -14,7 +14,7 @@ This module allows you to automatically clone a repository by URL and skip if it module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } @@ -28,7 +28,7 @@ module "git-clone" { module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" base_dir = "~/projects/coder" @@ -50,7 +50,7 @@ locals { module "git-clone" { for_each = data.coder_workspace.me.start_count > 0 ? local.repos : {} source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = each.value } @@ -66,7 +66,7 @@ To use with [Git Authentication](https://coder.com/docs/v2/latest/admin/git-prov module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } @@ -93,7 +93,7 @@ data "coder_parameter" "git_repo" { module "git_clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = data.coder_parameter.git_repo.value } @@ -128,7 +128,7 @@ Configuring `git-clone` for a self-hosted GitHub Enterprise Server running at `g module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.example.com/coder/coder/tree/feat/example" git_providers = { @@ -148,7 +148,7 @@ To GitLab clone with a specific branch like `feat/example` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://gitlab.com/coder/coder/-/tree/feat/example" } @@ -160,7 +160,7 @@ Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://gitlab.example.com/coder/coder/-/tree/feat/example" git_providers = { @@ -182,7 +182,7 @@ For example, to clone the `feat/example` branch: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" branch_name = "feat/example" @@ -200,7 +200,7 @@ For example, this will clone into the `~/projects/coder/coder-dev` folder: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" folder_name = "coder-dev" @@ -225,7 +225,7 @@ fetches, or partial clones. module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" extra_args = [ @@ -246,7 +246,7 @@ This is useful for preparing the environment or validating prerequisites before module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" pre_clone_script = <<-EOT @@ -269,7 +269,7 @@ This is useful for running initialization tasks like installing dependencies or module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.5" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" post_clone_script = <<-EOT From b2e2a10386e53e138831a3ea890330336c549148 Mon Sep 17 00:00:00 2001 From: "coder[bot]" <137810501+coder[bot]@users.noreply.github.com> Date: Fri, 9 Oct 2026 13:12:04 +0000 Subject: [PATCH 3/3] chore(git-clone): format README after version bump --- registry/coder/modules/git-clone/README.md | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index dc817c70e..9f64be57c 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -14,7 +14,7 @@ This module allows you to automatically clone a repository by URL and skip if it module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } @@ -28,7 +28,7 @@ module "git-clone" { module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" base_dir = "~/projects/coder" @@ -50,7 +50,7 @@ locals { module "git-clone" { for_each = data.coder_workspace.me.start_count > 0 ? local.repos : {} source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = each.value } @@ -66,7 +66,7 @@ To use with [Git Authentication](https://coder.com/docs/v2/latest/admin/git-prov module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } @@ -93,7 +93,7 @@ data "coder_parameter" "git_repo" { module "git_clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = data.coder_parameter.git_repo.value } @@ -128,7 +128,7 @@ Configuring `git-clone` for a self-hosted GitHub Enterprise Server running at `g module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.example.com/coder/coder/tree/feat/example" git_providers = { @@ -148,7 +148,7 @@ To GitLab clone with a specific branch like `feat/example` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://gitlab.com/coder/coder/-/tree/feat/example" } @@ -160,7 +160,7 @@ Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://gitlab.example.com/coder/coder/-/tree/feat/example" git_providers = { @@ -182,7 +182,7 @@ For example, to clone the `feat/example` branch: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" branch_name = "feat/example" @@ -200,7 +200,7 @@ For example, this will clone into the `~/projects/coder/coder-dev` folder: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" folder_name = "coder-dev" @@ -225,7 +225,7 @@ fetches, or partial clones. module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" extra_args = [ @@ -246,7 +246,7 @@ This is useful for preparing the environment or validating prerequisites before module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" pre_clone_script = <<-EOT @@ -269,7 +269,7 @@ This is useful for running initialization tasks like installing dependencies or module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "2.0.6" + version = "2.0.6" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" post_clone_script = <<-EOT