cloud

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License: MPL-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkspaceTagsStrategy    workspaceStrategy = "tags"
	WorkspaceNameStrategy    workspaceStrategy = "name"
	WorkspaceNoneStrategy    workspaceStrategy = "none"
	WorkspaceInvalidStrategy workspaceStrategy = "invalid"
)
View Source
const (
	// HeaderSnapshotInterval is the header key that controls the snapshot interval
	HeaderSnapshotInterval = "x-terraform-snapshot-interval"
)

Variables

View Source
var ErrStateVersionUnauthorizedUpgradeState = errors.New(strings.TrimSpace(`
You are not authorized to read the full state version containing outputs.
State versions created by tofu v1.3.0 and newer do not require this level
of authorization and therefore this error can usually be fixed by upgrading the
remote state version.
`))

Functions

func GenerateID

func GenerateID(s string) string

func ParseCloudRunVariables

func ParseCloudRunVariables(vv map[string]backend.UnparsedVariableValue, decls map[string]*configs.Variable) (map[string]string, tfdiags.Diagnostics)

ParseCloudRunVariables accepts a mapping of unparsed values and a mapping of variable declarations and returns a name/value variable map appropriate for an API run context, that is, containing variables only sourced from non-file inputs like CLI args and environment variables. However, all variable parsing diagnostics are returned in order to allow callers to short circuit cloud runs that contain variable declaration or parsing errors. The only exception is that missing required values are not considered errors because they may be defined within the cloud workspace.

Types

type Cloud

type Cloud struct {
	// CLI and Colorize control the CLI output. If CLI is nil then no CLI
	// output will be done. If CLIColor is nil then no coloring will be done.
	CLI      cli.Ui
	CLIColor *colorstring.Colorize

	// ContextOpts are the base context options to set when initializing a
	// new OpenTofu context. Many of these will be overridden or merged by
	// Operation. See Operation for more details.
	ContextOpts *tofu.ContextOpts

	// WorkspaceMapping contains strategies for mapping CLI workspaces in the working directory
	// to remote Terraform Cloud workspaces.
	WorkspaceMapping WorkspaceMapping
	// contains filtered or unexported fields
}

Cloud is an implementation of EnhancedBackend in service of the cloud backend integration for OpenTofu CLI. This backend is not intended to be surfaced at the user level and is instead an implementation detail of cloud.Cloud.

func New

func New(services *disco.Disco, enc encryption.StateEncryption) *Cloud

New creates a new initialized cloud backend.

func (*Cloud) AssertImportCompatible

func (b *Cloud) AssertImportCompatible(config *configs.Config) error

AssertImportCompatible errors if the user is attempting to use configuration- driven import and the version of the agent or API is too low to support it.

func (*Cloud) CLIInit

func (b *Cloud) CLIInit(opts *backend.CLIOpts) error

CLIInit implements backend.CLI

func (*Cloud) Colorize

func (b *Cloud) Colorize() Colorer

Colorize returns the Colorize structure that can be used for colorizing output. This is guaranteed to always return a non-nil value and so is useful as a helper to wrap any potentially colored strings.

func (*Cloud) ConfigSchema

func (b *Cloud) ConfigSchema() *configschema.Block

ConfigSchema implements backend.Enhanced.

func (*Cloud) Configure

func (b *Cloud) Configure(obj cty.Value) tfdiags.Diagnostics

Configure implements backend.Enhanced.

func (*Cloud) DeleteWorkspace

func (b *Cloud) DeleteWorkspace(name string, force bool) error

DeleteWorkspace implements backend.Enhanced.

func (*Cloud) IgnoreVersionConflict

func (b *Cloud) IgnoreVersionConflict()

IgnoreVersionConflict allows commands to disable the fall-back check that the local OpenTofu version matches the remote workspace's configured OpenTofu version. This should be called by commands where this check is unnecessary, such as those performing remote operations, or read-only operations. It will also be called if the user uses a command-line flag to override this check.

func (*Cloud) IsLocalOperations

func (b *Cloud) IsLocalOperations() bool

func (*Cloud) LocalRun

LocalRun implements backend.Local

func (*Cloud) Operation

