Repository navigation
docs(git-clone): add example for cloning multiple repositories - #1172
Closed
blinkagent[bot] wants to merge 1 commit into
Closed
blinkagent[bot] wants to merge 1 commit into
blinkagent[bot] wants to merge 1 commit into
Conversation
Member
|
Closing in favour of #1171 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
git-clonetakes a singleurl, so cloning several repositories requiresfor_eachon the module block. That pattern was not documented, so this adds aClone multiple repositoriessection to the module README covering:for_eachform, with thestart_countcheck moved into thefor_eachexpression (Terraform does not allowcountandfor_eachon the same block)~/.coder-modules/coder/git-clone/<folder_name>for_each = module.git_cloneto create onecode-server/coder_appper repositoryfolder_nameis setbranch_name/folder_name/extra_argsDocumentation only, no module version bump.
Testing
Validated against the local module with Terraform 1.9.8, cloning
coder/coderandcoder/registryin one template:terraform applysucceeds withfor_each; each instance produces distinctrepo_dir,folder_name, andclone_urloutputscoder_scriptpayloads concurrently clones both repositories successfully, with separatescripts/andlogs/directories per instancealready exists and isn't empty, skipping clone!)folder_name = each.key,branch_name,extra_args = ["--depth=1"], and apost_clone_scriptworks; each instance writes its ownpost_clone.shandpost_clone.logfor_each = module.git_cloneon a downstream resource resolves correctly per keyprettier --checkpasses on the READMECreated on behalf of @matifali