Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions create/manager_triton.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ type tritonManagerTerraformConfig struct {
MasterTritonMachinePackage string `json:"master_triton_machine_package,omitempty"`
}

type typeManagerOutput struct {
Value string `json:"value"`
}

func newTritonManager(currentState state.State, name string) error {
nonInteractiveMode := viper.GetBool("non-interactive")

Expand All @@ -54,6 +58,18 @@ func newTritonManager(currentState state.State, name string) error {
baseManagerTerraformConfig: baseConfig,
}

rancherAccessKeyOtpt := typeManagerOutput{
Value: "${module.cluster-manager.rancher_access_key}",
}

rancherSecretKeyOtpt := typeManagerOutput{
Value: "${module.cluster-manager.rancher_secret_key}",
}

rancherUrlKeyOtpt := typeManagerOutput{
Value: "${module.cluster-manager.rancher_url}",
}

// Triton Account
if viper.IsSet("triton_account") {
cfg.TritonAccount = viper.GetString("triton_account")
Expand Down Expand Up @@ -394,6 +410,9 @@ func newTritonManager(currentState state.State, name string) error {
}

currentState.SetManager(&cfg)
currentState.SetOutput(&rancherUrlKeyOtpt, "rancher_url")
currentState.SetOutput(&rancherAccessKeyOtpt, "rancher_access_key")
currentState.SetOutput(&rancherSecretKeyOtpt, "rancher_secret_key")

return nil
}
2 changes: 1 addition & 1 deletion shell/run_terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func RunTerraformOutputWithState(state state.State, moduleName string) error {
}

// Run terraform output
err = runShellCommand(&shellOptions, "terraform", "output", "-module", moduleName)
err = runShellCommand(&shellOptions, "terraform", "output")
if err != nil {
return err
}
Expand Down
9 changes: 9 additions & 0 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func (state *State) SetManager(obj interface{}) error {
return nil
}

func (state *State) SetOutput(obj interface{}, outputName string) error {
_, err := state.configJSON.SetP(obj, fmt.Sprintf("output.%s", outputName))
if err != nil {
return err
}

return nil
}

func (state *State) SetTerraformBackendConfig(tfBackendPath string, tfBackendObj interface{}) error {
_, err := state.configJSON.SetP(tfBackendObj, tfBackendPath)
if err != nil {
Expand Down