2017-02-28 12:58:29 -06:00
|
|
|
package local
|
|
|
|
|
|
|
|
import (
|
2018-11-14 18:03:14 -06:00
|
|
|
"log"
|
|
|
|
|
2021-05-17 10:42:17 -05:00
|
|
|
"github.com/hashicorp/terraform/internal/backend"
|
2017-02-28 12:58:29 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
// backend.CLI impl.
|
|
|
|
func (b *Local) CLIInit(opts *backend.CLIOpts) error {
|
|
|
|
b.ContextOpts = opts.ContextOpts
|
|
|
|
b.OpInput = opts.Input
|
|
|
|
b.OpValidation = opts.Validation
|
|
|
|
|
2018-10-16 19:47:23 -05:00
|
|
|
// configure any new cli options
|
|
|
|
if opts.StatePath != "" {
|
2018-11-14 18:03:14 -06:00
|
|
|
log.Printf("[TRACE] backend/local: CLI option -state is overriding state path to %s", opts.StatePath)
|
|
|
|
b.OverrideStatePath = opts.StatePath
|
2018-10-16 19:47:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if opts.StateOutPath != "" {
|
2018-11-14 18:03:14 -06:00
|
|
|
log.Printf("[TRACE] backend/local: CLI option -state-out is overriding state output path to %s", opts.StateOutPath)
|
|
|
|
b.OverrideStateOutPath = opts.StateOutPath
|
2018-10-16 19:47:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if opts.StateBackupPath != "" {
|
2018-11-14 18:03:14 -06:00
|
|
|
log.Printf("[TRACE] backend/local: CLI option -backup is overriding state backup path to %s", opts.StateBackupPath)
|
|
|
|
b.OverrideStateBackupPath = opts.StateBackupPath
|
2017-02-28 12:58:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|