mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 08:51:02 -06:00
command/apply: don't init if no args given [GH-780]
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.
This commit is contained in:
parent
91a3405e88
commit
90138825a2
@ -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:
|
||||
|
@ -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.")
|
||||
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user