github.com/arvindram03/terraform@v0.3.7-0.20150212015210-408f838db36d/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 // DefaultStateFilename is the default filename used for the state file. 14 const DefaultStateFilename = "terraform.tfstate" 15 16 // DefaultVarsFilename is the default filename used for vars 17 const DefaultVarsFilename = "terraform.tfvars" 18 19 // DefaultBackupExtention is added to the state file to form the path 20 const DefaultBackupExtention = ".backup" 21 22 // DefaultDataDirectory is the directory where local state is stored 23 // by default. 24 const DefaultDataDirectory = ".terraform" 25 26 func validateContext(ctx *terraform.Context, ui cli.Ui) bool { 27 if ws, es := ctx.Validate(); len(ws) > 0 || len(es) > 0 { 28 ui.Output( 29 "There are warnings and/or errors related to your configuration. Please\n" + 30 "fix these before continuing.\n") 31 32 if len(ws) > 0 { 33 ui.Output("Warnings:\n") 34 for _, w := range ws { 35 ui.Output(fmt.Sprintf(" * %s", w)) 36 } 37 38 if len(es) > 0 { 39 ui.Output("") 40 } 41 } 42 43 if len(es) > 0 { 44 ui.Output("Errors:\n") 45 for _, e := range es { 46 ui.Output(fmt.Sprintf(" * %s", e)) 47 } 48 } 49 50 return false 51 } 52 53 return true 54 }