source

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package source indexes a stack's Terraform source so a plan resource can be linked to the file:line where it is declared.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index maps (module, type, name) → declaration location.

func Build

func Build(dir, repoRoot string) *Index

Build parses dir's *.tf (root module) plus any local modules listed in dir/.terraform/modules/modules.json, recording each resource block's location relative to repoRoot. Files outside repoRoot, unparseable files, and modules cached under .terraform are skipped. Build never fails: a missing or unreadable tree just yields a sparse index (callers fall back).

func (*Index) Lookup

func (idx *Index) Lookup(moduleAddress, typ, name string) (Loc, bool)

Lookup resolves a plan resource. moduleAddress is the plan's module_address ("" for root, "module.a.module.b" for nested); the instance key is irrelevant.

type Loc

type Loc struct {
	File string
	Line int
}

Loc is a resource declaration location, with File relative to the repo root.

Jump to

Keyboard shortcuts

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