reader

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

(C) Copyright 2024 Hewlett Packard Enterprise Development LP

(C) Copyright 2024 Hewlett Packard Enterprise Development LP

(C) Copyright 2024 Hewlett Packard Enterprise Development LP

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilesNotFound    = fmt.Errorf("no .tf files found")
	ErrNoVariablesFound = fmt.Errorf("tf files don't contain any variables")
)

Functions

func ExpressionToJSONObject

func ExpressionToJSONObject(in hcl.Expression) (any, error)

ExpressionToJSONObject converts an HCL expression to an `any` type so that can be marshaled to JSON later.

func GetTypeConstraint

func GetTypeConstraint(in hcl.Expression) (any, error)

GetTypeConstraint converts the expression into a type constraint and marshals it to JSON. Returns the JSON output as a []byte. More info on exactly how this works is here: https://pkg.go.dev/github.com/zclconf/go-cty@v1.14.4/cty#Type.MarshalJSON

func GetVarMap

func GetVarMap(path string, debugOut bool) (map[string]model.TranslatedVariable, error)

GetVarMap reads all .tf files in a directory and returns a map of variable names to their translated values. For the purpose of this application, all that matters is the model.VariableBlock contained in this, which contains a direct unmarshal of the block itself using the hcl package. The rest of the information is for debugging purposes, and to simplify the process of deciding if a variable is 'required' later. Note: in 'strict' mode, all variables are required, regardless of whether they have a default value or not.

Types

This section is empty.

Jump to

Keyboard shortcuts

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