preview

package module
v1.0.5-0...-db636be Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: AGPL-3.0 Imports: 26 Imported by: 0

README

Cortex Preview

Cortex Preview is an RWSTech component used by Cortex Code to extract and manage workspace parameters from Terraform configurations.

It validates parameter selections and provides the dynamic form controls and dependency handling used by Cortex Code templates.

Support

Report incorrect workspace parameter behavior with the workspace template issue form. For other bugs and feature requests, open a general issue.

This repository is maintained publicly by RWSTech.

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
	Logger          *slog.Logger
	// TFVars will override any variables set in '.tfvars' files.
	// The value set must be a cty.Value, as the type can be anything.
	TFVars map[string]cty.Value
}

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.
	//
	// JSON marshalling is handled in the custom methods.
	ModuleOutput cty.Value `json:"-"`

	Parameters    []types.Parameter `json:"parameters"`
	WorkspaceTags types.TagBlocks   `json:"workspace_tags"`
	Presets       []types.Preset    `json:"presets"`
	// Files is included for printing diagnostics.
	// They can be marshalled, but not unmarshalled. This is a limitation
	// of the HCL library.
	Files map[string]*hcl.File `json:"-"`
}

func Preview

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

func (Output) MarshalJSON

func (o Output) MarshalJSON() ([]byte, error)

MarshalJSON includes the ModuleOutput and files in the JSON output. Output should never be unmarshalled. Marshalling to JSON is strictly useful for debugging information.

Directories

Path Synopsis
cli
cmd
preview command
internal
Package gorules defines custom lint rules for ruleguard.
Package gorules defines custom lint rules for ruleguard.
Code taken from https://github.com/aquasecurity/trivy/blob/0449787eb52854cbdd7f4c5794adbf58965e60f8/pkg/iac/scanners/terraform/parser/load_vars.go
Code taken from https://github.com/aquasecurity/trivy/blob/0449787eb52854cbdd7f4c5794adbf58965e60f8/pkg/iac/scanners/terraform/parser/load_vars.go

Jump to

Keyboard shortcuts

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