You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-6Lines changed: 71 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# GitHub Organization as Code
2
2
3
-
Manage your GitHub organization repositories with GitOps principles using YAML configuration, GitHub Actions, AWS S3 storage, and GitHub App integration—powered by Terraform.
3
+
Manage your GitHub organization's repositories using GitOps principles with a YAML-based configuration, GitHub Actions with reusable workflows, AWS S3 for storage, and GitHub App integration.
4
4
5
5
## Features
6
6
@@ -16,8 +16,31 @@ This repository was automatically created and is continuously managed using the
16
16
17
17
## Installation and Configuration
18
18
19
+
- Configure an AWS S3 bucket to store Terraform state files.
20
+
- Set up a GitHub App and its installation to handle authentication and authorization for your GitHub Organization.
21
+
- Implement GitOps by setting up a GitHub repository with:
22
+
- YAML-based configuration
23
+
- GitHub workflows
24
+
- Repository variables and secrets
25
+
26
+
> [!caution]
27
+
> The GitHub App PEM file, S3 API credentials, Terraform state, GitHub repository secrets, and configuration code are key security elements.
28
+
29
+
### Set Up AWS S3 Bucket
30
+
19
31
Set up an AWS S3 bucket or a compatible storage service.
Create GitHub workflow planning and applying configuration changes to the GitHub Organization:
100
+
101
+
```yaml
102
+
#TODO
103
+
```
104
+
51
105
Set up GitHub actions, variables and secrets:
52
106
53
107
- GitHub / *Repository* / Settings
@@ -67,12 +121,14 @@ Set up GitHub actions, variables and secrets:
67
121
-`AWS_REGION`
68
122
-`OWNER` (`GITHUB_OWNER`)
69
123
70
-
> [!caution]
71
-
> The GitHub App PEM file, S3 API credentials, Terraform state, GitHub repository secrets, and configuration code are key security elements.
72
-
73
124
## Usage
74
125
75
-
Edit the GitHub organization YAML configuration [`gh-org.yaml`](gh-org.yaml):
126
+
The GitHub organization YAML configuration post a Terraform plan as a pull request comment whenever a pull request to the main branch is created or whenever a new commit to the pull request is pushed. Once the pull request is merged into `main`, the plan is applied automatically.
127
+
128
+
> [!note]
129
+
> The state is stored as JSON object `github/<github owner>/terraform.tfstate` in the bucket.
130
+
131
+
### GitHub Organization YAML
76
132
77
133
```yaml
78
134
---
@@ -96,7 +152,7 @@ repositories:
96
152
97
153
Defaults are the same as in the Terraform provider `github` resource `github_repository`, see [Terraform Registry / Providers / integrations / github / resources / github_repository](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository#argument-reference).
98
154
99
-
Modify the Terraform backend configuration in [`config.tf`](config.tf) as needed.
This repository is tested using [`test.yaml`](test.yaml) as the configuration file for the [Xebis Test GitHub Organization](https://github.com/xebis-test) settings and repositories.
181
+
182
+
The workflow is designed to post a Terraform plan as a pull request comment whenever a pull request to the main branch is created or whenever a new commit to the pull request is pushed. Once the pull request is merged into `main`, the plan is applied automatically.
0 commit comments