Пример #1
0
// Initialize project files such as project.json and ./functions.
func (b *Bootstrapper) initProjectFiles(iamRole string) error {
	logf("creating ./project.json")

	project := fmt.Sprintf(projectConfig, b.name, b.description, iamRole)

	if err := ioutil.WriteFile("project.json", []byte(project), 0644); err != nil {
		return err
	}

	logf("creating ./functions")
	return boilerplate.RestoreAssets(".", "functions")
}
Пример #2
0
// infra bootstraps terraform for infrastructure management.
func initInfra() error {
	if _, err := exec.LookPath("terraform"); err != nil {
		return fmt.Errorf("terraform is not installed")
	}

	logf("creating ./infrastructure")
	if err := boilerplate.RestoreAssets(".", infra.Dir); err != nil {
		return err
	}

	return setupModules()
}
Пример #3
0
// Project bootstraps a project.
func initProject(name, description, iamRole string) error {
	logf("creating ./project.json")

	var project string
	if iamRole == "" {
		project = fmt.Sprintf(projectConfigWithoutRole, name, description)
	} else {
		project = fmt.Sprintf(projectConfig, name, description, iamRole)
	}

	if err := ioutil.WriteFile("project.json", []byte(project), 0644); err != nil {
		return err
	}

	logf("creating ./functions")
	return boilerplate.RestoreAssets(".", "functions")
}
Пример #4
0
// infra bootstraps terraform for infrastructure management.
func initInfra(envs []string) error {
	if _, err := exec.LookPath("terraform"); err != nil {
		return fmt.Errorf("terraform is not installed")
	}

	logf("creating ./infrastructure")

	if err := boilerplate.RestoreAssets(".", filepath.Join(infra.Dir, "modules")); err != nil {
		return err
	}

	for _, env := range envs {
		if err := setupEnv(env); err != nil {
			return err
		}

		if err := setupModules(env); err != nil {
			return err
		}
	}

	return nil
}