Example #1
0
File: app.go Project: mbrodala/otto
func (a *App) Build(ctx *app.Context) error {
	// Determine if we set a Packer path.
	path := filepath.Join(ctx.Dir, "build", "packer_path")
	if _, err := os.Stat(path); err != nil {
		if os.IsNotExist(err) {
			return errors.New(strings.TrimSpace(errPackerNotSet))
		}

		return err
	}

	// Read the actual Packer dir
	packerPath, err := oneline.Read(path)
	if err != nil {
		return fmt.Errorf(
			"Error reading the Packer template path: %s\n\n"+
				"An Otto recompile with `otto compile` usually fixes this.",
			err)
	}

	return packer.Build(ctx, &packer.BuildOptions{
		Dir:          filepath.Dir(packerPath),
		TemplatePath: packerPath,
	})
}
Example #2
0
File: app.go Project: rowhit/otto
func (a *App) Build(ctx *app.Context) error {
	return packer.Build(ctx, &packer.BuildOptions{
		InfraOutputMap: map[string]string{
			"region": "aws_region",
		},
	})
}
Example #3
0
File: app.go Project: mbrodala/otto
func (a *App) Build(ctx *app.Context) error {
	return packer.Build(ctx, &packer.BuildOptions{
		InfraOutputMap: map[string]string{
			"region":        "aws_region",
			"vpc_id":        "aws_vpc_id",
			"subnet_public": "aws_subnet_id",
		},
	})
}