mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-27 09:21:14 -06:00
command/output: get the state path from the workspace or CLI argument (#20994)
Previously this command was setting the state path to the default state file, instead of honoring the backend configuration.
This commit is contained in:
parent
88982fdbc3
commit
1c95b21c6c
@ -28,11 +28,11 @@ func (c *OutputCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
var module string
|
||||
var module, statePath string
|
||||
var jsonOutput bool
|
||||
cmdFlags := c.Meta.defaultFlagSet("output")
|
||||
cmdFlags.BoolVar(&jsonOutput, "json", false, "json")
|
||||
cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path")
|
||||
cmdFlags.StringVar(&statePath, "state", "", "path")
|
||||
cmdFlags.StringVar(&module, "module", "", "module")
|
||||
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
|
||||
if err := cmdFlags.Parse(args); err != nil {
|
||||
@ -53,6 +53,10 @@ func (c *OutputCommand) Run(args []string) int {
|
||||
name = args[0]
|
||||
}
|
||||
|
||||
if statePath != "" {
|
||||
c.Meta.statePath = statePath
|
||||
}
|
||||
|
||||
var diags tfdiags.Diagnostics
|
||||
|
||||
// Load the backend
|
||||
|
Loading…
Reference in New Issue
Block a user