mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package local
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/opentofu/opentofu/internal/backend"
|
|
)
|
|
|
|
// backend.CLI impl.
|
|
func (b *Local) CLIInit(opts *backend.CLIOpts) error {
|
|
b.ContextOpts = opts.ContextOpts
|
|
b.OpInput = opts.Input
|
|
b.OpValidation = opts.Validation
|
|
|
|
// configure any new cli options
|
|
if opts.StatePath != "" {
|
|
log.Printf("[TRACE] backend/local: CLI option -state is overriding state path to %s", opts.StatePath)
|
|
b.OverrideStatePath = opts.StatePath
|
|
}
|
|
|
|
if opts.StateOutPath != "" {
|
|
log.Printf("[TRACE] backend/local: CLI option -state-out is overriding state output path to %s", opts.StateOutPath)
|
|
b.OverrideStateOutPath = opts.StateOutPath
|
|
}
|
|
|
|
if opts.StateBackupPath != "" {
|
|
log.Printf("[TRACE] backend/local: CLI option -backup is overriding state backup path to %s", opts.StateBackupPath)
|
|
b.OverrideStateBackupPath = opts.StateBackupPath
|
|
}
|
|
|
|
return nil
|
|
}
|