terraform

package
v0.0.0-...-980e7ab Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type And

type And[S Schema] []Matcher[S]

And is a Matcher that applies when all of its containing Matcher instances Match.

func (And[S]) Match

func (and And[S]) Match(name string, data S) bool

Match returns true when a name and Schema Match for all the containing Matcher instances.

type AttrMatcher

type AttrMatcher Matcher[*tfjson.SchemaAttribute]

AttrMatcher is a Matcher for tfjson.SchemaAttribute data.

type Encoder

type Encoder[S Schema] struct {
	// contains filtered or unexported fields
}

Encoder encodes a map[string]Schema using a *template.Template.

func ModuleEncoder

func ModuleEncoder(extra ...Extra) *Encoder[*tfjson.Schema]

ModuleEncoder instantiates an Encoder for *tfjson.Schema data with optional Extra extras.

func (*Encoder[S]) Encode

func (enc *Encoder[S]) Encode(w io.Writer, data map[string]S) error

Encode a map[string]Schema using a *template.Template.

type Extra

type Extra interface {
	Key() string
	Value() string
}
var (

	// FreemarkerPreResourceExtra applies Extra template blocks using {{template "freemarker_preresource"}} in a *template.Template.
	FreemarkerPreResourceExtra Extra = &extraImpl{
		key:   "freemarker_preresource",
		value: freemarkerPreResourceExtra,
	}

	// FreemarkerResourceExtra applies Extra template blocks using {{template "freemarker_resource"}} in a *template.Template.
	FreemarkerResourceExtra Extra = &extraImpl{
		key:   "freemarker_resource",
		value: freemarkerResourceExtra,
	}

	// GoogleProviderExtra applies Extra template blocks using {{template "provider"}} in a *template.Template.
	GoogleProviderExtra Extra = &extraImpl{
		key:   "provider",
		value: googleProviderExtra,
	}

	// GoogleProviderBetaExtra applies Extra template blocks using {{template "provider"}} in a *template.Template.
	GoogleProviderBetaExtra Extra = &extraImpl{
		key:   "provider",
		value: googleProviderBetaExtra,
	}

	// TemplatePathClassic applies Extra template blocks using {{template "template_path"}} in a *template.Template.
	TemplatePathClassic Extra = &extraImpl{
		key:   "template_path",
		value: freemarkerTemplatePathClassic,
	}

	// TemplatePathFlex applies Extra template blocks using {{template "template_path"}} in a *template.Template.
	TemplatePathFlex Extra = &extraImpl{
		key:   "template_path",
		value: freemarkerTemplatePathFlex,
	}

	// ProviderAttributeExtra applies Extra attribute assignment to the resource block 'provider' attribute for
	// the generally available terraform provider.
	ProviderAttributeExtra Extra = &extraImpl{
		key:   "provider_attribute",
		value: "provider = google",
	}

	// ProviderBetaAttributeExtra applies Extra attribute assignment to the resource block 'provider' attribute for
	// the beta terraform provider.
	ProviderBetaAttributeExtra Extra = &extraImpl{
		key:   "provider_attribute",
		value: "provider = google-beta",
	}
)

type Filter

type Filter[S Schema] struct {
	// contains filtered or unexported fields
}

Filter applies to a map[string]Schema to include data matching a Matcher.

func NewFilter

func NewFilter[S Schema](matcher Matcher[S]) *Filter[S]

NewFilter instantiates a Filter from a Matcher.

func (*Filter[S]) Apply

func (f *Filter[S]) Apply(data map[string]S) map[string]S

Apply the Filter's Matcher on the data. Returns a map[string]S that satisfies the Matcher.

type MatchIsComputed

type MatchIsComputed bool

MatchIsComputed is a Matcher for tfjson.SchemaAttribute Computed attribute.

func (MatchIsComputed) Match

func (m MatchIsComputed) Match(_ string, data *tfjson.SchemaAttribute) bool

Match whether tfjson.SchemaAttribute Computed is the bool value of the MatchIsDeprecated receiver.

type MatchIsDeprecated

type MatchIsDeprecated bool

MatchIsDeprecated is a Matcher for tfjson.SchemaAttribute Deprecated attribute.

func (MatchIsDeprecated) Match

Match whether tfjson.SchemaAttribute Deprecated is the bool value of the MatchIsDeprecated receiver.

type MatchName

type MatchName[S Schema] string

MatchName is a Matcher tha only matches a name.

func (MatchName[S]) Match

func (m MatchName[S]) Match(name string, _ S) bool

Match matches against a name only.

type Matcher

type Matcher[S Schema] interface {

	// Match a name and a Schema.
	Match(name string, data S) bool
}

Matcher matches against a name and a Schema.

func Not

func Not[S Schema](matcher Matcher[S]) Matcher[S]

Not returns is a Matcher that negates its result i.e. not Matcher.

type Or

type Or[S Schema] []Matcher[S]

Or is a Matcher that applies when any of its containing Matcher instances Match.

func (Or[S]) Match

func (or Or[S]) Match(name string, data S) bool

Match returns true when a name and Schema Match for any the containing Matcher instances.

type Schema

type Schema interface {
	*tfjson.ProviderSchema | *tfjson.Schema | *tfjson.SchemaAttribute
}

Schema models terraform provider and resource schemas.

Directories

Path Synopsis
Package schemas contains terraform providers schemas acquired the published registry.
Package schemas contains terraform providers schemas acquired the published registry.

Jump to

Keyboard shortcuts

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