-
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.
fix: simplify template repository lookup logic
- Loading branch information
Dave Arnold
committed
Apr 4, 2025
1 parent
5215a98
commit 792ad10
Showing
5 changed files
with
25 additions
and
30 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,15 +1,15 @@ | ||
| resource "github_actions_secret" "secret" { | ||
| for_each = tomap({ for secret in var.secrets : secret.name => secret.value }) | ||
| repository = local.github_repo.name | ||
| repository = var.create_repo ? github_repository.repo[0].name : data.github_repository.existing[0].name | ||
| secret_name = each.key | ||
| plaintext_value = each.value | ||
| depends_on = [local.github_repo] | ||
| depends_on = [github_repository.repo, data.github_repository.existing] | ||
| } | ||
|
|
||
| resource "github_actions_variable" "variable" { | ||
| for_each = tomap({ for _var in var.vars : _var.name => _var.value }) | ||
| repository = local.github_repo.name | ||
| repository = var.create_repo ? github_repository.repo[0].name : data.github_repository.existing[0].name | ||
| variable_name = each.key | ||
| value = each.value | ||
| depends_on = [local.github_repo] | ||
| depends_on = [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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,68 +1,59 @@ | ||
| output "github_repo" { | ||
| description = "All attributes of the GitHub repository" | ||
| value = local.github_repo | ||
| value = var.create_repo ? github_repository.repo[0] : data.github_repository.existing[0] | ||
| } | ||
|
|
||
| output "ssh_clone_url" { | ||
| description = "URL that can be provided to git clone to clone the repository via SSH" | ||
| value = local.github_repo.ssh_clone_url | ||
| value = var.create_repo ? github_repository.repo[0].ssh_clone_url : data.github_repository.existing[0].ssh_clone_url | ||
| } | ||
|
|
||
| output "node_id" { | ||
| description = "Node ID of the repository, used for GraphQL API access" | ||
| value = local.github_repo.node_id | ||
| value = var.create_repo ? github_repository.repo[0].node_id : data.github_repository.existing[0].node_id | ||
| } | ||
|
|
||
| output "full_name" { | ||
| description = "Full name of the repository in org/repo format" | ||
| value = local.github_repo.full_name | ||
| value = var.create_repo ? github_repository.repo[0].full_name : data.github_repository.existing[0].full_name | ||
| } | ||
|
|
||
| output "repo_id" { | ||
| description = "Repository ID" | ||
| value = local.github_repo.repo_id | ||
| value = var.create_repo ? github_repository.repo[0].repo_id : data.github_repository.existing[0].repo_id | ||
| } | ||
|
|
||
| output "html_url" { | ||
| description = "URL to the repository on GitHub" | ||
| value = local.github_repo.html_url | ||
| value = var.create_repo ? github_repository.repo[0].html_url : data.github_repository.existing[0].html_url | ||
| } | ||
|
|
||
| output "http_clone_url" { | ||
| description = "URL that can be provided to git clone to clone the repository via HTTPS" | ||
| value = local.github_repo.http_clone_url | ||
| value = var.create_repo ? github_repository.repo[0].http_clone_url : data.github_repository.existing[0].http_clone_url | ||
| } | ||
|
|
||
| output "git_clone_url" { | ||
| description = "URL that can be provided to git clone to clone the repository anonymously via the git protocol" | ||
| value = local.github_repo.git_clone_url | ||
| value = var.create_repo ? github_repository.repo[0].git_clone_url : data.github_repository.existing[0].git_clone_url | ||
| } | ||
|
|
||
| output "visibility" { | ||
| description = "Whether the repository is private or public" | ||
| value = local.github_repo.visibility | ||
| value = var.create_repo ? github_repository.repo[0].visibility : data.github_repository.existing[0].visibility | ||
| } | ||
|
|
||
| output "default_branch" { | ||
| description = "Default branch of the repository" | ||
| value = local.github_repo.default_branch | ||
| value = var.create_repo ? github_repository.repo[0].default_branch : data.github_repository.existing[0].default_branch | ||
| } | ||
|
|
||
| output "topics" { | ||
| description = "List of topics applied to the repository" | ||
| value = local.github_repo.topics | ||
| value = var.create_repo ? github_repository.repo[0].topics : data.github_repository.existing[0].topics | ||
| } | ||
|
|
||
| output "template" { | ||
| description = "Template repository this repository was created from" | ||
| value = local.github_repo.template | ||
| value = var.create_repo ? lookup(github_repository.repo[0], "template", null) : lookup(data.github_repository.existing[0], "template", null) | ||
| } | ||
|
|
||
|
|
||
| output "generated_deploy_keys" { | ||
| description = "Generated private keys for deploy keys with create=true" | ||
| value = { | ||
| for k, v in tls_private_key.deploy_key : k => v.private_key_pem | ||
| } | ||
| sensitive = true | ||
| } |