Documentation
¶
Overview ¶
Package tfcmigrate reads what's needed to move a workspace off HCP Terraform or Terraform Enterprise: its current state, its settings, and its variables. It only reads. Nothing in HCP Terraform is changed.
Index ¶
- Variables
- func CIInitFlags(ws *Workspace) []string
- func PipelineEnv(v Variable) string
- func SecretName(v Variable) string
- func WriteReport(w io.Writer, ws *Workspace, vars []Variable, showValues bool)
- type Client
- func (c *Client) CurrentStateVersion(ctx context.Context, workspaceID string) (*StateVersion, error)
- func (c *Client) DownloadState(ctx context.Context, version *StateVersion) ([]byte, error)
- func (c *Client) Variables(ctx context.Context, workspaceID string) ([]Variable, error)
- func (c *Client) Workspace(ctx context.Context, organization, name string) (*Workspace, error)
- type StateVersion
- type Variable
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var ErrNoState = errors.New("the workspace has no state")
ErrNoState means the workspace exists but has never stored any state.
Functions ¶
func CIInitFlags ¶
CIInitFlags suggests "bogform ci init" flags that keep the workspace's behavior.
func PipelineEnv ¶
PipelineEnv says how a pipeline passes a variable to Bogform: Terraform variables through TF_VAR_<name>, and environment variables under their own name.
func SecretName ¶
SecretName suggests the pipeline secret that should hold a variable.
Types ¶
type Client ¶
type Client struct {
// BaseURL is the API's root, such as https://app.terraform.io/api/v2.
BaseURL string
// Token is the API token. It's sent only to BaseURL's host.
Token string
// HTTP is the client used for requests. A default with a timeout is used if it's nil.
HTTP *http.Client
}
Client talks to the HCP Terraform API (v2) of one host.
func (*Client) CurrentStateVersion ¶
func (c *Client) CurrentStateVersion(ctx context.Context, workspaceID string) (*StateVersion, error)
CurrentStateVersion describes the workspace's latest state. It returns ErrNoState if there's none.
func (*Client) DownloadState ¶
DownloadState returns the raw state file of a state version.
type StateVersion ¶
StateVersion describes a state version without its contents.
type Variable ¶
type Variable struct {
Key string
Value string
Category string // "terraform" or "env"
HCL bool
Sensitive bool
}
Variable is a workspace variable. Value is always "" for sensitive variables, which the API doesn't return.
type Workspace ¶
type Workspace struct {
ID string
Name string
TerraformVersion string
WorkingDirectory string
ExecutionMode string
AutoApply bool
// VCSRepository is the connected repository, such as "bogware/example", or "" if there's none.
VCSRepository string
// VCSBranch is the branch runs come from. "" means the repository's default branch.
VCSBranch string
}
Workspace is what matters about a workspace when moving it.