Azure GitHub Repository

Source code & Installation

The source code of this kit module can be found hereopen in new window

Run the following command to install the kit module:

collie kit import azure/buildingblocks/github-repo
1

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

NameVersion
azurerm~> 3.81.0
github5.34.0

Modules

No modules.

Resources

NameType
github_repository.repositoryopen in new windowresource
azurerm_key_vault.cloudfoundation_keyvaultopen in new windowdata source
azurerm_key_vault_secret.github_tokenopen in new windowdata source

Inputs

NameDescriptionTypeDefaultRequired
create_newFlag to indicate whether to create a new repositorybooln/ayes
descriptionDescription of the GitHub repositorystring"created by github-repo-building-block"no
github_app_idID of the GitHub Appstringn/ayes
github_app_installation_idInstallation ID of the GitHub Appstringn/ayes
github_orgName of the GitHub organizationstringn/ayes
github_token_secret_nameName of the secret in Key Vault that holds the GitHub tokenstringn/ayes
key_vault_nameName of the Key Vaultstringn/ayes
key_vault_rgName of the Resource Group where the Key Vault is locatedstringn/ayes
repo_nameName of the GitHub repositorystring"github-repo"no
template_ownerOwner of the template repositorystring"template-owner"no
template_repoName of the template repositorystring"github-repo"no
use_templateFlag to indicate whether to create a repo based on a Template Repositoryboolfalseno
visibilityVisibility of the GitHub repositorystring"private"no

Outputs

NameDescription
repo_full_namen/a
repo_git_clone_urln/a
repo_html_urln/a
repo_namen/a