From 21b8a979800bd45e5a394246af358296e5b803d3 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Sun, 30 Jun 2024 21:36:26 +0200 Subject: [PATCH] Trim git suffix from repo origin --- pkg/scaffold/scaffold_test.go | 6 +++--- pkg/scaffold/tf.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/scaffold/scaffold_test.go b/pkg/scaffold/scaffold_test.go index 1836806..30e9126 100644 --- a/pkg/scaffold/scaffold_test.go +++ b/pkg/scaffold/scaffold_test.go @@ -15,9 +15,9 @@ import ( const expectedBackendConfig = `terraform { backend "http" { - address = "https://ffddorf-terraform-backend.fly.dev/state/terraform-backend.git/default" - lock_address = "https://ffddorf-terraform-backend.fly.dev/state/terraform-backend.git/default" - unlock_address = "https://ffddorf-terraform-backend.fly.dev/state/terraform-backend.git/default" + address = "https://ffddorf-terraform-backend.fly.dev/state/terraform-backend/default" + lock_address = "https://ffddorf-terraform-backend.fly.dev/state/terraform-backend/default" + unlock_address = "https://ffddorf-terraform-backend.fly.dev/state/terraform-backend/default" username = "github_pat" } } diff --git a/pkg/scaffold/tf.go b/pkg/scaffold/tf.go index 69f7f53..fd716f3 100644 --- a/pkg/scaffold/tf.go +++ b/pkg/scaffold/tf.go @@ -97,6 +97,7 @@ func writeBackendConfig(ctx context.Context, dir fs.FS, stdin io.Reader) (reterr return fmt.Errorf("invalid repo path: %s", origin.Path) } repo := segments[1] + repo = strings.TrimSuffix(repo, ".git") backendURL, err := url.Parse(backendAddress) if err != nil {