Skip to content

Commit 778ab42

Browse files
cunlatim-schilling
andauthored
doc:Update how to generate token for GHA. (#34)
Fix #22 --------- Co-authored-by: Tim Schilling <[email protected]>
1 parent 5fc6bb8 commit 778ab42

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

terraform/README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,24 @@ To do so, you can use the following steps:
7979
6. To apply the changes,
8080
run: `terraform apply -var-file=production/org.tfvars -var-file=production/repositories.tfvars -var github_token=...`
8181
82-
[1]: https://developer.hashicorp.com/terraform/tutorials/it-saas/github-user-teams#configure-your-credentials
82+
# Integration with GitHub Actions
83+
84+
The repository is configured to run `terraform plan` on every new pull-request as well as an update to a pull-request
85+
and list the expected changes as a comment on the pull-request.
86+
Once the pull-request is merged to the `main` branch, `terraform apply` applies the changes to the GitHub organization, and
87+
the updated current state is committed to the `main` branch.
88+
To achieve this, the workflows use `TERRAFORM_MANAGEMENT_GITHUB_TOKEN` secret to plan/apply terraform changes.
89+
90+
`TERRAFORM_MANAGEMENT_GITHUB_TOKEN` is a fine-grained personal access token with permissions the following permissions
91+
required (see documentation [here][2]):
92+
93+
- The `repo` permission for full control of private repositories
94+
- The `admin:org` permission for full control of orgs and teams, read and write org projects
95+
- The `delete_repo` permission to delete repositories
96+
- Additionally, the token should have permissions to write content to the repository (see, [here][3])
97+
98+
[1]: https://developer.hashicorp.com/terraform/tutorials/it-saas/github-user-teams#configure-your-credentials
99+
100+
[2]: https://developer.hashicorp.com/terraform/tutorials/it-saas/github-user-teams#configure-your-credentials
101+
102+
[3]: https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository

0 commit comments

Comments
 (0)