Skip to content

Commit

Permalink
OIDC var fix (#207)
Browse files Browse the repository at this point in the history
* telemetry adjustments

* fixing string array var for vault oidc redirect
  • Loading branch information
johndietz committed Aug 10, 2022
1 parent b883d5a commit 89a33eb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions internal/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func ConfigureVault(dryRun bool, bootstrapOnly bool) {
// ```
// ... obviously keep the sensitive values bound to vars

if bootstrapOnly {
viper.Set("vault.oidc_redirect_uris", "will-be-patched-later")
if bootstrapOnly {
viper.Set("vault.oidc_redirect_uris", "[\"will-be-patched-later\"]")
viper.WriteConfig()
}

Expand Down Expand Up @@ -90,10 +90,11 @@ func ConfigureVault(dryRun bool, bootstrapOnly bool) {
envs["TF_VAR_email_address"] = viper.GetString("adminemail")
envs["TF_VAR_gitlab_runner_token"] = viper.GetString("gitlab.runnertoken")
envs["TF_VAR_gitlab_token"] = viper.GetString("gitlab.token")
envs["TF_VAR_hosted_zone_id"] = viper.GetString("aws.domainid")
envs["TF_VAR_hosted_zone_id"] = viper.GetString("aws.hostedzoneid") //# TODO: are we using this?
envs["TF_VAR_hosted_zone_name"] = viper.GetString("aws.hostedzonename")
envs["TF_VAR_vault_token"] = vaultToken
envs["TF_VAR_vault_redirect_uris"] = viper.GetString("vault.oidc_redirect_uris")
envs["TF_VAR_vault_redirect_uris"] = viper.GetString("vault.oidc_redirect_uris")

directory := fmt.Sprintf("%s/gitops/terraform/vault", config.K1FolderPath)
err = os.Chdir(directory)
if err != nil {
Expand Down Expand Up @@ -145,9 +146,9 @@ func AddGitlabOidcApplications(dryRun bool) {
cb["argo"] = fmt.Sprintf("https://argo.%s/oauth2/callback", domain)
cb["argocd"] = fmt.Sprintf("https://argocd.%s/auth/callback", domain)
cb["vault"] = fmt.Sprintf("https://vault.%s:8250/oidc/callback http://localhost:8250/oidc/callback https://vault.%s/ui/vault/auth/oidc/oidc/callback http://localhost:8200/ui/vault/auth/oidc/oidc/callback", domain, domain)
viper.Set("vault.oidc_redirect_uris", cb["vault"])
viper.WriteConfig()

viper.Set("vault.oidc_redirect_uris", fmt.Sprintf("[\"https://vault.%s:8250/oidc/callback\", \"http://localhost:8250/oidc/callback\", \"https://vault.%s/ui/vault/auth/oidc/oidc/callback\", \"http://localhost:8200/ui/vault/auth/oidc/oidc/callback\"]", domain, domain))
viper.WriteConfig()

for _, app := range apps {
log.Println("checking to see if", app, "oidc application needs to be created in gitlab")
Expand Down

0 comments on commit 89a33eb

Please sign in to comment.