mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
a17f317025
In order to support free organizations, we need a way to load the `remote` backend and then, depending on the used offering/plan, enable or disable remote operations. In other words, we should be able to dynamically fall back to the `local` backend if needed, after first configuring the `remote` backend. To make this works we need to change the way this was done previously when the env var `TF_FORCE_LOCAL_BACKEND` was set. The clear difference of course being that the env var would be available on startup, while the used offering/plan is only known after being able to connect to TFE.
22 lines
406 B
Go
22 lines
406 B
Go
package remote
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/backend"
|
|
)
|
|
|
|
// CLIInit implements backend.CLI
|
|
func (b *Remote) CLIInit(opts *backend.CLIOpts) error {
|
|
if cli, ok := b.local.(backend.CLI); ok {
|
|
if err := cli.CLIInit(opts); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
b.CLI = opts.CLI
|
|
b.CLIColor = opts.CLIColor
|
|
b.ShowDiagnostics = opts.ShowDiagnostics
|
|
b.ContextOpts = opts.ContextOpts
|
|
|
|
return nil
|
|
}
|