diff --git a/atrium/vestibulum/trcshbase/trcsh.go b/atrium/vestibulum/trcshbase/trcsh.go index 52925d3f6..687bb4c2b 100644 --- a/atrium/vestibulum/trcshbase/trcsh.go +++ b/atrium/vestibulum/trcshbase/trcsh.go @@ -667,11 +667,16 @@ func ProcessDeploy(featherCtx *cap.FeatherContext, config *eUtils.DriverConfig, config.Log.Printf("Auth..") trcshEnvRaw := config.EnvRaw - var auth string - authTokenName := "vault_token_azuredeploy" + auth := new(string) authTokenEnv := "azuredeploy" - autoErr := eUtils.AutoAuth(config, secretId, approleId, &auth, &authTokenName, &authTokenEnv, &config.VaultAddress, &trcshEnvRaw, "deployauth", false) - if autoErr != nil || auth == "" { + appRoleConfig := "deployauth" + if gAgentConfig != nil && gAgentConfig.AgentToken != nil { + auth = gAgentConfig.AgentToken + appRoleConfig = "none" + } + authTokenName := "vault_token_azuredeploy" + autoErr := eUtils.AutoAuth(config, secretId, approleId, auth, &authTokenName, &authTokenEnv, &config.VaultAddress, &trcshEnvRaw, appRoleConfig, false) + if autoErr != nil || *auth == "" { fmt.Println("Unable to auth.") fmt.Println(autoErr) os.Exit(-1) @@ -698,9 +703,9 @@ func ProcessDeploy(featherCtx *cap.FeatherContext, config *eUtils.DriverConfig, if (approleId != nil && len(*approleId) == 0) || (secretId != nil && len(*secretId) == 0) { // If in context of trcsh, utilize CToken to auth... if gTrcshConfig != nil && gTrcshConfig.CToken != nil { - auth = *gTrcshConfig.CToken + auth = gTrcshConfig.CToken } else if gAgentConfig.AgentToken != nil { - auth = *gAgentConfig.AgentToken + auth = gAgentConfig.AgentToken } }