Documentation
¶
Overview ¶
Package tf holds Terraform-facing helpers: pure parsers for plan/schema JSON now, and (later) a driver wrapping hashicorp/terraform-exec.
Index ¶
- type DriftItem
- type RoundTrip
- type Runner
- func (r *Runner) Fmt(ctx context.Context) (string, error)
- func (r *Runner) GenerateConfig(ctx context.Context, outFile string) (string, error)
- func (r *Runner) Init(ctx context.Context) (string, error)
- func (r *Runner) InitLocal(ctx context.Context) (string, error)
- func (r *Runner) Plan(ctx context.Context, outFile string) (string, error)
- func (r *Runner) ShowJSON(ctx context.Context, planFile string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RoundTrip ¶
type RoundTrip struct {
Clean []string // addresses that round-tripped clean (no-op)
Drift []DriftItem // addresses with residual drift (a property not captured)
}
RoundTrip is the parsed correctness-oracle result of a terraform plan.
func ParseRoundTrip ¶
ParseRoundTrip parses `terraform show -json <plan>` output. A managed resource whose change.actions == ["no-op"] round-tripped clean; anything else is drift. Data sources (mode != "managed") are ignored. Source: https://developer.hashicorp.com/terraform/internals/json-format
type Runner ¶
Runner drives the terraform CLI in a working directory. (We can swap this for hashicorp/terraform-exec later; shelling out keeps the skeleton dependency-free.)
func (*Runner) Fmt ¶
Fmt runs `terraform fmt -recursive` to canonically format the generated repo. It needs no init/providers, so it is safe to run on the repo tree directly.
func (*Runner) GenerateConfig ¶
GenerateConfig runs `terraform plan -generate-config-out=<out>` to draft HCL for the import blocks in the working dir. Config generation is experimental (may over-emit / leak values), so callers curate the output.
func (*Runner) InitLocal ¶
InitLocal initializes with the remote backend skipped (local state). The correctness oracle only needs to plan against reality, not manage remote state, so it must not require the reconciled backend.tf's -backend-config.