Skip to content

Commit

Permalink
command/apply: don't init if no args given [GH-780]
Browse files Browse the repository at this point in the history
I really don't know how to unit test this since I don't know what input
triggers this except that it has been reporting a few times in the wild.
  • Loading branch information
mitchellh committed Jan 16, 2015
1 parent 91a3405 commit 9013882
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ BUG FIXES:
* core: Fix crash that could occur when there are exactly zero providers
installed on a system. [GH-786]
* core: JSON TF configurations can configure provisioners. [GH-807]
* command/apply: Won't try to initialize modules in some cases when
no arguments are given. [GH-780]
* provider/aws: ELB subnet change doesn't force new resource. [GH-804]

PLUGIN CHANGES:
Expand Down
4 changes: 3 additions & 1 deletion command/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (c *ApplyCommand) Run(args []string) int {
}

var configPath string
maybeInit := true
args = cmdFlags.Args()
if len(args) > 1 {
c.Ui.Error("The apply command expects at most one argument.")
Expand All @@ -62,13 +63,14 @@ func (c *ApplyCommand) Run(args []string) int {
configPath = args[0]
} else {
configPath = pwd
maybeInit = false
}

// Prepare the extra hooks to count resources
countHook := new(CountHook)
c.Meta.extraHooks = []terraform.Hook{countHook}

if !c.Destroy {
if !c.Destroy && maybeInit {
// Do a detect to determine if we need to do an init + apply.
if detected, err := module.Detect(configPath, pwd); err != nil {
c.Ui.Error(fmt.Sprintf(
Expand Down

0 comments on commit 9013882

Please sign in to comment.