func (a *App) Deploy(ctx *app.Context) error { // Determine if we set a Terraform path. If we didn't, then // tell the user we can't deploy. path := filepath.Join(ctx.Dir, "deploy", "terraform_path") if _, err := os.Stat(path); err != nil { if os.IsNotExist(err) { return errors.New(strings.TrimSpace(errTerraformNotSet)) } return err } // Read the actual TF dir tfdir, err := oneline.Read(path) if err != nil { return fmt.Errorf( "Error reading the Terraform module directory: %s\n\n"+ "An Otto recompile with `otto compile` usually fixes this.", err) } // Determine if we set a Packer path. If we didn't, we disable // the build loading for deploys. disableBuild := true path = filepath.Join(ctx.Dir, "build", "packer_path") if _, err := os.Stat(path); err == nil { disableBuild = false } // But if we did, then deploy using Terraform return terraform.Deploy(&terraform.DeployOptions{ Dir: tfdir, DisableBuild: disableBuild, }).Route(ctx) }
func (a *App) Deploy(ctx *app.Context) error { return terraform.Deploy(&terraform.DeployOptions{ InfraOutputMap: map[string]string{ "region": "aws_region", "subnet-private": "private_subnet_id", "subnet-public": "public_subnet_id", }, }).Route(ctx) }
func (a *App) Deploy(ctx *app.Context) error { // Check if we have a deployment script path := filepath.Join(ctx.Dir, "deploy", "main.tf") if _, err := os.Stat(path); err != nil { return fmt.Errorf(deployError) } // We do! Run it return terraform.Deploy(&terraform.DeployOptions{ DisableBuild: true, InfraOutputMap: map[string]string{ "region": "aws_region", "subnet-private": "private_subnet_id", "subnet-public": "public_subnet_id", }, }).Route(ctx) }