From 046e80361bff2ba8184a71a22fcef849abbd22fb Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 24 May 2014 12:27:58 -0700 Subject: [PATCH] commands: start apply --- command/apply.go | 37 +++++++++++++++++++++++++++++++++++++ commands.go | 6 ++++++ 2 files changed, 43 insertions(+) create mode 100644 command/apply.go diff --git a/command/apply.go b/command/apply.go new file mode 100644 index 000000000..d93537777 --- /dev/null +++ b/command/apply.go @@ -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" +} diff --git a/commands.go b/commands.go index 73e9862d6..5e8605c05 100644 --- a/commands.go +++ b/commands.go @@ -14,6 +14,12 @@ func init() { ui := &cli.BasicUi{Writer: os.Stdout} Commands = map[string]cli.CommandFactory{ + "apply": func() (cli.Command, error) { + return &command.ApplyCommand{ + Ui: ui, + }, nil + }, + "version": func() (cli.Command, error) { return &command.VersionCommand{ Revision: GitCommit,