dynamicparameters

package
v2.38.8 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 26 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateVersionNotReady = xerrors.New("template version job not finished")

Functions

func DiagnosticErrorString added in v2.25.0

func DiagnosticErrorString(d *hcl.Diagnostic) string

func DiagnosticsErrorString added in v2.25.0

func DiagnosticsErrorString(d hcl.Diagnostics) string

func PreviewOptions

func PreviewOptions(dv *codersdk.DeploymentValues) []preview.Option

PreviewOptions returns the preview options implied by the deployment configuration. A nil configuration yields preview's defaults.

func ProvisionerVersionSupportsDynamicParameters

func ProvisionerVersionSupportsDynamicParameters(version string) bool

func ResolveParameters

func ResolveParameters(
	ctx context.Context,
	ownerID uuid.UUID,
	renderer Renderer,
	firstBuild bool,
	transition database.WorkspaceTransition,
	previousValues []database.WorkspaceBuildParameter,
	buildValues []codersdk.WorkspaceBuildParameter,
	presetValues []database.TemplateVersionPresetParameter,
) (map[string]string, error)

ResolveParameters determines the parameter values to store for a build. The transition is required because only a start build may narrow the set of stored values.

func VariableValues added in v2.25.0

func VariableValues(vals []database.TemplateVersionVariable) (map[string]cty.Value, error)

VariableValues is a helper function that converts a slice of TemplateVersionVariable into a map of cty.Value for use in coder/preview.

func WithPreviewOptions

func WithPreviewOptions(opts ...preview.Option) func(r *loader)

WithPreviewOptions passes options through to preview.Preview. See PreviewOptions for the options implied by the deployment configuration.

func WithProvisionerJob

func WithProvisionerJob(job database.ProvisionerJob) func(r *loader)

func WithTemplateVariableValues added in v2.25.0

func WithTemplateVariableValues(vals []database.TemplateVersionVariable) func(r *loader)

func WithTemplateVersion

func WithTemplateVersion(tv database.TemplateVersion) func(r *loader)

func WithTerraformValues

func WithTerraformValues(values database.TemplateVersionTerraformValue) func(r *loader)

func WorkspaceOwner added in v2.25.0

func WorkspaceOwner(ctx context.Context, db database.Store, org uuid.UUID, ownerID uuid.UUID) (*previewtypes.WorkspaceOwner, error)

Types

type DiagnosticError added in v2.25.0

type DiagnosticError struct {
	// Message is the human-readable message that will be returned to the user.
	Message string
	// Diagnostics are top level diagnostics that will be returned as "Detail" in the response.
	Diagnostics hcl.Diagnostics
	// KeyedDiagnostics translate to Validation errors in the response. A key could
	// be a parameter name, or a tag name. This allows diagnostics to be more closely
	// associated with a specific index/parameter/tag.
	KeyedDiagnostics map[string]hcl.Diagnostics
}

func CheckPresets added in v2.25.0

func CheckPresets(output *preview.Output, diags hcl.Diagnostics) *DiagnosticError

CheckPresets extracts the preset related diagnostics from a template version preset

func CheckTags added in v2.25.0

func CheckTags(output *preview.Output, diags hcl.Diagnostics) *DiagnosticError

func (*DiagnosticError) Append added in v2.25.0

func (e *DiagnosticError) Append(key string, diag *hcl.Diagnostic)

func (*DiagnosticError) Error added in v2.25.0

func (e *DiagnosticError) Error() string

Error is a pretty bad format for these errors. Try to avoid using this.

func (*DiagnosticError) Extend added in v2.25.0

func (e *DiagnosticError) Extend(key string, diag hcl.Diagnostics)

func (*DiagnosticError) HasError added in v2.25.0

func (e *DiagnosticError) HasError() bool

func (*DiagnosticError) Response added in v2.25.0

func (e *DiagnosticError) Response() (int, codersdk.Response)

type Renderer

type Renderer interface {
	Render(ctx context.Context, ownerID uuid.UUID, values map[string]string) (*preview.Output, hcl.Diagnostics)
	Close()
}

Renderer is able to execute and evaluate terraform with the given inputs. It may use the database to fetch additional state, such as a user's groups, roles, etc. Therefore, it requires an authenticated `ctx`.

'Close()' **must** be called once the renderer is no longer needed. Forgetting to do so will result in a memory leak.

func Prepare

func Prepare(ctx context.Context, db database.Store, cache files.FileAcquirer, versionID uuid.UUID, options ...func(r *loader)) (Renderer, error)

Prepare is the entrypoint for this package. It loads the necessary objects & files from the database and returns a Renderer that can be used to render the template version's parameters.

Directories

Path Synopsis
Package rendermock is a generated GoMock package.
Package rendermock is a generated GoMock package.

Jump to

Keyboard shortcuts

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