strip org name from deploy key repo (#1328)

This commit is contained in:
Ludovico Magnocavallo
2023-04-17 15:59:07 +09:00
committed by GitHub
parent 09945a24eb
commit 9072c3472e

View File

@@ -113,8 +113,14 @@ resource "github_repository_deploy_key" "default" {
count = (
try(var.modules_config.key_config.create_key, null) == true ? 1 : 0
)
title = "Modules repository access"
repository = local.modules_repo
title = "Modules repository access"
# if an organization is part of the repo name, we need to strip it
# as the resource interpolates the provider org
repository = (
length(split("/", local.modules_repo)) == 1
? local.modules_repo
: split("/", local.modules_repo)[1]
)
key = (
try(var.modules_config.key_config.keypair_path, null) == null
? tls_private_key.default.public_key_openssh
@@ -184,4 +190,4 @@ resource "github_repository_pull_request" "default" {
depends_on = [
github_repository_file.default
]
}
}