Skip to content

Commit

Permalink
fix bootstrap with marketplace install
Browse files Browse the repository at this point in the history
  • Loading branch information
Barber authored and Barber committed Dec 4, 2023
1 parent 031fcdd commit d2de572
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions backend/internal/processes/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import (
"github.com/unity-sds/unity-management-console/backend/internal/application/config"
"github.com/unity-sds/unity-management-console/backend/internal/aws"
"github.com/unity-sds/unity-management-console/backend/internal/database"
"github.com/unity-sds/unity-management-console/backend/internal/terraform"
"path/filepath"
)

func BootstrapEnv(appconf *config.AppConfig) {
store, err := database.NewGormDatastore()

provisionS3(appconf)
initTerraform(appconf)
initTerraform(store, appconf)

storeDefaultSSMParameters(appconf, store)
//r := action.ActRunnerImpl{}
Expand All @@ -35,14 +34,10 @@ func provisionS3(appConfig *config.AppConfig) {
}
}

func initTerraform(appconf *config.AppConfig) {
executor := &terraform.RealTerraformExecutor{}
func initTerraform(store database.Datastore, appconf *config.AppConfig) {
fs := afero.NewOsFs()
writeInitTemplate(fs, appconf)
err := terraform.RunTerraform(appconf, nil, "", executor, "unity-cloud-env")
if err != nil {
return
}
installUnityCloudEnv(store, appconf)

}

Expand Down Expand Up @@ -113,3 +108,19 @@ func installGateway(store database.Datastore, appConfig *config.AppConfig) {
log.WithError(err).Error("Issue installing API Gateway")
}
}

func installUnityCloudEnv(store database.Datastore, appConfig *config.AppConfig) {
applications := marketplace.Install_Applications{
Name: "unity-cloud-env",
Version: "0.1",
Variables: nil,
}
install := marketplace.Install{
Applications: &applications,
DeploymentName: "Unity Cloud Environment",
}
err := TriggerInstall(nil, "", store, &install, appConfig)
if err != nil {
log.WithError(err).Error("Issue installing Unity Cloud Env")
}
}

0 comments on commit d2de572

Please sign in to comment.