Azure GitHub Repository
Source code & Installation
The source code of this kit module can be found here
Run the following command to install the kit module:
collie kit import azure/buildingblocks/github-repo
This documentation is intended as a reference for cloud foundation or platform engineers using this module.
Permissions
This building block requires a service principal with permissions to manage GitHub repositories. The service principal should have a GitHub App installed with the necessary permissions to create repositories.
The private key of the GitHub App should be stored in Azure Key Vault and the service principal should have permissions to read this secret.
The service principal also needs permissions to assign the "Key Vault Reader" role to itself for the Key Vault where the GitHub App's private key is stored.
Usage
This building block creates a GitHub repository with the specified name, description, and visibility. It also supports creating a repository based on a template repository.
You can specify the name of the GitHub organization, the name of the repository, whether to create a new repository or use a template, the owner and name of the template repository, and the visibility of the repository.
The GitHub token is retrieved from Azure Key Vault and used to authenticate with the GitHub API.
The building block outputs the name, description, and visibility of the created repository.
Requirements
Name | Version |
---|---|
azurerm | ~> 3.81.0 |
github | 5.34.0 |
Modules
No modules.
Resources
Name | Type |
---|---|
github_repository.repository | resource |
azurerm_key_vault.cloudfoundation_keyvault | data source |
azurerm_key_vault_secret.github_token | data source |
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
create_new | Flag to indicate whether to create a new repository | bool | n/a | yes |
description | Description of the GitHub repository | string | "created by github-repo-building-block" | no |
github_app_id | ID of the GitHub App | string | n/a | yes |
github_app_installation_id | Installation ID of the GitHub App | string | n/a | yes |
github_org | Name of the GitHub organization | string | n/a | yes |
github_token_secret_name | Name of the secret in Key Vault that holds the GitHub token | string | n/a | yes |
key_vault_name | Name of the Key Vault | string | n/a | yes |
key_vault_rg | Name of the Resource Group where the Key Vault is located | string | n/a | yes |
repo_name | Name of the GitHub repository | string | "github-repo" | no |
template_owner | Owner of the template repository | string | "template-owner" | no |
template_repo | Name of the template repository | string | "github-repo" | no |
use_template | Flag to indicate whether to create a repo based on a Template Repository | bool | false | no |
visibility | Visibility of the GitHub repository | string | "private" | no |
Outputs
Name | Description |
---|---|
repo_full_name | n/a |
repo_git_clone_url | n/a |
repo_html_url | n/a |
repo_name | n/a |