|
1 | 1 | # GitHub Organization as Code |
2 | 2 |
|
3 | | -Streamline GitHub organization repository management with YAML configuration, GitHub workflows, AWS S3 storage, and GitHub App installation—powered by Terraform under the hood. |
| 3 | +Manage your GitHub organization repositories with GitOps principles using YAML configuration, GitHub Actions, AWS S3 storage, and GitHub App integration—powered by Terraform. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -Automate GitHub organization repository creation with YAML configuration, powered by Terraform, stored at AWS S3 storage, and configured using GitHub App integration. |
| 7 | +- **Automated Repository Management** - Define repositories, and repository properties using simple YAML file. |
| 8 | +- **GitOps Workflow** - Manage configurations via pull requests and automate updates using GitHub Actions. |
| 9 | +- **Terraform** - Uses Terraform under the hood to apply changes efficiently. |
| 10 | +- **Terraform State Management** - Stores Terraform state securely in AWS S3. |
| 11 | +- **GitHub App Integration** - Uses a GitHub App for authentication and API interactions. |
8 | 12 |
|
9 | 13 | ### Fun Fact |
10 | 14 |
|
11 | | -This GitHub repository was automatically created using the code in this repository. |
| 15 | +This repository was automatically created and is continuously managed using the very code inside it! |
12 | 16 |
|
13 | 17 | ## Installation and Configuration |
14 | 18 |
|
15 | | -Prepare a bucket at AWS S3 or compatible storage. |
| 19 | +Set up an AWS S3 bucket or a compatible storage service. |
16 | 20 |
|
17 | 21 | Create a GitHub App: |
18 | 22 |
|
@@ -40,10 +44,32 @@ Install the GitHub App: |
40 | 44 | - for these repositories: All repositories |
41 | 45 | - **Install** |
42 | 46 |
|
43 | | -Use the GitHub App: |
| 47 | +Get the GitHub App credentials: |
44 | 48 |
|
45 | 49 | - GitHub / *Organization* / Settings / Developer Settings / GitHub Apps / *Your GitHub App name* / General / Private keys / **Generate a private key** |
46 | 50 |
|
| 51 | +Set up GitHub actions, variables and secrets: |
| 52 | + |
| 53 | +- GitHub / *Repository* / Settings |
| 54 | + - Actions / General |
| 55 | + - Workflow permissions: Read and write permissions |
| 56 | + - Secrets and variables / Actions / Actions secrets and variables |
| 57 | + - Secrets |
| 58 | + - **New repository secret** |
| 59 | + - `APP_PEM_FILE` (`GITHUB_APP_PEM_FILE` contents) |
| 60 | + - `AWS_ACCESS_KEY_ID` |
| 61 | + - `AWS_SECRET_ACCESS_KEY` |
| 62 | + - Variables |
| 63 | + - **New repository variable** |
| 64 | + - `APP_ID` (`GITHUB_APP_ID`) |
| 65 | + - `APP_INSTALLATION_ID` (`GITHUB_APP_INSTALLATION_ID`) |
| 66 | + - `AWS_ENDPOINT_URL_S3` |
| 67 | + - `AWS_REGION` |
| 68 | + - `OWNER` (`GITHUB_OWNER`) |
| 69 | + |
| 70 | +> [!caution] |
| 71 | +> The GitHub App PEM file, S3 API credentials, Terraform state, GitHub repository secrets, and configuration code are key security elements. |
| 72 | +
|
47 | 73 | ## Usage |
48 | 74 |
|
49 | 75 | Edit the GitHub organization YAML configuration [`gh-org.yaml`](gh-org.yaml): |
@@ -88,9 +114,6 @@ terraform plan |
88 | 114 | terraform apply |
89 | 115 | ``` |
90 | 116 |
|
91 | | -> [!caution] |
92 | | -> The GitHub App PEM file, S3 API credentials, configuration code, and Terraform state are key security elements. |
93 | | - |
94 | 117 | ## Credits and Acknowledgments |
95 | 118 |
|
96 | 119 | - Martin Bružina - Author |
|
0 commit comments