A Terraform module to create multiple GitHub repositories based on combinations of resources, environments, and regions. This naming convention follows the recommended approach detailed in the HCP Terraform documentation (with an optional prefix for flexibility). This module creates a total number of resources * environments * regions
repositories.
Name | Version |
---|---|
terraform | >= 1.0 |
github | = 6.6.0 |
Name | Version |
---|---|
github | 6.6.0 |
module "matrix" {
source = "github.com/mncherian/terraform-github-matrix"
github_owner = "your-github-org"
prefix = "org-"
resources = ["networking", "monitoring"]
environments = ["staging", "prod"]
regions = ["us-east", "eu-central"]
# template = {
# owner = "your-github-org"
# repository = "your-template-repo"
# }
}
The following repositories would be created based of the example shown above:
org-networking-staging-us-east
org-networking-staging-eu-central
org-networking-prod-us-east
org-networking-prod-eu-central
org-monitoring-staging-us-east
...
Name | Description | Type | Default | Required |
---|---|---|---|---|
github_owner | GitHub organization or user name. | string |
n/a |
Yes |
prefix | Prefix to prepend to each repository name. | string |
"" |
No |
resources | List of resources. | list(string) |
["networking", "monitoring"] |
No |
environments | List of environments. | list(string) |
["staging", "prod"] |
No |
regions | List of regions. | list(string) |
[] |
No |
template | Optional object specifying a GitHub template repository to use for all created repositories. | object({ owner = string, repository = string }) |
null |
No |
Name | Description |
---|---|
repository_names | List of created GitHub repository names. |
This module is licensed under the Apache License 2.0.