-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement GitHub deploy keys generation and add output for gene…
…rated keys
- Loading branch information
Dave Arnold
committed
Apr 1, 2025
1 parent
5e34ff0
commit 1a4ac48
Showing
3 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,27 @@ | ||
| // This file implements GitHub Deploy Keys functionality for the repository | ||
| // Generate SSH keys when create is true | ||
| resource "tls_private_key" "deploy_key" { | ||
| for_each = { | ||
| for k, v in var.deploy_keys : k => v | ||
| if v.create == true | ||
| } | ||
|
|
||
| algorithm = "RSA" | ||
| rsa_bits = 4096 | ||
| } | ||
|
|
||
| // Create GitHub deploy keys for all entries | ||
| resource "github_repository_deploy_key" "deploy_key" { | ||
| for_each = { for k, v in var.deploy_keys : k => v } | ||
| for_each = { | ||
| for k, v in var.deploy_keys : k => v | ||
| } | ||
|
|
||
| title = each.value.title | ||
| repository = local.github_repo.name | ||
| key = each.value.key | ||
| key = each.value.create ? tls_private_key.deploy_key[each.key].public_key_openssh : each.value.key | ||
| read_only = each.value.read_only | ||
|
|
||
| depends_on = [ | ||
| github_repository.repo | ||
| github_repository.repo, | ||
| data.github_repository.existing | ||
| ] | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters