commands: start apply

This commit is contained in:
Mitchell Hashimoto 2014-05-24 12:27:58 -07:00
parent a4a4e3784d
commit 046e80361b
2 changed files with 43 additions and 0 deletions

37
command/apply.go Normal file
View File

@ -0,0 +1,37 @@
package command
import (
"strings"
"github.com/mitchellh/cli"
)
// ApplyCommand is a Command implementation that applies a Terraform
// configuration and actually builds or changes infrastructure.
type ApplyCommand struct {
Ui cli.Ui
}
func (c *ApplyCommand) Run(_ []string) int {
return 0
}
func (c *ApplyCommand) Help() string {
helpText := `
Usage: terraform apply [terraform.tf]
Builds or changes infrastructure according to the Terraform configuration
file.
Options:
-init If specified, it is okay to build brand new infrastructure
(with no state file specified).
`
return strings.TrimSpace(helpText)
}
func (c *ApplyCommand) Synopsis() string {
return "Builds or changes infrastructure according to Terrafiles"
}

View File

@ -14,6 +14,12 @@ func init() {
ui := &cli.BasicUi{Writer: os.Stdout} ui := &cli.BasicUi{Writer: os.Stdout}
Commands = map[string]cli.CommandFactory{ Commands = map[string]cli.CommandFactory{
"apply": func() (cli.Command, error) {
return &command.ApplyCommand{
Ui: ui,
}, nil
},
"version": func() (cli.Command, error) { "version": func() (cli.Command, error) {
return &command.VersionCommand{ return &command.VersionCommand{
Revision: GitCommit, Revision: GitCommit,