reference

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 16 modules, 13 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

View Source
const (
	// Wildcard denotes a wildcard resource name
	Wildcard = "*"
)

Variables

View Source
var (
	// ReRef represents a regular expression for Terraform resource references
	// in scraped HCL example manifests.
	ReRef = regexp.MustCompile(`\${(.+)}`)
)

Functions

This section is empty.

Types

type Injector

type Injector struct {
	ModulePath        string
	ProviderShortName string
}

Injector resolves references using provider metadata

func NewInjector

func NewInjector(modulePath string) *Injector

NewInjector initializes a new Injector

func (*Injector) InjectReferences

func (rr *Injector) InjectReferences(configResources map[string]*config.Resource) error

InjectReferences injects cross-resource references using the provider metadata scraped from the Terraform registry.

func (*Injector) ResolveReferencesOfPaved

func (rr *Injector) ResolveReferencesOfPaved(pm *PavedWithManifest, resolutionContext *ResolutionContext) error

ResolveReferencesOfPaved resolves references of a PavedWithManifest in the given resolution context.

func (*Injector) SetReferenceTypes

func (rr *Injector) SetReferenceTypes(configResources map[string]*config.Resource) error

SetReferenceTypes resolves reference types of configured references using their TerraformNames.

type Parts

type Parts struct {
	Resource    string
	ExampleName string
	Attribute   string
}

Parts represents the components (resource name, example name & attribute name) parsed from an HCL reference.

func MatchRefParts

func MatchRefParts(ref string) *Parts

MatchRefParts parses a Parts from an HCL reference string

func NewRefParts

func NewRefParts(resource, exampleName string) Parts

NewRefParts initializes a new Parts from the specified resource and example names.

func NewRefPartsFromResourceName

func NewRefPartsFromResourceName(rn string) Parts

NewRefPartsFromResourceName initializes a new Parts from the specified <resource name>.<example name> string.

func (Parts) GetResourceName

func (parts Parts) GetResourceName(wildcardName bool) string

GetResourceName returns the resource name or the wildcard for this Parts.

type PavedWithManifest

type PavedWithManifest struct {
	Paved        *fieldpath.Paved
	ManifestPath string
	ParamsPrefix []string

	Config      *config.Resource
	Group       string
	Version     string
	ExampleName string
	// contains filtered or unexported fields
}

PavedWithManifest represents an example manifest with a fieldpath.Paved

type ResolutionContext

type ResolutionContext struct {
	WildcardNames bool
	Context       map[string]*PavedWithManifest
}

ResolutionContext represents a reference resolution context where wildcard or named references are used.

func PrepareLocalResolutionContext

func PrepareLocalResolutionContext(exampleMeta registry.ResourceExample, rootName string) (*ResolutionContext, error)

PrepareLocalResolutionContext returns a ResolutionContext that can be used for resolving references between a target resource and its dependencies that are exemplified together with the resource in Terraform registry.

Jump to

Keyboard shortcuts

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