Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateID(s string) string
- func ParseCloudRunVariables(vv map[string]backend.UnparsedVariableValue, ...) (map[string]string, tfdiags.Diagnostics)
- type Cloud
- func (b *Cloud) CLIInit(opts *backend.CLIOpts) error
- func (b *Cloud) Colorize() Colorer
- func (b *Cloud) ConfigSchema() *configschema.Block
- func (b *Cloud) Configure(obj cty.Value) tfdiags.Diagnostics
- func (b *Cloud) DeleteWorkspace(name string, force bool) error
- func (b *Cloud) IgnoreVersionConflict()
- func (b *Cloud) IsLocalOperations() bool
- func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics)
- func (b *Cloud) Operation(ctx context.Context, op *backend.Operation) (*backend.RunningOperation, error)
- func (b *Cloud) PrepareConfig(obj cty.Value) (cty.Value, tfdiags.Diagnostics)
- func (b *Cloud) StateMgr(name string) (statemgr.Full, error)
- func (b *Cloud) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.Diagnostics
- func (b *Cloud) Workspaces() ([]string, error)
- type Colorer
- type Colorize
- type ConfigChangeMode
- type IntegrationContext
- type IntegrationOutputWriter
- type MockApplies
- type MockClient
- type MockConfigurationVersions
- func (m *MockConfigurationVersions) Archive(ctx context.Context, cvID string) error
- func (m *MockConfigurationVersions) Create(ctx context.Context, workspaceID string, ...) (*tfe.ConfigurationVersion, error)
- func (m *MockConfigurationVersions) Download(ctx context.Context, cvID string) ([]byte, error)
- func (m *MockConfigurationVersions) List(ctx context.Context, workspaceID string, ...) (*tfe.ConfigurationVersionList, error)
- func (m *MockConfigurationVersions) Read(ctx context.Context, cvID string) (*tfe.ConfigurationVersion, error)
- func (m *MockConfigurationVersions) ReadWithOptions(ctx context.Context, cvID string, options *tfe.ConfigurationVersionReadOptions) (*tfe.ConfigurationVersion, error)
- func (m *MockConfigurationVersions) Upload(ctx context.Context, url, path string) error
- func (m *MockConfigurationVersions) UploadTarGzip(ctx context.Context, url string, archive io.Reader) error
- type MockCostEstimates
- type MockOrganizations
- func (m *MockOrganizations) Create(ctx context.Context, options tfe.OrganizationCreateOptions) (*tfe.Organization, error)
- func (m *MockOrganizations) Delete(ctx context.Context, name string) error
- func (m *MockOrganizations) List(ctx context.Context, options *tfe.OrganizationListOptions) (*tfe.OrganizationList, error)
- func (m *MockOrganizations) Read(ctx context.Context, name string) (*tfe.Organization, error)
- func (m *MockOrganizations) ReadCapacity(ctx context.Context, name string) (*tfe.Capacity, error)
- func (m *MockOrganizations) ReadEntitlements(ctx context.Context, name string) (*tfe.Entitlements, error)
- func (m *MockOrganizations) ReadRunQueue(ctx context.Context, name string, options tfe.ReadRunQueueOptions) (*tfe.RunQueue, error)
- func (m *MockOrganizations) ReadWithOptions(ctx context.Context, name string, options tfe.OrganizationReadOptions) (*tfe.Organization, error)
- func (m *MockOrganizations) Update(ctx context.Context, name string, options tfe.OrganizationUpdateOptions) (*tfe.Organization, error)
- type MockPlans
- type MockPolicyChecks
- func (m *MockPolicyChecks) List(ctx context.Context, runID string, options *tfe.PolicyCheckListOptions) (*tfe.PolicyCheckList, error)
- func (m *MockPolicyChecks) Logs(ctx context.Context, policyCheckID string) (io.Reader, error)
- func (m *MockPolicyChecks) Override(ctx context.Context, policyCheckID string) (*tfe.PolicyCheck, error)
- func (m *MockPolicyChecks) Read(ctx context.Context, policyCheckID string) (*tfe.PolicyCheck, error)
- type MockPolicySetOutcomes
- type MockRedactedPlans
- type MockRunEvents
- func (m *MockRunEvents) List(ctx context.Context, runID string, options *tfe.RunEventListOptions) (*tfe.RunEventList, error)
- func (m *MockRunEvents) Read(ctx context.Context, runEventID string) (*tfe.RunEvent, error)
- func (m *MockRunEvents) ReadWithOptions(ctx context.Context, runEventID string, options *tfe.RunEventReadOptions) (*tfe.RunEvent, error)
- type MockRuns
- func (m *MockRuns) Apply(ctx context.Context, runID string, options tfe.RunApplyOptions) error
- func (m *MockRuns) Cancel(ctx context.Context, runID string, options tfe.RunCancelOptions) error
- func (m *MockRuns) Create(ctx context.Context, options tfe.RunCreateOptions) (*tfe.Run, error)
- func (m *MockRuns) Discard(ctx context.Context, runID string, options tfe.RunDiscardOptions) error
- func (m *MockRuns) ForceCancel(ctx context.Context, runID string, options tfe.RunForceCancelOptions) error
- func (m *MockRuns) ForceExecute(ctx context.Context, runID string) error
- func (m *MockRuns) List(ctx context.Context, workspaceID string, options *tfe.RunListOptions) (*tfe.RunList, error)
- func (m *MockRuns) Read(ctx context.Context, runID string) (*tfe.Run, error)
- func (m *MockRuns) ReadWithOptions(ctx context.Context, runID string, _ *tfe.RunReadOptions) (*tfe.Run, error)
- type MockStateVersionOutputs
- type MockStateVersions
- func (m *MockStateVersions) Create(ctx context.Context, workspaceID string, options tfe.StateVersionCreateOptions) (*tfe.StateVersion, error)
- func (m *MockStateVersions) Download(ctx context.Context, url string) ([]byte, error)
- func (m *MockStateVersions) List(ctx context.Context, options *tfe.StateVersionListOptions) (*tfe.StateVersionList, error)
- func (m *MockStateVersions) ListOutputs(ctx context.Context, svID string, options *tfe.StateVersionOutputsListOptions) (*tfe.StateVersionOutputsList, error)
- func (m *MockStateVersions) Read(ctx context.Context, svID string) (*tfe.StateVersion, error)
- func (m *MockStateVersions) ReadCurrent(ctx context.Context, workspaceID string) (*tfe.StateVersion, error)
- func (m *MockStateVersions) ReadCurrentWithOptions(ctx context.Context, workspaceID string, ...) (*tfe.StateVersion, error)
- func (m *MockStateVersions) ReadWithOptions(ctx context.Context, svID string, options *tfe.StateVersionReadOptions) (*tfe.StateVersion, error)
- type MockTaskStages
- func (m *MockTaskStages) List(ctx context.Context, runID string, options *tfe.TaskStageListOptions) (*tfe.TaskStageList, error)
- func (m *MockTaskStages) Override(ctx context.Context, taskStageID string, options tfe.TaskStageOverrideOptions) (*tfe.TaskStage, error)
- func (m *MockTaskStages) Read(ctx context.Context, taskStageID string, options *tfe.TaskStageReadOptions) (*tfe.TaskStage, error)
- type MockVariables
- func (m *MockVariables) Create(ctx context.Context, workspaceID string, options tfe.VariableCreateOptions) (*tfe.Variable, error)
- func (m *MockVariables) Delete(ctx context.Context, workspaceID string, variableID string) error
- func (m *MockVariables) List(ctx context.Context, workspaceID string, options *tfe.VariableListOptions) (*tfe.VariableList, error)
- func (m *MockVariables) Read(ctx context.Context, workspaceID string, variableID string) (*tfe.Variable, error)
- func (m *MockVariables) Update(ctx context.Context, workspaceID string, variableID string, ...) (*tfe.Variable, error)
- type MockWorkspaces
- func (m *MockWorkspaces) AddRemoteStateConsumers(ctx context.Context, workspaceID string, ...) error
- func (m *MockWorkspaces) AddTags(ctx context.Context, workspaceID string, options tfe.WorkspaceAddTagsOptions) error
- func (m *MockWorkspaces) AssignSSHKey(ctx context.Context, workspaceID string, ...) (*tfe.Workspace, error)
- func (m *MockWorkspaces) Create(ctx context.Context, organization string, options tfe.WorkspaceCreateOptions) (*tfe.Workspace, error)
- func (m *MockWorkspaces) Delete(ctx context.Context, organization, workspace string) error
- func (m *MockWorkspaces) DeleteByID(ctx context.Context, workspaceID string) error
- func (m *MockWorkspaces) ForceUnlock(ctx context.Context, workspaceID string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) List(ctx context.Context, organization string, options *tfe.WorkspaceListOptions) (*tfe.WorkspaceList, error)
- func (m *MockWorkspaces) ListRemoteStateConsumers(ctx context.Context, workspaceID string, ...) (*tfe.WorkspaceList, error)
- func (m *MockWorkspaces) ListTags(ctx context.Context, workspaceID string, options *tfe.WorkspaceTagListOptions) (*tfe.TagList, error)
- func (m *MockWorkspaces) Lock(ctx context.Context, workspaceID string, options tfe.WorkspaceLockOptions) (*tfe.Workspace, error)
- func (m *MockWorkspaces) Read(ctx context.Context, organization, workspace string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) ReadByID(ctx context.Context, workspaceID string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) ReadByIDWithOptions(ctx context.Context, workspaceID string, options *tfe.WorkspaceReadOptions) (*tfe.Workspace, error)
- func (m *MockWorkspaces) ReadWithOptions(ctx context.Context, organization string, workspace string, ...) (*tfe.Workspace, error)
- func (m *MockWorkspaces) Readme(ctx context.Context, workspaceID string) (io.Reader, error)
- func (m *MockWorkspaces) RemoveRemoteStateConsumers(ctx context.Context, workspaceID string, ...) error
- func (m *MockWorkspaces) RemoveTags(ctx context.Context, workspaceID string, ...) error
- func (m *MockWorkspaces) RemoveVCSConnection(ctx context.Context, organization, workspace string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) RemoveVCSConnectionByID(ctx context.Context, workspaceID string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) SafeDelete(ctx context.Context, organization, workspace string) error
- func (m *MockWorkspaces) SafeDeleteByID(ctx context.Context, workspaceID string) error
- func (m *MockWorkspaces) UnassignSSHKey(ctx context.Context, workspaceID string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) Unlock(ctx context.Context, workspaceID string) (*tfe.Workspace, error)
- func (m *MockWorkspaces) Update(ctx context.Context, organization, workspace string, ...) (*tfe.Workspace, error)
- func (m *MockWorkspaces) UpdateByID(ctx context.Context, workspaceID string, options tfe.WorkspaceUpdateOptions) (*tfe.Workspace, error)
- func (m *MockWorkspaces) UpdateRemoteStateConsumers(ctx context.Context, workspaceID string, ...) error
- type State
- func (s *State) Delete(force bool) error
- func (s *State) DisableLocks()
- func (s *State) GetRootOutputValues() (map[string]*states.OutputValue, error)
- func (s *State) Lock(info *statemgr.LockInfo) (string, error)
- func (s *State) PersistState(schemas *terraform.Schemas) error
- func (s *State) RefreshState() error
- func (s *State) State() *states.State
- func (s *State) StateForMigration() *statefile.File
- func (s *State) StateSnapshotMeta() statemgr.SnapshotMeta
- func (s *State) Unlock(id string) error
- func (s *State) WriteState(state *states.State) error
- func (s *State) WriteStateForMigration(f *statefile.File, force bool) error
- type Symbol
- type WorkspaceMapping
Constants ¶
const ( WorkspaceTagsStrategy workspaceStrategy = "tags" WorkspaceNameStrategy workspaceStrategy = "name" WorkspaceNoneStrategy workspaceStrategy = "none" WorkspaceInvalidStrategy workspaceStrategy = "invalid" )
Variables ¶
You are not authorized to read the full state version containing outputs.
State versions created by terraform 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 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 Terraform context. Many of these will be overridden or merged by // Operation. See Operation for more details. ContextOpts *terraform.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 Terraform Cloud/Enterprise integration for Terraform CLI. This backend is not intended to be surfaced at the user level and is instead an implementation detail of cloud.Cloud.
func (*Cloud) Colorize ¶
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 ¶
DeleteWorkspace implements backend.Enhanced.
func (*Cloud) IgnoreVersionConflict ¶
func (b *Cloud) IgnoreVersionConflict()
IgnoreVersionConflict allows commands to disable the fall-back check that the local Terraform version matches the remote workspace's configured Terraform 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 (*Cloud) LocalRun ¶
func (b *Cloud) LocalRun(op *backend.Operation) (*backend.LocalRun, statemgr.Full, tfdiags.Diagnostics)
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 ¶
PrepareConfig implements backend.Backend.
func (*Cloud) VerifyWorkspaceTerraformVersion ¶
func (b *Cloud) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.Diagnostics
VerifyWorkspaceTerraformVersion compares the local Terraform version against the workspace's configured Terraform 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 ¶
Workspaces implements backend.Enhanced, returning a filtered list of workspace names according to the workspace mapping strategy configured.
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.
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 ¶ added in v1.1.9
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 ¶ added in v1.1.9
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
type IntegrationOutputWriter ¶ added in v1.1.9
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
}
type MockClient ¶
type MockClient struct { Applies *MockApplies ConfigurationVersions *MockConfigurationVersions CostEstimates *MockCostEstimates Organizations *MockOrganizations Plans *MockPlans PolicySetOutcomes *MockPolicySetOutcomes TaskStages *MockTaskStages RedactedPlans *MockRedactedPlans PolicyChecks *MockPolicyChecks 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 ¶ added in v1.2.0
func (m *MockConfigurationVersions) Archive(ctx context.Context, cvID string) error
func (*MockConfigurationVersions) Create ¶
func (m *MockConfigurationVersions) Create(ctx context.Context, workspaceID string, options tfe.ConfigurationVersionCreateOptions) (*tfe.ConfigurationVersion, error)
func (*MockConfigurationVersions) List ¶
func (m *MockConfigurationVersions) List(ctx context.Context, workspaceID string, options *tfe.ConfigurationVersionListOptions) (*tfe.ConfigurationVersionList, error)
func (*MockConfigurationVersions) Read ¶
func (m *MockConfigurationVersions) Read(ctx context.Context, cvID string) (*tfe.ConfigurationVersion, error)
func (*MockConfigurationVersions) ReadWithOptions ¶
func (m *MockConfigurationVersions) ReadWithOptions(ctx context.Context, cvID string, options *tfe.ConfigurationVersionReadOptions) (*tfe.ConfigurationVersion, error)
func (*MockConfigurationVersions) Upload ¶
func (m *MockConfigurationVersions) Upload(ctx context.Context, url, path string) error
func (*MockConfigurationVersions) UploadTarGzip ¶ added in v1.4.0
type MockCostEstimates ¶
type MockCostEstimates struct { Estimations map[string]*tfe.CostEstimate // contains filtered or unexported fields }
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 (m *MockOrganizations) Create(ctx context.Context, options tfe.OrganizationCreateOptions) (*tfe.Organization, error)
func (*MockOrganizations) Delete ¶
func (m *MockOrganizations) Delete(ctx context.Context, name string) error
func (*MockOrganizations) List ¶
func (m *MockOrganizations) List(ctx context.Context, options *tfe.OrganizationListOptions) (*tfe.OrganizationList, error)
func (*MockOrganizations) Read ¶
func (m *MockOrganizations) Read(ctx context.Context, name string) (*tfe.Organization, error)
func (*MockOrganizations) ReadCapacity ¶ added in v1.2.0
func (*MockOrganizations) ReadEntitlements ¶ added in v1.2.0
func (m *MockOrganizations) ReadEntitlements(ctx context.Context, name string) (*tfe.Entitlements, error)
func (*MockOrganizations) ReadRunQueue ¶ added in v1.2.0
func (m *MockOrganizations) ReadRunQueue(ctx context.Context, name string, options tfe.ReadRunQueueOptions) (*tfe.RunQueue, error)
func (*MockOrganizations) ReadWithOptions ¶ added in v1.4.0
func (m *MockOrganizations) ReadWithOptions(ctx context.Context, name string, options tfe.OrganizationReadOptions) (*tfe.Organization, error)
func (*MockOrganizations) Update ¶
func (m *MockOrganizations) Update(ctx context.Context, name string, options tfe.OrganizationUpdateOptions) (*tfe.Organization, error)
type MockPlans ¶
type MockPlans struct {
// contains filtered or unexported fields
}
type MockPolicyChecks ¶
type MockPolicyChecks struct {
// contains filtered or unexported fields
}
func (*MockPolicyChecks) List ¶
func (m *MockPolicyChecks) List(ctx context.Context, runID string, options *tfe.PolicyCheckListOptions) (*tfe.PolicyCheckList, 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 ¶ added in v1.4.0
type MockPolicySetOutcomes struct {
// contains filtered or unexported fields
}
func (*MockPolicySetOutcomes) List ¶ added in v1.4.0
func (m *MockPolicySetOutcomes) List(ctx context.Context, policyEvaluationID string, options *tfe.PolicySetOutcomeListOptions) (*tfe.PolicySetOutcomeList, error)
func (*MockPolicySetOutcomes) Read ¶ added in v1.4.0
func (m *MockPolicySetOutcomes) Read(ctx context.Context, policySetOutcomeID string) (*tfe.PolicySetOutcome, error)
type MockRedactedPlans ¶ added in v1.4.0
type MockRedactedPlans struct {
// contains filtered or unexported fields
}
func (*MockRedactedPlans) Read ¶ added in v1.4.0
func (m *MockRedactedPlans) Read(ctx context.Context, hostname, token, planID string) (*jsonformat.Plan, error)
type MockRunEvents ¶ added in v1.5.0
type MockRunEvents struct{}
func (*MockRunEvents) List ¶ added in v1.5.0
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) ReadWithOptions ¶ added in v1.5.0
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) ForceCancel ¶
func (*MockRuns) ForceExecute ¶ added in v1.4.0
type MockStateVersionOutputs ¶ added in v1.3.0
type MockStateVersionOutputs struct {
// contains filtered or unexported fields
}
func (*MockStateVersionOutputs) Read ¶ added in v1.3.0
func (m *MockStateVersionOutputs) Read(ctx context.Context, outputID string) (*tfe.StateVersionOutput, error)
func (*MockStateVersionOutputs) ReadCurrent ¶ added in v1.3.0
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) List ¶
func (m *MockStateVersions) List(ctx context.Context, options *tfe.StateVersionListOptions) (*tfe.StateVersionList, error)
func (*MockStateVersions) ListOutputs ¶ added in v1.2.0
func (m *MockStateVersions) ListOutputs(ctx context.Context, svID string, options *tfe.StateVersionOutputsListOptions) (*tfe.StateVersionOutputsList, error)
func (*MockStateVersions) Read ¶
func (m *MockStateVersions) Read(ctx context.Context, svID string) (*tfe.StateVersion, error)
func (*MockStateVersions) ReadCurrent ¶ added in v1.2.0
func (m *MockStateVersions) ReadCurrent(ctx context.Context, workspaceID string) (*tfe.StateVersion, error)
func (*MockStateVersions) ReadCurrentWithOptions ¶ added in v1.2.0
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)
type MockTaskStages ¶ added in v1.4.0
type MockTaskStages struct {
// contains filtered or unexported fields
}
func (*MockTaskStages) List ¶ added in v1.4.0
func (m *MockTaskStages) List(ctx context.Context, runID string, options *tfe.TaskStageListOptions) (*tfe.TaskStageList, 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) List ¶
func (m *MockVariables) List(ctx context.Context, workspaceID string, options *tfe.VariableListOptions) (*tfe.VariableList, 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 (*MockWorkspaces) List ¶
func (m *MockWorkspaces) List(ctx context.Context, organization string, options *tfe.WorkspaceListOptions) (*tfe.WorkspaceList, error)
func (*MockWorkspaces) ListRemoteStateConsumers ¶ added in v1.2.0
func (m *MockWorkspaces) ListRemoteStateConsumers(ctx context.Context, workspaceID string, options *tfe.RemoteStateConsumersListOptions) (*tfe.WorkspaceList, error)
func (*MockWorkspaces) ListTags ¶ added in v1.2.0
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) 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) 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 (*MockWorkspaces) RemoveVCSConnectionByID ¶
func (*MockWorkspaces) SafeDelete ¶ added in v1.4.0
func (m *MockWorkspaces) SafeDelete(ctx context.Context, organization, workspace string) error
func (*MockWorkspaces) SafeDeleteByID ¶ added in v1.4.0
func (m *MockWorkspaces) SafeDeleteByID(ctx context.Context, workspaceID string) error
func (*MockWorkspaces) UnassignSSHKey ¶
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 ¶ added in v1.3.0
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) DisableLocks ¶ added in v1.3.0
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 ¶ added in v1.3.0
func (s *State) GetRootOutputValues() (map[string]*states.OutputValue, error)
GetRootOutputValues fetches output values from Terraform Cloud
func (*State) PersistState ¶ added in v1.3.0
PersistState uploads a snapshot of the latest state as a StateVersion to Terraform Cloud
func (*State) RefreshState ¶ added in v1.3.0
statemgr.Refresher impl.
func (*State) StateForMigration ¶ added in v1.3.0
StateForMigration is part of our implementation of statemgr.Migrator.
func (*State) StateSnapshotMeta ¶ added in v1.3.0
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) WriteState ¶ added in v1.3.0
statemgr.Writer impl.
type WorkspaceMapping ¶
func (WorkspaceMapping) Strategy ¶
func (wm WorkspaceMapping) Strategy() workspaceStrategy
Source Files ¶
- backend.go
- backend_apply.go
- backend_cli.go
- backend_colorize.go
- backend_common.go
- backend_context.go
- backend_plan.go
- backend_run_warning.go
- backend_taskStage_policyEvaluation.go
- backend_taskStage_taskResults.go
- backend_taskStages.go
- cloud_integration.go
- cloud_variables.go
- configchangemode_string.go
- errors.go
- migration.go
- state.go
- testing.go
- tfe_client_mock.go