mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
backend folder
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Package backend provides interfaces that the CLI uses to interact with
|
||||
// Terraform. A backend provides the abstraction that allows the same CLI
|
||||
// OpenTF. A backend provides the abstraction that allows the same CLI
|
||||
// to simultaneously support both local and remote operations for seamlessly
|
||||
// using Terraform in a team environment.
|
||||
// using OpenTF in a team environment.
|
||||
package backend
|
||||
|
||||
import (
|
||||
@@ -55,7 +55,7 @@ var (
|
||||
// InitFn is used to initialize a new backend.
|
||||
type InitFn func() Backend
|
||||
|
||||
// Backend is the minimal interface that must be implemented to enable Terraform.
|
||||
// Backend is the minimal interface that must be implemented to enable OpenTF.
|
||||
type Backend interface {
|
||||
// ConfigSchema returns a description of the expected configuration
|
||||
// structure for the receiving backend.
|
||||
@@ -136,7 +136,7 @@ type HostAlias struct {
|
||||
type Enhanced interface {
|
||||
Backend
|
||||
|
||||
// Operation performs a Terraform operation such as refresh, plan, apply.
|
||||
// Operation performs a OpenTF operation such as refresh, plan, apply.
|
||||
// It is up to the implementation to determine what "performing" means.
|
||||
// This DOES NOT BLOCK. The context returned as part of RunningOperation
|
||||
// should be used to block for completion.
|
||||
@@ -153,7 +153,7 @@ type Enhanced interface {
|
||||
// Local implements additional behavior on a Backend that allows local
|
||||
// operations in addition to remote operations.
|
||||
//
|
||||
// This enables more behaviors of Terraform that require more data such
|
||||
// This enables more behaviors of OpenTF that require more data such
|
||||
// as `console`, `import`, `graph`. These require direct access to
|
||||
// configurations, variables, and more. Not all backends may support this
|
||||
// so we separate it out into its own optional interface.
|
||||
@@ -183,12 +183,12 @@ type Local interface {
|
||||
//
|
||||
// This type is a weird architectural wart resulting from the overly-general
|
||||
// way our backend API models operations, whereby we behave as if all
|
||||
// Terraform operations have the same inputs and outputs even though they
|
||||
// OpenTF operations have the same inputs and outputs even though they
|
||||
// are actually all rather different. The exact meaning of the fields in
|
||||
// this type therefore vary depending on which OperationType was passed to
|
||||
// Local.Context in order to create an object of this type.
|
||||
type LocalRun struct {
|
||||
// Core is an already-initialized Terraform Core context, ready to be
|
||||
// Core is an already-initialized OpenTF Core context, ready to be
|
||||
// used to run operations such as Plan and Apply.
|
||||
Core *terraform.Context
|
||||
|
||||
@@ -217,7 +217,7 @@ type LocalRun struct {
|
||||
Plan *plans.Plan
|
||||
}
|
||||
|
||||
// An operation represents an operation for Terraform to execute.
|
||||
// An operation represents an operation for OpenTF to execute.
|
||||
//
|
||||
// Note that not all fields are supported by all backends and can result
|
||||
// in an error if set. All backend implementations should show user-friendly
|
||||
@@ -225,13 +225,13 @@ type LocalRun struct {
|
||||
// backend doesn't support a PlanId being set.
|
||||
//
|
||||
// The operation options are purposely designed to have maximal compatibility
|
||||
// between Terraform and Terraform Servers (a commercial product offered by
|
||||
// between OpenTF and OpenTF Servers (a commercial product offered by
|
||||
// HashiCorp). Therefore, it isn't expected that other implementation support
|
||||
// every possible option. The struct here is generalized in order to allow
|
||||
// even partial implementations to exist in the open, without walling off
|
||||
// remote functionality 100% behind a commercial wall. Anyone can implement
|
||||
// against this interface and have Terraform interact with it just as it
|
||||
// would with HashiCorp-provided Terraform Servers.
|
||||
// against this interface and have OpenTF interact with it just as it
|
||||
// would with HashiCorp-provided OpenTF Servers.
|
||||
type Operation struct {
|
||||
// Type is the operation to perform.
|
||||
Type OperationType
|
||||
@@ -315,7 +315,7 @@ type Operation struct {
|
||||
}
|
||||
|
||||
// HasConfig returns true if and only if the operation has a ConfigDir value
|
||||
// that refers to a directory containing at least one Terraform configuration
|
||||
// that refers to a directory containing at least one OpenTF configuration
|
||||
// file.
|
||||
func (o *Operation) HasConfig() bool {
|
||||
return o.ConfigLoader.IsConfigDir(o.ConfigDir)
|
||||
|
||||
Reference in New Issue
Block a user