hcltmpl

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsDynamicTemplate

func ContainsDynamicTemplate(s string) bool

ContainsDynamicTemplate reports whether the template syntax supported by CTS to load from env, Consul KV, and Vault is within s.

func ContainsVaultSecret

func ContainsVaultSecret(s string) bool

ContainsVaultSecret reports whether the template syntax to fetch secrets from Vault is within s.

Types

type NamedBlock

type NamedBlock struct {
	Name      string
	Variables Variables
	// contains filtered or unexported fields
}

NamedBlock represents an HCL block with one label and an arbitrary number of attributes of varying types.

block "name" {
	attr = "str"
	count = 10
}

func LoadDynamicConfig

func LoadDynamicConfig(ctx context.Context, w tmpls.Watcher, r tmpls.Resolver,
	config map[string]interface{}) (NamedBlock, error)

LoadDynamicConfig converts a decoding of HCL named blocks into a struct representation with cty types and fetches dynamic values with templated configuration.

func NewNamedBlock

func NewNamedBlock(b map[string]interface{}) NamedBlock

NewNamedBlock converts a decoding of an HCL named block into a struct representation with cty types.

func NewNamedBlockTest

func NewNamedBlockTest(b map[string]interface{}) NamedBlock

NewNamedBlockTest is used to simplify testing

func NewNamedBlocksTest

func NewNamedBlocksTest(rawBlocks []map[string]interface{}) []NamedBlock

NewNamedBlocksTest is used to simplify testing

func (*NamedBlock) Copy

func (b *NamedBlock) Copy() NamedBlock

Copy creates a copy of the NamedBlock with a shallow copy of the raw config

func (*NamedBlock) ObjectType

func (b *NamedBlock) ObjectType() *cty.Type

ObjectType converts the named block to an Object

func (*NamedBlock) ObjectVal

func (b *NamedBlock) ObjectVal() *cty.Value

func (NamedBlock) RawConfig

func (b NamedBlock) RawConfig() map[string]interface{}

func (*NamedBlock) SortedAttributes

func (b *NamedBlock) SortedAttributes() []string

SortedAttributes returns a list of sorted attribute names

type Variables

type Variables map[string]cty.Value

Variables are the cty value representation of HCL block arguments

func (Variables) Keys

func (v Variables) Keys() []string

Keys return a list of sorted variable names

Jump to

Keyboard shortcuts

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