state

package
v0.0.0-...-8e52ff2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsModuleFilename

func IsModuleFilename(name string) bool

func ParseModuleManifest

func ParseModuleManifest(modPath string) (*datadir.ModuleManifest, error)

Types

type InstalledModules

type InstalledModules map[string]string

InstalledModules is a map of normalized source addresses from the manifest to the path of the local directory where the module is installed

func InstalledModulesFromManifest

func InstalledModulesFromManifest(manifest *datadir.ModuleManifest) InstalledModules

type ModuleState

type ModuleState struct {
	SourceAddr tfmodule.ModuleSourceAddr

	Meta tfmodule.Meta

	Files map[string]*hcl.File

	// The terraform state of the resources/data sources.
	// Only the resource with no resource/module "count"/"for_each" used will be populated.
	//
	// The key is the relative resource address to the containing module, without the index part:
	// - Absoulute address: [module.<module name>[\[index\]].][data.]<resource type>.<resource name>[\[<index>\]]
	// - Relative address :                                   [data.]<resource type>.<resource name>
	// (as we only support non-index addressed resources)
	TFStateResources map[string]*tfjson.StateResource

	OriginRefs reference.Origins
	TargetRefs reference.Targets
}

type RootState

type RootState struct {
	// RootPath is the root module's path
	RootPath string

	CoreVersion *version.Version
	CoreSchema  *schema.BodySchema

	ProviderSchemas     map[tfaddr.Provider]*tfschema.ProviderSchema
	ProviderSchemasJSON *tfjson.ProviderSchemas

	ModuleManifest *datadir.ModuleManifest

	// InstalledModules is a map of normalized source addresses from the
	// manifest to the path of the local directory where the module is installed
	InstalledModules InstalledModules

	// ModuleStates includes states of each module, keyed by module path.
	// Especially, the "." key represents the root module.
	//
	// TODO: Shall we use tfmodule.ModuleSourceAddr instead?
	ModuleStates map[string]*ModuleState
}

func NewRootState

func NewRootState(tf *tfexec.Terraform, fs filesystem.FS, path string) (*RootState, error)

func (*RootState) AddModuleState

func (s *RootState) AddModuleState(fs filesystem.FS, modPath string, tfstate *tfjson.StateModule) error

func (*RootState) DeclaredModuleCalls

func (s *RootState) DeclaredModuleCalls(modPath string) (map[string]tfmodule.DeclaredModuleCall, error)

DeclaredModuleCalls implements schema.StateReader.

func (*RootState) Decoder

func (s *RootState) Decoder() *decoder.Decoder

func (*RootState) InstalledModulePath

func (s *RootState) InstalledModulePath(rootPath string, normalizedSource string) (string, bool)

InstalledModulePath implements schema.StateReader.

func (*RootState) LocalModuleMeta

func (s *RootState) LocalModuleMeta(modPath string) (*tfmodule.Meta, error)

LocalModuleMeta implements schema.StateReader.

func (*RootState) Paths

func (s *RootState) Paths(ctx context.Context) []lang.Path

Paths implements decoder.PathReader.

func (*RootState) ProviderSchema

func (s *RootState) ProviderSchema(modPath string, addr tfaddr.Provider, vc version.Constraints) (*tfschema.ProviderSchema, error)

ProviderSchema implements schema.StateReader.

func (*RootState) RegistryModuleMeta

func (s *RootState) RegistryModuleMeta(addr tfaddr.Module, cons version.Constraints) (*registry.ModuleData, error)

RegistryModuleMeta implements schema.StateReader.

Jump to

Keyboard shortcuts

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