Meet OPSd. The unique and effortless way of managing cloud infrastructure.
Visit our website www.opsd.io for more details.
A terraform module responsible for creating GitHub repositories from the templates.
data "github_team" "terraformers" {
slug = "terraformers"
}
module "terraform-github" {
source = "../../terraform-module-github-repository"
# Assign maintainers github team to the repo
maintainers_team_id = data.github_team.terraformers.id
# Setup basic repository settings
repository_name = "test-repo"
repository_description = "Created by terraform."
}
IMPORTANT: Make sure not to pin to master because there may be breaking changes between releases.
You can find more example here.
Before you start, you need to create a GitHub token or use an existing one.
Next, set the environment variable.
export GITHUB_TOKEN="ghp_your_github_token"
Now, you need to initialize terraform.
terraform init
Execute plan command.
terraform plan
and verify what will be created.
The last step is to create the repo
terrafrorm apply
IMPORTANT: Please double-check the command output. The vital section can be seen in the example Plan: 6 to add, 0 to change, 0 to destroy
. Ensure that you understand the changes you are making.
Next, you will be asked
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value:
Type yes
to approve and let the magic happen.
No related modules.
Name | Version |
---|---|
terraform | >= 1.5.7 |
github | 6.2.0 |
Name | Version |
---|---|
github | 6.2.0 |
No modules.
Name | Type |
---|---|
github_branch_protection_v3.main | resource |
github_issue_label.breaking | resource |
github_issue_label.chore | resource |
github_issue_label.skip_changelog | resource |
github_repository.main | resource |
github_repository_collaborator.admins | resource |
github_repository_collaborator.maintainers | resource |
github_repository_tag_protection.main | resource |
github_team_repository.admins | resource |
github_team_repository.maintainers | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
admin_teams | A set of the repository admin teams IDs. | set(string) |
[] |
no |
admins | A set of users with an admin privileges. | set(string) |
[] |
no |
maintainer_teams | A set of the repository admin teams IDs. | set(string) |
[] |
no |
maintainers | A set of users with maintain privileges. | set(string) |
[] |
no |
repository_default_branch | The default branch name. | string |
"main" |
no |
repository_delete_branch_on_merge | Automatically delete head branch after a pull request is merged. | bool |
true |
no |
repository_description | Brief description of the project. | string |
n/a | yes |
repository_has_issues | Enable the GitHub Issues on the repository. | bool |
true |
no |
repository_has_projects | Enable the GitHub Project on the repository. | bool |
false |
no |
repository_has_wiki | Enable the GitHub Wiki on the repository. | bool |
false |
no |
repository_name | The name of the repository. | string |
n/a | yes |
repository_require_code_owner_reviews | Require code owners review before PR can be merged. | bool |
true |
no |
repository_require_conversation_resolution | Resolve all the comments before PR can be merged. | bool |
true |
no |
repository_required_approving_review_count | Require N aprovales before PR can be merged. | number |
1 |
no |
repository_tag_protection_pattern | The pattern of the tag to protect. | string |
"v*" |
no |
repository_template_owner | The GitHub organization or user the template repository is owned by. | string |
"opsd-io" |
no |
repository_template_repository | Name of the (template) repository from which to create the new repository. | string |
"terraform-module-template" |
no |
repository_topics | The list of topics of the repository. | list(string) |
null |
no |
repository_visibility | Specify whether the created repository should be private or public. Available options private or public . |
string |
"public" |
no |
No outputs.
If you are interested in contributing to the project, see see our guide.
If you have a problem with the module or want to propose a new feature, you can report it via the project's (Github) issue tracker.
If you want to discuss something in person, you can join our community on Slack.