preview

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

README

Coder Logo Light Coder Logo Dark

Workspace Parameters sourced from Terraform



Coder Repo | Docs | Why Coder | Premium

discord release godoc Go Report Card OpenSSF Best Practices license

This repository contains a component of Coder, currently called Preview, that extracts and manages workspace parameters from Terraform configurations.

It provides real-time validation to verify user selections and compatibility while presenting dynamic form controls that adapt based on previous choices.

As users select parameters from the template, Preview validates the selection for compatibility and user entitlements. The form updates other fields based on the selections and only shows relevant and compatible options.

Once Preview is incorporated in Coder, it will allow template admins to use a variety of form controls with dependencies from which users can deploy their ideal workspaces.

Coder Hero Image

Support

Do you have a workspace template that has incorrect parameters? Please open workspace template behavior issue.

For other bugs, feature requests, etc, feel free to open an issue.

Join our Discord to provide feedback on in-progress features and chat with the community using Coder!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	// PlanJSONPath is an optional path to a plan file. If PlanJSON isn't
	// specified, and PlanJSONPath is, then the file will be read and treated
	// as if the contents were passed in directly.
	PlanJSONPath    string
	PlanJSON        json.RawMessage
	ParameterValues map[string]string
	Owner           types.WorkspaceOwner
}

func (Input) RichParameterValue

func (i Input) RichParameterValue(key string) (string, bool)

type Output

type Output struct {
	// ModuleOutput is any 'output' values from the terraform files. This has 0
	// effect on the parameters, tags, etc. It can be helpful for debugging, as it
	// allows exporting some terraform values to the caller to review.
	ModuleOutput cty.Value

	Parameters    []types.Parameter
	WorkspaceTags types.TagBlocks
	// Files is included for printing diagnostics.
	// TODO: Is the memory impact of this too much? Should we render diagnostic source code
	// into the diagnostics up front? and remove this?
	Files map[string]*hcl.File
}

func Preview

func Preview(ctx context.Context, input Input, dir fs.FS) (output *Output, diagnostics hcl.Diagnostics)

Directories

Path Synopsis
cli
cmd
internal

Jump to

Keyboard shortcuts

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