func (b *Cloud) Operation(ctx context.Context, op *backend.Operation) (*backend.RunningOperation, error)

Operation implements backend.Enhanced.

func (*Cloud) PrepareConfig

func (b *Cloud) PrepareConfig(obj cty.Value) (cty.Value, tfdiags.Diagnostics)

PrepareConfig implements backend.Backend.

func (*Cloud) ServiceDiscoveryAliases

func (b *Cloud) ServiceDiscoveryAliases() ([]backend.HostAlias, error)

func (*Cloud) ShowPlanForRun

func (b *Cloud) ShowPlanForRun(ctx context.Context, runID, runHostname string, redacted bool) (*cloudplan.RemotePlanJSON, error)

ShowPlanForRun downloads the JSON plan output for the specified cloud run (either the redacted or unredacted format, per the caller's request), and returns it in a cloudplan.RemotePlanJSON wrapper struct (along with various metadata required by tofu show). It's intended for use by the tofu show command, in order to format and display a saved cloud plan.

func (*Cloud) StateMgr

func (b *Cloud) StateMgr(name string) (statemgr.Full, error)

StateMgr implements backend.Enhanced.

func (*Cloud) VerifyWorkspaceTerraformVersion

func (b *Cloud) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.Diagnostics

VerifyWorkspaceTerraformVersion compares the local OpenTofu version against the workspace's configured OpenTofu version. If they are compatible, this means that there are no state compatibility concerns, so it returns no diagnostics.

If the versions aren't compatible, it returns an error (or, if b.ignoreVersionConflict is set, a warning).

func (*Cloud) Workspaces

func (b *Cloud) Workspaces() ([]string, error)

Workspaces implements backend.Enhanced, returning a filtered list of workspace names according to the workspace mapping strategy configured.

type Colorer

type Colorer interface {
	Color(v string) string
}

Colorer is the interface that must be implemented to colorize strings.

type Colorize

type Colorize struct {
	// contains filtered or unexported fields
}

Colorize is used to print output when the -no-color flag is used. It will strip all ANSI escaped color codes which are set while the operation was executed in Terraform Enterprise.

When Terraform Enterprise supports run specific variables, this code can be removed as we can then pass the CLI flag to the backend and prevent the color codes from being written to the output.

func (*Colorize) Color

func (c *Colorize) Color(v string) string

Color will strip all ANSI escaped color codes and return a uncolored string.

type ConfigChangeMode

type ConfigChangeMode rune

ConfigChangeMode is a rough way to think about different situations that our backend change and state migration codepaths need to distinguish in the context of Cloud integration mode.

const (
	// ConfigMigrationIn represents when the configuration calls for using
	// Cloud mode but the working directory state disagrees.
	ConfigMigrationIn ConfigChangeMode = '↘'

	// ConfigMigrationOut represents when the working directory state calls
	// for using Cloud mode but the working directory state disagrees.
	ConfigMigrationOut ConfigChangeMode = '↖'

	// ConfigChangeInPlace represents when both the working directory state
	// and the config call for using Cloud mode, and so there might be
	// (but won't necessarily be) cloud settings changing, but we don't
	// need to do any actual migration.
	ConfigChangeInPlace ConfigChangeMode = '↻'

	// ConfigChangeIrrelevant represents when the config and working directory
	// state disagree but neither calls for using Cloud mode, and so the
	// Cloud integration is not involved in dealing with this.
	ConfigChangeIrrelevant ConfigChangeMode = '🤷'
)

func DetectConfigChangeType

func DetectConfigChangeType(wdState *legacy.BackendState, config *configs.Backend, haveLocalStates bool) ConfigChangeMode

DetectConfigChangeType encapsulates the fiddly logic for deciding what kind of Cloud configuration change we seem to be making, based on the existing working directory state (if any) and the current configuration.

This is a pretty specialized sort of thing focused on finicky details of the way we currently model working directory settings and config, so its signature probably won't survive any non-trivial refactoring of how the CLI layer thinks about backends/state storage.

func (ConfigChangeMode) InvolvesCloud

func (m ConfigChangeMode) InvolvesCloud() bool

func (ConfigChangeMode) IsCloudMigration

func (m ConfigChangeMode) IsCloudMigration() bool

func (ConfigChangeMode) String

func (i ConfigChangeMode) String() string

type IntegrationContext

type IntegrationContext struct {
	B             *Cloud
	StopContext   context.Context
	CancelContext context.Context
	Op            *backend.Operation
	Run           *tfe.Run
}

IntegrationContext is a set of data that is useful when performing Terraform Cloud integration operations

func (*IntegrationContext) BeginOutput

func (s *IntegrationContext) BeginOutput(name string) IntegrationOutputWriter

BeginOutput writes a preamble to the CLI and creates a new IntegrationOutputWriter interface to write the remaining CLI output to. Use IntegrationOutputWriter.End() to complete integration output

func (*IntegrationContext) Poll

func (s *IntegrationContext) Poll(backoffMinInterval float64, backoffMaxInterval float64, every func(i int) (bool, error)) error

type IntegrationOutputWriter

type IntegrationOutputWriter interface {
	End()
	OutputElapsed(message string, maxMessage int)
	Output(str string)
	SubOutput(str string)
}

IntegrationOutputWriter is an interface used to to write output tailored for Terraform Cloud integrations

type MockApplies

type MockApplies struct {
	// contains filtered or unexported fields
}

func (*MockApplies) Logs

func (m *MockApplies) Logs(ctx context.Context, applyID string) (io.Reader, error)

func (*MockApplies) Read

func (m *MockApplies) Read(ctx context.Context, applyID string) (*tfe.Apply, error)

type MockClient

type MockClient struct {
	Applies               *MockApplies
	ConfigurationVersions *MockConfigurationVersions
	CostEstimates         *MockCostEstimates
	Organizations         *MockOrganizations
	Plans                 *MockPlans
	PolicySetOutcomes     *MockPolicySetOutcomes
	TaskStages            *MockTaskStages
	RedactedPlans         *MockRedactedPlans
	PolicyChecks          *MockPolicyChecks
	Projects              *MockProjects
	Runs                  *MockRuns
	RunEvents             *MockRunEvents
	StateVersions         *MockStateVersions
	StateVersionOutputs   *MockStateVersionOutputs
	Variables             *MockVariables
	Workspaces            *MockWorkspaces
}

func NewMockClient

func NewMockClient() *MockClient

type MockConfigurationVersions

type MockConfigurationVersions struct {
	// contains filtered or unexported fields
}

func (*MockConfigurationVersions) Archive

func (m *MockConfigurationVersions) Archive(ctx context.Context, cvID string) error

func (*MockConfigurationVersions) Create

func (*MockConfigurationVersions) CreateForRegistryModule

func (m *MockConfigurationVersions) CreateForRegistryModule(ctx context.Context, moduleID tfe.RegistryModuleID) (*tfe.ConfigurationVersion, error)

func (*MockConfigurationVersions) Download

func (m *MockConfigurationVersions) Download(ctx context.Context, cvID string) ([]byte, error)

func (*MockConfigurationVersions) List

func (*MockConfigurationVersions) Read

func (*MockConfigurationVersions) ReadWithOptions

func (*MockConfigurationVersions) Upload

func (m *MockConfigurationVersions) Upload(ctx context.Context, url, path string) error

func (*MockConfigurationVersions) UploadTarGzip

func (m *MockConfigurationVersions) UploadTarGzip(ctx context.Context, url string, archive io.Reader) error

type MockCostEstimates

type MockCostEstimates struct {
	Estimations map[string]*tfe.CostEstimate
	// contains filtered or unexported fields
}

func (*MockCostEstimates) Logs

func (m *MockCostEstimates) Logs(ctx context.Context, costEstimateID string) (io.Reader, error)

func (*MockCostEstimates) Read

func (m *MockCostEstimates) Read(ctx context.Context, costEstimateID string) (*tfe.CostEstimate, error)

type MockOrganizations

type MockOrganizations struct {
	// contains filtered or unexported fields
}

func (*MockOrganizations) Create

func (*MockOrganizations) Delete

func (m *MockOrganizations) Delete(ctx context.Context, name string) error

func (*MockOrganizations) List

func (*MockOrganizations) Read

func (m *MockOrganizations) Read(ctx context.Context, name string) (*tfe.Organization, error)

func (*MockOrganizations) ReadCapacity

func (m *MockOrganizations) ReadCapacity(ctx context.Context, name string) (*tfe.Capacity, error)

func (*MockOrganizations) ReadEntitlements

func (m *MockOrganizations) ReadEntitlements(ctx context.Context, name string) (*tfe.Entitlements, error)

func (*MockOrganizations) ReadRunQueue

func (m *MockOrganizations) ReadRunQueue(ctx context.Context, name string, options tfe.ReadRunQueueOptions) (*tfe.RunQueue, error)

func (*MockOrganizations) ReadWithOptions

func (m *MockOrganizations) ReadWithOptions(ctx context.Context, name string, options tfe.OrganizationReadOptions) (*tfe.Organization, error)

func (*MockOrganizations) Update

type MockPlans

type MockPlans struct {
	// contains filtered or unexported fields
}

func (*MockPlans) Logs

func (m *MockPlans) Logs(ctx context.Context, planID string) (io.Reader, error)

func (*MockPlans) Read

func (m *MockPlans) Read(ctx context.Context, planID string) (*tfe.Plan, error)

func (*MockPlans) ReadJSONOutput

func (m *MockPlans) ReadJSONOutput(ctx context.Context, planID string) ([]byte, error)

type MockPolicyChecks

type MockPolicyChecks struct {
	// contains filtered or unexported fields
}

func (*MockPolicyChecks) List

func (*MockPolicyChecks) Logs

func (m *MockPolicyChecks) Logs(ctx context.Context, policyCheckID string) (io.Reader, error)

func (*MockPolicyChecks) Override

func (m *MockPolicyChecks) Override(ctx context.Context, policyCheckID string) (*tfe.PolicyCheck, error)

func (*MockPolicyChecks) Read

func (m *MockPolicyChecks) Read(ctx context.Context, policyCheckID string) (*tfe.PolicyCheck, error)

type MockPolicySetOutcomes

type MockPolicySetOutcomes struct {
	// contains filtered or unexported fields
}

func (*MockPolicySetOutcomes) List

func (*MockPolicySetOutcomes) Read

func (m *MockPolicySetOutcomes) Read(ctx context.Context, policySetOutcomeID string) (*tfe.PolicySetOutcome, error)

type MockProjects

type MockProjects struct {
	// contains filtered or unexported fields
}

func (*MockProjects) Create

func (m *MockProjects) Create(ctx context.Context, organization string, options tfe.ProjectCreateOptions) (*tfe.Project, error)

func (*MockProjects) Delete

func (m *MockProjects) Delete(ctx context.Context, projectID string) error

func (*MockProjects) List

func (m *MockProjects) List(ctx context.Context, organization string, options *tfe.ProjectListOptions) (*tfe.ProjectList, error)

func (*MockProjects) Read

func (m *MockProjects) Read(ctx context.Context, projectID string) (*tfe.Project, error)

func (*MockProjects) Update

func (m *MockProjects) Update(ctx context.Context, projectID string, options tfe.ProjectUpdateOptions) (*tfe.Project, error)

type MockRedactedPlans

type MockRedactedPlans struct {
	// contains filtered or unexported fields
}

func (*MockRedactedPlans) Read

func (m *MockRedactedPlans) Read(ctx context.Context, hostname, token, planID string) ([]byte, error)

type MockRunEvents

type MockRunEvents struct{}

func (*MockRunEvents) List

func (m *MockRunEvents) List(ctx context.Context, runID string, options *tfe.RunEventListOptions) (*tfe.RunEventList, error)

List all the runs events of the given run.

func (*MockRunEvents) Read

func (m *MockRunEvents) Read(ctx context.Context, runEventID string) (*tfe.RunEvent, error)

func (*MockRunEvents) ReadWithOptions

func (m *MockRunEvents) ReadWithOptions(ctx context.Context, runEventID string, options *tfe.RunEventReadOptions) (*tfe.RunEvent, error)

type MockRuns

type MockRuns struct {
	sync.Mutex

	Runs map[string]*tfe.Run

	// If ModifyNewRun is non-nil, the create method will call it just before
	// saving a new run in the runs map, so that a calling test can mimic
	// side-effects that a real server might apply in certain situations.
	ModifyNewRun func(client *MockClient, options tfe.RunCreateOptions, run *tfe.Run)
	// contains filtered or unexported fields
}

func (*MockRuns) Apply

func (m *MockRuns) Apply(ctx context.Context, runID string, options tfe.RunApplyOptions) error

func (*MockRuns) Cancel

func (m *MockRuns) Cancel(ctx context.Context, runID string, options tfe.RunCancelOptions) error

func (*MockRuns) Create

func (m *MockRuns) Create(ctx context.Context, options tfe.RunCreateOptions) (*tfe.Run, error)

func (*MockRuns) Discard

func (m *MockRuns) Discard(ctx context.Context, runID string, options tfe.RunDiscardOptions) error

func (*MockRuns) ForceCancel

func (m *MockRuns) ForceCancel(ctx context.Context, runID string, options tfe.RunForceCancelOptions) error

func (*MockRuns) ForceExecute

func (m *MockRuns) ForceExecute(ctx context.Context, runID string) error

func (*MockRuns) List

func (m *MockRuns) List(ctx context.Context, workspaceID string, options *tfe.RunListOptions) (*tfe.RunList, error)

func (*MockRuns) Read

func (m *MockRuns) Read(ctx context.Context, runID string) (*tfe.Run, error)

func (*MockRuns) ReadWithOptions

func (m *MockRuns) ReadWithOptions(ctx context.Context, runID string, options *tfe.RunReadOptions) (*tfe.Run, error)

type MockStateVersionOutputs

type MockStateVersionOutputs struct {
	// contains filtered or unexported fields
}

func (*MockStateVersionOutputs) Read

func (*MockStateVersionOutputs) ReadCurrent

func (m *MockStateVersionOutputs) ReadCurrent(ctx context.Context, workspaceID string) (*tfe.StateVersionOutputsList, error)

type MockStateVersions

type MockStateVersions struct {
	// contains filtered or unexported fields
}

func (*MockStateVersions) Create

func (m *MockStateVersions) Create(ctx context.Context, workspaceID string, options tfe.StateVersionCreateOptions) (*tfe.StateVersion, error)

func (*MockStateVersions) Download

func (m *MockStateVersions) Download(ctx context.Context, url string) ([]byte, error)

func (*MockStateVersions) List

func (*MockStateVersions) ListOutputs

func (*MockStateVersions) Read

func (m *MockStateVersions) Read(ctx context.Context, svID string) (*tfe.StateVersion, error)

func (*MockStateVersions) ReadCurrent

func (m *MockStateVersions) ReadCurrent(ctx context.Context, workspaceID string) (*tfe.StateVersion, error)

func (*MockStateVersions) ReadCurrentWithOptions

func (m *MockStateVersions) ReadCurrentWithOptions(ctx context.Context, workspaceID string, options *tfe.StateVersionCurrentOptions) (*tfe.StateVersion, error)

func (*MockStateVersions) ReadWithOptions

func (m *MockStateVersions) ReadWithOptions(ctx context.Context, svID string, options *tfe.StateVersionReadOptions) (*tfe.StateVersion, error)

func (*MockStateVersions) Upload

func (m *MockStateVersions) Upload(ctx context.Context, workspaceID string, options tfe.StateVersionUploadOptions) (*tfe.StateVersion, error)

type MockTaskStages

type MockTaskStages struct {
	// contains filtered or unexported fields
}

func (*MockTaskStages) List

func (*MockTaskStages) Override

func (m *MockTaskStages) Override(ctx context.Context, taskStageID string, options tfe.TaskStageOverrideOptions) (*tfe.TaskStage, error)

func (*MockTaskStages) Read

func (m *MockTaskStages) Read(ctx context.Context, taskStageID string, options *tfe.TaskStageReadOptions) (*tfe.TaskStage, error)

type MockVariables

type MockVariables struct {
	// contains filtered or unexported fields
}

func (*MockVariables) Create

func (m *MockVariables) Create(ctx context.Context, workspaceID string, options tfe.VariableCreateOptions) (*tfe.Variable, error)

func (*MockVariables) Delete

func (m *MockVariables) Delete(ctx context.Context, workspaceID string, variableID string) error

func (*MockVariables) List

func (m *MockVariables) List(ctx context.Context, workspaceID string, options *tfe.VariableListOptions) (*tfe.VariableList, error)

func (*MockVariables) Read

func (m *MockVariables) Read(ctx context.Context, workspaceID string, variableID string) (*tfe.Variable, error)

func (*MockVariables) Update

func (m *MockVariables) Update(ctx context.Context, workspaceID string, variableID string, options tfe.VariableUpdateOptions) (*tfe.Variable, error)

type MockWorkspaces

type MockWorkspaces struct {
	// contains filtered or unexported fields
}

func (*MockWorkspaces) AddRemoteStateConsumers

func (m *MockWorkspaces) AddRemoteStateConsumers(ctx context.Context, workspaceID string, options tfe.WorkspaceAddRemoteStateConsumersOptions) error

func (*MockWorkspaces) AddTags

func (m *MockWorkspaces) AddTags(ctx context.Context, workspaceID string, options tfe.WorkspaceAddTagsOptions) error

func (*MockWorkspaces) AssignSSHKey

func (m *MockWorkspaces) AssignSSHKey(ctx context.Context, workspaceID string, options tfe.WorkspaceAssignSSHKeyOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) Create

func (m *MockWorkspaces) Create(ctx context.Context, organization string, options tfe.WorkspaceCreateOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) Delete

func (m *MockWorkspaces) Delete(ctx context.Context, organization, workspace string) error

func (*MockWorkspaces) DeleteByID

func (m *MockWorkspaces) DeleteByID(ctx context.Context, workspaceID string) error

func (*MockWorkspaces) ForceUnlock

func (m *MockWorkspaces) ForceUnlock(ctx context.Context, workspaceID string) (*tfe.Workspace, error)

func (*MockWorkspaces) List

func (m *MockWorkspaces) List(ctx context.Context, organization string, options *tfe.WorkspaceListOptions) (*tfe.WorkspaceList, error)

func (*MockWorkspaces) ListRemoteStateConsumers

func (m *MockWorkspaces) ListRemoteStateConsumers(ctx context.Context, workspaceID string, options *tfe.RemoteStateConsumersListOptions) (*tfe.WorkspaceList, error)

func (*MockWorkspaces) ListTags

func (m *MockWorkspaces) ListTags(ctx context.Context, workspaceID string, options *tfe.WorkspaceTagListOptions) (*tfe.TagList, error)

func (*MockWorkspaces) Lock

func (m *MockWorkspaces) Lock(ctx context.Context, workspaceID string, options tfe.WorkspaceLockOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) Read

func (m *MockWorkspaces) Read(ctx context.Context, organization, workspace string) (*tfe.Workspace, error)

func (*MockWorkspaces) ReadByID

func (m *MockWorkspaces) ReadByID(ctx context.Context, workspaceID string) (*tfe.Workspace, error)

func (*MockWorkspaces) ReadByIDWithOptions

func (m *MockWorkspaces) ReadByIDWithOptions(ctx context.Context, workspaceID string, options *tfe.WorkspaceReadOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) ReadWithOptions

func (m *MockWorkspaces) ReadWithOptions(ctx context.Context, organization string, workspace string, options *tfe.WorkspaceReadOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) Readme

func (m *MockWorkspaces) Readme(ctx context.Context, workspaceID string) (io.Reader, error)

func (*MockWorkspaces) RemoveRemoteStateConsumers

func (m *MockWorkspaces) RemoveRemoteStateConsumers(ctx context.Context, workspaceID string, options tfe.WorkspaceRemoveRemoteStateConsumersOptions) error

func (*MockWorkspaces) RemoveTags

func (m *MockWorkspaces) RemoveTags(ctx context.Context, workspaceID string, options tfe.WorkspaceRemoveTagsOptions) error

func (*MockWorkspaces) RemoveVCSConnection

func (m *MockWorkspaces) RemoveVCSConnection(ctx context.Context, organization, workspace string) (*tfe.Workspace, error)

func (*MockWorkspaces) RemoveVCSConnectionByID

func (m *MockWorkspaces) RemoveVCSConnectionByID(ctx context.Context, workspaceID string) (*tfe.Workspace, error)

func (*MockWorkspaces) SafeDelete

func (m *MockWorkspaces) SafeDelete(ctx context.Context, organization, workspace string) error

func (*MockWorkspaces) SafeDeleteByID

func (m *MockWorkspaces) SafeDeleteByID(ctx context.Context, workspaceID string) error

func (*MockWorkspaces) UnassignSSHKey

func (m *MockWorkspaces) UnassignSSHKey(ctx context.Context, workspaceID string) (*tfe.Workspace, error)

func (*MockWorkspaces) Unlock

func (m *MockWorkspaces) Unlock(ctx context.Context, workspaceID string) (*tfe.Workspace, error)

func (*MockWorkspaces) Update

func (m *MockWorkspaces) Update(ctx context.Context, organization, workspace string, options tfe.WorkspaceUpdateOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) UpdateByID

func (m *MockWorkspaces) UpdateByID(ctx context.Context, workspaceID string, options tfe.WorkspaceUpdateOptions) (*tfe.Workspace, error)

func (*MockWorkspaces) UpdateRemoteStateConsumers

func (m *MockWorkspaces) UpdateRemoteStateConsumers(ctx context.Context, workspaceID string, options tfe.WorkspaceUpdateRemoteStateConsumersOptions) error

type State

type State struct {
	// contains filtered or unexported fields
}

State implements the State interfaces in the state package to handle reading and writing the remote state to TFC. This State on its own does no local caching so every persist will go to the remote storage and local writes will go to memory.

func (*State) Delete

func (s *State) Delete(force bool) error

Delete the remote state.

func (*State) DisableLocks

func (s *State) DisableLocks()

DisableLocks turns the Lock and Unlock methods into no-ops. This is intended to be called during initialization of a state manager and should not be called after any of the statemgr.Full interface methods have been called.

func (*State) GetRootOutputValues

func (s *State) GetRootOutputValues() (map[string]*states.OutputValue, error)

GetRootOutputValues fetches output values from Terraform Cloud

func (*State) Lock

func (s *State) Lock(info *statemgr.LockInfo) (string, error)

Lock calls the Client's Lock method if it's implemented.

func (*State) PersistState

func (s *State) PersistState(schemas *tofu.Schemas) error

PersistState uploads a snapshot of the latest state as a StateVersion to Terraform Cloud

func (*State) RefreshState

func (s *State) RefreshState() error

statemgr.Refresher impl.

func (*State) ShouldPersistIntermediateState

func (s *State) ShouldPersistIntermediateState(info *local.IntermediateStatePersistInfo) bool

ShouldPersistIntermediateState implements local.IntermediateStateConditionalPersister

func (*State) State

func (s *State) State() *states.State

statemgr.Reader impl.

func (*State) StateForMigration

func (s *State) StateForMigration() *statefile.File

StateForMigration is part of our implementation of statemgr.Migrator.

func (*State) StateSnapshotMeta

func (s *State) StateSnapshotMeta() statemgr.SnapshotMeta

StateSnapshotMeta returns the metadata from the most recently persisted or refreshed persistent state snapshot.

This is an implementation of statemgr.PersistentMeta.

func (*State) Unlock

func (s *State) Unlock(id string) error

Unlock calls the Client's Unlock method if it's implemented.

func (*State) WriteState

func (s *State) WriteState(state *states.State) error

statemgr.Writer impl.

func (*State) WriteStateForMigration

func (s *State) WriteStateForMigration(f *statefile.File, force bool) error

WriteStateForMigration is part of our implementation of statemgr.Migrator.

type Symbol

type Symbol rune
const (
	Tick          Symbol = '\u2713'
	Cross         Symbol = '\u00d7'
	Warning       Symbol = '\u24be'
	Arrow         Symbol = '\u2192'
	DownwardArrow Symbol = '\u21b3'
)

type WorkspaceMapping

type WorkspaceMapping struct {
	Name    string
	Project string
	Tags    []string
}

func (WorkspaceMapping) Strategy

func (wm WorkspaceMapping) Strategy() workspaceStrategy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL