Skip to content

Commit

Permalink
fix terraform workspace remote url (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarededwards authored Nov 30, 2023
1 parent 2ff392f commit c3abbb5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/hashicorp/vault/api v1.9.0
github.com/joho/godotenv v1.5.1
github.com/kubefirst/metrics-client v0.2.8
github.com/kubefirst/runtime v0.3.31
github.com/kubefirst/runtime v0.3.32
github.com/minio/minio-go/v7 v7.0.49
github.com/otiai10/copy v1.7.0
github.com/rs/zerolog v1.29.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubefirst/metrics-client v0.2.8 h1:JfaeiBifZD/DpyYW2QVHcrhH/KWA98OmM+7c7M12qMc=
github.com/kubefirst/metrics-client v0.2.8/go.mod h1:GR7wsMcyYhd+EU67PeuMCBYFE6OJ7P/j5OI5BLOoRMc=
github.com/kubefirst/runtime v0.3.31 h1:8UT6nwrCqCYRc6rQWQsPsUo+EPd6xZULzkYamSIucWE=
github.com/kubefirst/runtime v0.3.31/go.mod h1:9egAgF5cF594mIzra5nTB1kfE57Hr/Nvl79tjLsAWCQ=
github.com/kubefirst/runtime v0.3.32 h1:xk58E+uu3KGLE3+ks/OqyIfNrPA5IUFh0h4IrhPCB+U=
github.com/kubefirst/runtime v0.3.32/go.mod h1:9egAgF5cF594mIzra5nTB1kfE57Hr/Nvl79tjLsAWCQ=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
Expand Down
7 changes: 4 additions & 3 deletions internal/controller/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ func (clctrl *ClusterController) CreateTokens(kind string) interface{} {
GitlabOwnerGroupID: clctrl.GitlabOwnerGroupID,
GitlabUser: clctrl.GitAuth.User,

GitopsRepoAtlantisWebhookURL: clctrl.AtlantisWebhookURL,
GitopsRepoNoHTTPSURL: fmt.Sprintf("%s.com/%s/gitops.git", clctrl.GitHost, clctrl.GitAuth.Owner),
ClusterId: clctrl.ClusterID,
GitopsRepoAtlantisWebhookURL: clctrl.AtlantisWebhookURL,
GitopsRepoNoHTTPSURL: fmt.Sprintf("%s/%s/gitops.git", clctrl.GitHost, clctrl.GitAuth.Owner),
WorkloadClusterTerraformModuleURL: fmt.Sprintf("git::https://%s/%s//terraform/%s/modules/workload-cluster?ref=main", clctrl.GitHost, clctrl.GitAuth.Owner, clctrl.CloudProvider),
ClusterId: clctrl.ClusterID,

// external-dns optionality to provide cloudflare support regardless of cloud provider
ExternalDNSProviderName: clctrl.DnsProvider,
Expand Down
2 changes: 1 addition & 1 deletion pkg/providerConfigs/detokenize.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func detokenizeGitops(path string, tokens *GitopsDirectoryValues, gitProtocol st
newContents = strings.Replace(newContents, "<KUBEFIRST_TEAM_INFO>", os.Getenv("KUBEFIRST_TEAM_INFO"), -1)
newContents = strings.Replace(newContents, "<KUBEFIRST_VERSION>", tokens.KubefirstVersion, -1)
newContents = strings.Replace(newContents, "<KUBEFIRST_STATE_STORE_BUCKET_HOSTNAME>", tokens.StateStoreBucketHostname, -1)
newContents = strings.Replace(newContents, "<WORKLOAD_CLUSTER_TERRAFORM_MODULE_URL>", "git::https://<GITOPS_REPO_NO_HTTPS_URL>//terraform/<CLOUD_PROVIDER>/modules/workload-cluster?ref=main", -1)
newContents = strings.Replace(newContents, "<WORKLOAD_CLUSTER_TERRAFORM_MODULE_URL>", tokens.WorkloadClusterTerraformModuleURL, -1)

newContents = strings.Replace(newContents, "<NODE_TYPE>", tokens.NodeType, -1)
newContents = strings.Replace(newContents, "<NODE_COUNT>", fmt.Sprint(tokens.NodeCount), -1)
Expand Down
5 changes: 3 additions & 2 deletions pkg/providerConfigs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ type GitopsDirectoryValues struct {
GitlabOwnerGroupID int
GitlabUser string

GitopsRepoAtlantisWebhookURL string
GitopsRepoNoHTTPSURL string
GitopsRepoAtlantisWebhookURL string
GitopsRepoNoHTTPSURL string
WorkloadClusterTerraformModuleURL string

ExternalDNSProviderName string
ExternalDNSProviderTokenEnvName string
Expand Down

0 comments on commit c3abbb5

Please sign in to comment.