provider
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- Variables
- func ExternalAuthAccessTokenEnvironmentVariable(id string) string
- func IsPrebuildClaimEnvironmentVariable() string
- func IsPrebuildEnvironmentVariable() string
- func New() *schema.Provider
- func ParameterEnvironmentVariable(name string) string
- func ParameterEnvironmentVariablePrevious(name string) string
- func RunningAgentTokenEnvironmentVariable(agentID string) string
- func ValidateFormType(paramType OptionType, optionCount int, specifiedFormType ParameterFormType) (OptionType, ParameterFormType, error)
- type ExpirationPolicy
- type Option
- type OptionType
- type Parameter
- type ParameterFormType
- type Validation
- type WorkspacePrebuild
- type WorkspacePreset
- type WorkspaceTags
Constants¶
const (ValidationMonotonicIncreasing = "increasing"ValidationMonotonicDecreasing = "decreasing")
Variables¶
var ScriptCRONParser = cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.DowOptional | cron.Descriptor)
Functions¶
funcIsPrebuildClaimEnvironmentVariable¶added inv2.4.1
func IsPrebuildClaimEnvironmentVariable()string
IsPrebuildClaimEnvironmentVariable returns the name of the environment variable thatindicates whether the workspace is a prebuilt workspace which has just been claimed, and this is the first Terraformapply after that occurrence.
Knowing whether the workspace is a claimed prebuilt workspace allows templateauthors to conditionally execute code in the template based on whether the workspacehas been assigned to a user or not. This allows identity specific configuration tobe applied only after the workspace is claimed, while the rest of the workspace canbe pre-configured.
The value of this environment variable should be set to "true" if the workspace is prebuiltand it has just been claimed by a user. Any other values, including "false"and "" will be interpreted to mean that the workspace is not prebuilt, or wasprebuilt but has not been claimed by a user.
funcIsPrebuildEnvironmentVariable¶added inv2.4.0
func IsPrebuildEnvironmentVariable()string
IsPrebuildEnvironmentVariable returns the name of the environment variable thatindicates whether the workspace is an unclaimed prebuilt workspace.
Knowing whether the workspace is an unclaimed prebuilt workspace allows templateauthors to conditionally execute code in the template based on whether the workspacehas been assigned to a user or not. This allows identity specific configuration tobe applied only after the workspace is claimed, while the rest of the workspace canbe pre-configured.
The value of this environment variable should be set to "true" if the workspace is prebuiltand it has not yet been claimed by a user. Any other values, including "false"and "" will be interpreted to mean that the workspace is not prebuilt, or wasprebuilt but has since been claimed by a user.
funcParameterEnvironmentVariable¶
ParameterEnvironmentVariable returns the environment variable to specify fora parameter by it's name. It's hashed because spaces and special characterscan be used in parameter names that may not be valid in env vars.
funcParameterEnvironmentVariablePrevious¶added inv2.4.0
ParameterEnvironmentVariablePrevious returns the environment variable tospecify for a parameter's previous value. This is used for workspacesubsequent builds after the first. Primarily to validate monotonicity in the`validation` block.
funcRunningAgentTokenEnvironmentVariable¶added inv2.4.0
RunningAgentTokenEnvironmentVariable returns the name of an environment variablethat contains the token to use for the running agent. This is used for prebuilds,where we want to reuse the same token for the next iteration of a workspace agentbefore and after the workspace was claimed by a user.
By reusing an existing token, we can avoid the need to change a value that may have beenused immutably. Thus, allowing us to avoid reprovisioning resources that may take a long timeto replace.
agentID is unused for now, but will be used as soon as we support multiple agents.
funcValidateFormType¶added inv2.4.0
func ValidateFormType(paramTypeOptionType, optionCountint, specifiedFormTypeParameterFormType) (OptionType,ParameterFormType,error)
ValidateFormType handles the truth table for the valid set of `type` and`form_type` options.The OptionType is also returned because it is possible the 'type' of the'value' & 'default' fields is different from the 'type' of the options.The use case is when using multi-select. The options are 'string' and thevalue is 'list(string)'.
Types¶
typeExpirationPolicy¶added inv2.5.0
type ExpirationPolicy struct {TTLint `mapstructure:"ttl"`}
typeOptionType¶added inv2.4.0
type OptionType =string
OptionType is a type of option that can be used in the 'type' argument ofa parameter. These should match types as defined in terraform:
https://developer.hashicorp.com/terraform/language/expressions/types
The value have to be string literals, as type constraint keywords are notsupported in providers.
const (OptionTypeStringOptionType = "string"OptionTypeNumberOptionType = "number"OptionTypeBooleanOptionType = "bool"OptionTypeListStringOptionType = "list(string)")
funcOptionTypes¶added inv2.4.0
func OptionTypes() []OptionType
typeParameter¶
type Parameter struct {NamestringDisplayNamestring `mapstructure:"display_name"`DescriptionstringTypeOptionTypeFormTypeParameterFormType `mapstructure:"form_type"`MutableboolDefault *stringIconstringOption []OptionValidation []ValidationOptionalboolOrderintEphemeralbool}
func (*Parameter)ValidOptions¶added inv2.4.0
func (v *Parameter) ValidOptions(optionTypeOptionType) (map[string]struct{},diag.Diagnostics)
func (*Parameter)ValidateInput¶added inv2.4.0
typeParameterFormType¶added inv2.4.0
type ParameterFormTypestring
ParameterFormType is the list of supported form types for display inthe Coder "create workspace" form. These form types are functional as wellas cosmetic. Refer to `formTypeTruthTable` for the allowed pairings.For example, "multi-select" has the type "list(string)" but the optionvalues are "string".
const (ParameterFormTypeDefaultParameterFormType = ""ParameterFormTypeRadioParameterFormType = "radio"ParameterFormTypeSliderParameterFormType = "slider"ParameterFormTypeInputParameterFormType = "input"ParameterFormTypeDropdownParameterFormType = "dropdown"ParameterFormTypeCheckboxParameterFormType = "checkbox"ParameterFormTypeSwitchParameterFormType = "switch"ParameterFormTypeMultiSelectParameterFormType = "multi-select"ParameterFormTypeTagSelectParameterFormType = "tag-select"ParameterFormTypeTextAreaParameterFormType = "textarea"ParameterFormTypeErrorParameterFormType = "error")
funcParameterFormTypes¶added inv2.4.0
func ParameterFormTypes() []ParameterFormType
ParameterFormTypes should be kept in sync with the enum list above.
typeValidation¶
type Validation struct {MinintMinDisabledbool `mapstructure:"min_disabled"`MaxintMaxDisabledbool `mapstructure:"max_disabled"`MonotonicstringRegexstringErrorstring}
func (*Validation)Valid¶
func (v *Validation) Valid(typOptionType, valuestring, previous *string)error
typeWorkspacePrebuild¶added inv2.4.0
type WorkspacePrebuild struct {Instancesint `mapstructure:"instances"`// There should always be only one expiration_policy block, but Terraform's type system// still parses them as a slice, so we need to handle it as such. We could use// an anonymous type and rd.Get to avoid a slice here, but that would not be possible// for utilities that parse our terraform output using this type. To remain compatible// with those cases, we use a slice here.ExpirationPolicy []ExpirationPolicy `mapstructure:"expiration_policy"`}
typeWorkspacePreset¶added inv2.1.3
type WorkspacePreset struct {Namestring `mapstructure:"name"`Parameters map[string]string `mapstructure:"parameters"`// There should always be only one prebuild block, but Terraform's type system// still parses them as a slice, so we need to handle it as such. We could use// an anonymous type and rd.Get to avoid a slice here, but that would not be possible// for utilities that parse our terraform output using this type. To remain compatible// with those cases, we use a slice here.Prebuilds []WorkspacePrebuild `mapstructure:"prebuilds"`}