{"id":15654195,"url":"https://github.com/ksatirli/terraform-github-repository","last_synced_at":"2025-08-21T23:17:44.718Z","repository":{"id":45255419,"uuid":"102853135","full_name":"ksatirli/terraform-github-repository","owner":"ksatirli","description":":octocat: Terraform Module: Github Repositories and associated Resources","archived":false,"fork":false,"pushed_at":"2025-03-03T12:34:42.000Z","size":118,"stargazers_count":28,"open_issues_count":1,"forks_count":26,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-07T17:53:21.649Z","etag":null,"topics":["github","github-api","terraform","terraform-modules"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/ksatirli/repository","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksatirli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-08T11:12:27.000Z","updated_at":"2025-03-03T12:44:43.000Z","dependencies_parsed_at":"2024-10-23T03:47:49.755Z","dependency_job_id":null,"html_url":"https://github.com/ksatirli/terraform-github-repository","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ksatirli/terraform-github-repository","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksatirli%2Fterraform-github-repository","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksatirli%2Fterraform-github-repository/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksatirli%2Fterraform-github-repository/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksatirli%2Fterraform-github-repository/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksatirli","download_url":"https://codeload.github.com/ksatirli/terraform-github-repository/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksatirli%2Fterraform-github-repository/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264375618,"owners_count":23598415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","github-api","terraform","terraform-modules"],"created_at":"2024-10-03T12:49:56.032Z","updated_at":"2025-07-09T01:33:46.646Z","avatar_url":"https://github.com/ksatirli.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Repository\n\n\u003e This Terraform Module manages the lifecycle of GitHub Repositories and associated resources.\n\n## Table of Contents\n\n\u003c!-- TOC --\u003e\n* [GitHub Repository](#github-repository)\n  * [Table of Contents](#table-of-contents)\n  * [Requirements](#requirements)\n  * [Dependencies](#dependencies)\n  * [Usage](#usage)\n    * [Inputs](#inputs)\n    * [Outputs](#outputs)\n  * [Notes](#notes)\n    * [Upgrading from `4.x.x` to `5.x.x`](#upgrading-from-4xx-to-5xx)\n    * [Upgrading from `3.x.x` to `4.x.x`](#upgrading-from-3xx-to-4xx)\n    * [Upgrading from `2.x.x` to `3.x.x`](#upgrading-from-2xx-to-3xx)\n  * [Author Information](#author-information)\n  * [License](#license)\n\u003c!-- TOC --\u003e\n\n## Requirements\n\n* GitHub [Account](https://github.com/join)\n* Terraform `1.3.x` or newer.\n\n## Dependencies\n\nThis module depends on a correctly configured [GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) in your Terraform codebase.\n\n## Usage\n\nAdd the module to your Terraform resources like so:\n\n```hcl\nmodule \"simple_example\" {\n  source  = \"ksatirli/repository/github\"\n  version = \"5.0.0\"\n\n  name       = \"simple-example\"\n  visibility = false\n}\n```\n\nThen, fetch the module from the [Terraform Registry](https://registry.terraform.io/modules/ksatirli/repository/github) using `terraform get`.\n\nAdditional usage examples are available in the `examples` directory via [GitHub](https://github.com/ksatirli/terraform-github-repository/tree/main/examples).\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n### Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| name | Name of the Repository. | `string` | n/a | yes |\n| allow_auto_merge | Toggle to enable auto-merging pull requests on the repository. | `bool` | `false` | no |\n| allow_merge_commit | Toggle to enable Merge Commits for the Repository. | `bool` | `true` | no |\n| allow_rebase_merge | Toggle to enable Rebase Merges for the Repository. | `bool` | `true` | no |\n| allow_squash_merge | Toggle to enable Squash Merges for the Repository. | `bool` | `true` | no |\n| archive_on_destroy | Toggle to archive the Repository on destroy. | `bool` | `false` | no |\n| archived | Toggle to archive the Repository (see notes in `README.md`). | `bool` | `false` | no |\n| auto_init | Toggle to create an initial commit in the Repository. | `bool` | `false` | no |\n| branch_protections | List of Branch Protection Objects. | \u003cpre\u003elist(object({\u003cbr\u003e    branch                 = string,\u003cbr\u003e    enforce_admins         = bool,\u003cbr\u003e    require_signed_commits = bool,\u003cbr\u003e    required_status_checks = object({\u003cbr\u003e      strict   = bool\u003cbr\u003e      contexts = list(string)\u003cbr\u003e    })\u003cbr\u003e\u003cbr\u003e    required_pull_request_reviews = object({\u003cbr\u003e      dismiss_stale_reviews           = bool,\u003cbr\u003e      dismissal_users                 = list(string),\u003cbr\u003e      dismissal_teams                 = list(string),\u003cbr\u003e      require_code_owner_reviews      = bool,\u003cbr\u003e      required_approving_review_count = number\u003cbr\u003e    })\u003cbr\u003e\u003cbr\u003e    restrictions = object({\u003cbr\u003e      users = list(string),\u003cbr\u003e      teams = list(string)\u003cbr\u003e    })\u003cbr\u003e  }))\u003c/pre\u003e | `null` | no |\n| default_branch | Name of the Default Branch of the Repository. | `string` | `\"main\"` | no |\n| delete_branch_on_merge | Toggle to automatically delete merged Branches for the Repository. | `bool` | `false` | no |\n| deploy_keys | List of Deploy Key Objects | \u003cpre\u003elist(object({\u003cbr\u003e    title     = string,\u003cbr\u003e    key       = string,\u003cbr\u003e    read_only = bool\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| description | Description of the Repository. | `string` | `null` | no |\n| files | List of File Objects. | \u003cpre\u003elist(object({\u003cbr\u003e    file                = string,\u003cbr\u003e    content             = string,\u003cbr\u003e    overwrite_on_create = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| gitignore_template | Template to use for initial `.gitignore` file for the Repository. | `string` | `null` | no |\n| has_downloads | Toggle to enable (deprecated) GitHub Downloads for the Repository. | `bool` | `false` | no |\n| has_issues | Toggle to enable GitHub Issues for the Repository. | `bool` | `true` | no |\n| has_projects | Toggle to enable GitHub Projects for the Repository. | `bool` | `false` | no |\n| has_wiki | Toggle to enable GitHub Wiki for the Repository. | `bool` | `false` | no |\n| homepage_url | URL of a page describing the Repository. | `string` | `null` | no |\n| is_template | Toggle to enable Template use for the Repository. | `bool` | `false` | no |\n| issue_labels | List of Issue Label Objects. | \u003cpre\u003elist(object({\u003cbr\u003e    name  = string,\u003cbr\u003e    color = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| license_template | Identifier to use for initial `LICENSE` file for the Repository. | `string` | `null` | no |\n| pages | Configuration block for GitHub Pages. | `map(any)` | `{}` | no |\n| pages_branch | Name of the GitHub Pages Branch of the Repository. | `string` | `\"gh-pages\"` | no |\n| repository_collaborators | List of Collaborator Objects. | \u003cpre\u003elist(object({\u003cbr\u003e    username = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| repository_webhooks | A list of events which should trigger the webhook. | \u003cpre\u003elist(object({\u003cbr\u003e    active = bool\u003cbr\u003e    events = list(string)\u003cbr\u003e\u003cbr\u003e    configuration = object({\u003cbr\u003e      url          = string\u003cbr\u003e      content_type = string\u003cbr\u003e      secret       = string\u003cbr\u003e      insecure_ssl = bool\u003cbr\u003e    })\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| team_repository_teams | List of Team Repository Team Objects. | \u003cpre\u003elist(object({\u003cbr\u003e    team_id    = string\u003cbr\u003e    permission = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| template | Template Repository to use when creating the Repository. | `map(string)` | `{}` | no |\n| topics | List of Topics of the Repository. | `list(string)` | `null` | no |\n| visibility | Toggle to set the visibility of the Repository. | `string` | `\"private\"` | no |\n| vulnerability_alerts | Toggle to enable Vulnerability Alerts for the Repository. | `bool` | `true` | no |\n| web_commit_signoff_required | Toggle to require contributors to sign off on web-based commits. | `bool` | `false` | no |\n\n### Outputs\n\n| Name | Description |\n|------|-------------|\n| github_issue_label | Exported Attributes for `github_issue_label`. |\n| github_repository | Exported Attributes for `github_repository`. |\n| github_repository_collaborator | Exported Attributes for `github_repository_collaborator`. |\n| github_repository_deploy_key | Exported Attributes for `github_repository_deploy_key`. |\n| github_repository_file | Exported Attributes for `github_repository_file`. |\n| github_repository_webhook | Exported Attributes for `github_repository_webhook`. |\n| github_team_repository | Exported Attributes for `github_team_repository`. |\n\u003c!-- END_TF_DOCS --\u003e\n\n## Notes\n\n### Upgrading from `4.x.x` to `5.x.x`\n\nAs part of the updates and upgrades that were made for the `5.x.x` release, the following changes were made:\n\n#### Managing default branch through `github_branch_default` instead of `github_repository`\n\nFrom `5.0.0` onwards, the default branch for a repository is now managed through the [`github_branch_default`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_default) resource, instead of the `default_branch` attribute on the [`github_repository`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository) resource.\n\n#### Removing `github_repository_project`\n\nFrom `5.0.0` onwards, the [`github_repository_project`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_project) was removed.\n\nTo account for this change, the `projects` variable was removed from the module.\n\n### Upgrading from `3.x.x` to `4.x.x`\n\nAs part of the updates and upgrades that were made for the `4.x.x` release, all Terraform resource identifiers were renamed from `this` to `main`.\nSee [`./moved.tf`](https://github.com/ksatirli/terraform-github-repository/blob/main/moved.tf) and the [Terraform documentation](https://developer.hashicorp.com/terraform/language/modules/develop/refactoring#moved-block-syntax) for more information.\n\n#### Branch for GitHub Pages\n\nPrior to `4.0.0`, the branch for the GitHub Pages feature was sourced from the `default_branch` variable.\n\nFrom `4.0.0` onwards, the branch for GitHub Pages can be set through the `pages_branch` variable. The default is `gh-pages`.\n\n### Upgrading from `2.x.x` to `3.x.x`\n\nThe `3.0.0` version of this module introduced support for the [github_branch_default](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_default) resource, a property that was initially handled through the `github_repository` resource.\n\nFor a better upgrade experience, it is advised to manually import this resource, using the [import](https://www.terraform.io/docs/cli/import/index.html) command:\n\n```sh\nterraform import module.my_repository.github_branch_default.this \"my_repository\"\n```\n\nReplace `module.my_repository` with the Module identifier in use and replace `\"my_repository\"` with the name of the repository the data is imported from.\n\n### For `github_repository` resources\n\n- Resources that are created with the `template` option enabled will be re-created (that is: _destroyed_, then created again) when the `template` stub is removed\n\n- Resources that are archived using the `archive` option cannot be unarchived, as the GitHub API does not currently support this\n\n- Starting with `3.0.0` of this Module, the default branch option is no longer set through the `github_repository` resource\n\n### For `github_repository_deploy_key` resources\n\n- Deploy Key resources expect a string for the `deploy_key.key` variable. Use the [file](https://www.terraform.io/docs/configuration/functions/file.html) function if key material is not available as a Terraform-variable already\n\n- For a step-by-step guide on how to generate SSH Keys, see [this article](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key) on GitHub\n\n### For `github_branch_protection` resources\n\n- Branch Protection resources that set the [required_approving_review_count](https://www.terraform.io/docs/providers/github/r/branch_protection.html#required_approving_review_count) variable must be in a range of `\u003e= 1` and `\u003c= 6`\n\n### For `github_repository_project` resources\n\n- Project resources require GitHub Projects to be enabled for the Organization as well as the `has_projects` variable set to `true`\n\n### For `github_repository_file` resources\n\n- File resources require an (already existing) `main` branch, or an explicitly defined branch for the `files.branch` variable to avoid errors\n\n- File resources expect a string for the `files.content` variable. Use the [file](https://www.terraform.io/docs/configuration/functions/file.html) function if file data is not available as a Terraform-variable already\n\n- File resources that are removed from Terraform will _also_ be removed from the Repository. This is visible in the Repository History\n\n## Author Information\n\nThis module is maintained by the contributors listed on [GitHub](https://github.com/ksatirli/terraform-github-repository/graphs/contributors).\n\n## License\n\nLicensed under the Apache License, Version 2.0 (the \"License\").\n\nYou may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an _\"AS IS\"_ basis, without WARRANTIES or conditions of any kind, either express or implied.\n\nSee the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksatirli%2Fterraform-github-repository","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksatirli%2Fterraform-github-repository","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksatirli%2Fterraform-github-repository/lists"}