github.com/jgadling/terraform@v0.3.8-0.20150227214559-abd68c2c87bc/command/command.go (about) 1 package command 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/terraform" 7 "github.com/mitchellh/cli" 8 ) 9 10 // Set to true when we're testing 11 var test bool = false 12 13 // DefaultDataDir is the default directory for storing local data. 14 const DefaultDataDir = ".terraform" 15 16 // DefaultStateFilename is the default filename used for the state file. 17 const DefaultStateFilename = "terraform.tfstate" 18 19 // DefaultVarsFilename is the default filename used for vars 20 const DefaultVarsFilename = "terraform.tfvars" 21 22 // DefaultBackupExtention is added to the state file to form the path 23 const DefaultBackupExtention = ".backup" 24 25 // DefaultDataDirectory is the directory where local state is stored 26 // by default. 27 const DefaultDataDirectory = ".terraform" 28 29 func validateContext(ctx *terraform.Context, ui cli.Ui) bool { 30 if ws, es := ctx.Validate(); len(ws) > 0 || len(es) > 0 { 31 ui.Output( 32 "There are warnings and/or errors related to your configuration. Please\n" + 33 "fix these before continuing.\n") 34 35 if len(ws) > 0 { 36 ui.Output("Warnings:\n") 37 for _, w := range ws { 38 ui.Output(fmt.Sprintf(" * %s", w)) 39 } 40 41 if len(es) > 0 { 42 ui.Output("") 43 } 44 } 45 46 if len(es) > 0 { 47 ui.Output("Errors:\n") 48 for _, e := range es { 49 ui.Output(fmt.Sprintf(" * %s", e)) 50 } 51 } 52 53 return false 54 } 55 56 return true 57 }