Documentation
¶
Overview ¶
Package variable manages terraform workspace variables
Index ¶
- Constants
- Variables
- func WriteTerraformVars(dir string, vars []*Variable) error
- type Client
- type CreateVariableOptions
- type CreateVariableSetOptions
- type Options
- type Service
- func (s *Service) AddHandlers(r *mux.Router)
- func (s *Service) CreateWorkspaceVariable(ctx context.Context, workspaceID string, opts CreateVariableOptions) (*Variable, error)
- func (s *Service) DeleteWorkspaceVariable(ctx context.Context, variableID string) (*WorkspaceVariable, error)
- func (s *Service) GetWorkspaceVariable(ctx context.Context, variableID string) (*WorkspaceVariable, error)
- func (s *Service) ListEffectiveVariables(ctx context.Context, runID string) ([]*Variable, error)
- func (s *Service) ListWorkspaceVariables(ctx context.Context, workspaceID string) ([]*Variable, error)
- func (s *Service) UpdateWorkspaceVariable(ctx context.Context, variableID string, opts UpdateVariableOptions) (*WorkspaceVariable, error)
- type UpdateVariableOptions
- type UpdateVariableSetOptions
- type Variable
- type VariableCategory
- type VariableSet
- type WorkspaceVariable
Constants ¶
View Source
const ( // https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables/managing-variables#character-limits VariableDescriptionMaxChars = 512 VariableKeyMaxChars = 128 VariableValueMaxKB = 256 // 256*1024 bytes )
Variables ¶
View Source
var ( ErrVariableDescriptionMaxExceeded = fmt.Errorf("maximum variable description size (%d chars) exceeded", VariableDescriptionMaxChars) ErrVariableKeyMaxExceeded = fmt.Errorf("maximum variable key size (%d chars) exceeded", VariableKeyMaxChars) ErrVariableValueMaxExceeded = fmt.Errorf("maximum variable value size of %d KB exceeded", VariableValueMaxKB) ErrVariableConflict = errors.New("variable conflicts with another variable with the same name and type") )
Functions ¶
func WriteTerraformVars ¶
WriteTerraformVars writes workspace variables to a file named terraform.tfvars located in the given path. If the file already exists it'll be appended to.
Types ¶
type CreateVariableOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AddHandlers ¶
func (*Service) CreateWorkspaceVariable ¶
func (*Service) DeleteWorkspaceVariable ¶
func (*Service) GetWorkspaceVariable ¶
func (*Service) ListEffectiveVariables ¶
func (*Service) ListWorkspaceVariables ¶
func (*Service) UpdateWorkspaceVariable ¶
func (s *Service) UpdateWorkspaceVariable(ctx context.Context, variableID string, opts UpdateVariableOptions) (*WorkspaceVariable, error)
type UpdateVariableOptions ¶
type Variable ¶
type Variable struct {
ID string `jsonapi:"primary,variables"`
Key string `jsonapi:"attribute" json:"key"`
Value string `jsonapi:"attribute" json:"value"`
Description string `jsonapi:"attribute" json:"description"`
Category VariableCategory `jsonapi:"attribute" json:"category"`
Sensitive bool `jsonapi:"attribute" json:"sensitive"`
HCL bool `jsonapi:"attribute" json:"hcl"`
// OTF doesn't use this internally but the go-tfe integration tests
// expect it to be a random value that changes on every update.
VersionID string
}
type VariableCategory ¶
type VariableCategory string
VariableCategory is the category of variable
const ( CategoryTerraform VariableCategory = "terraform" CategoryEnv VariableCategory = "env" )
func VariableCategoryPtr ¶
func VariableCategoryPtr(v VariableCategory) *VariableCategory
VariableCategoryPtr returns a pointer to the given category type.
type VariableSet ¶
type VariableSet struct {
ID string
Name string
Description string
Global bool
Workspaces []string // workspace IDs
Organization string // org name
Variables []*Variable
}
VariableSet is a set of variables
func (*VariableSet) LogValue ¶
func (s *VariableSet) LogValue() slog.Value
type WorkspaceVariable ¶
Click to show internal directories.
Click to hide internal directories.