From 9072c3472e777364c40eff7d392b0cd420ffa45d Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Mon, 17 Apr 2023 15:59:07 +0900 Subject: [PATCH] strip org name from deploy key repo (#1328) --- fast/extras/0-cicd-github/main.tf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fast/extras/0-cicd-github/main.tf b/fast/extras/0-cicd-github/main.tf index 3566576339..457233d99f 100644 --- a/fast/extras/0-cicd-github/main.tf +++ b/fast/extras/0-cicd-github/main.tf @@ -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 ] -} \ No newline at end of file +}