Documentation
¶
Overview ¶
Package tfplan reads the plans a `terragrunt run --all --json-out-dir <dir>` run leaves — one `terraform show -json` rendering per unit, under <dir>/<unit>/ — and renders the markdown summary a reviewer approves: the totals, every destroyed resource, a per-unit add/change/destroy table and each changed unit's resource list, destroys first.
Index ¶
Constants ¶
const ( ActionCreate = "create" ActionUpdate = "update" ActionDelete = "delete" ActionReplace = "replace" ActionImport = "import" )
Planned-change labels, as a reviewer reads them in the summary.
const JSONFile = "tfplan.json"
JSONFile is the name terragrunt gives each unit's `terraform show -json` rendering of its plan under --json-out-dir.
Variables ¶
This section is empty.
Functions ¶
func FailedSummary ¶
FailedSummary is the summary a failed plan leaves in place of the unit tables, so a PR comment or job summary says why there is no plan.
Types ¶
type Change ¶
type Change struct {
// Address is the resource address (aws_s3_bucket.docs, module.x.aws_iam_role.y).
Address string
// Action is the change: create, update, delete, replace, import, or Terraform's
// action list joined with "+" for any other combination (forget, …).
Action string
}
Change is one planned change to a resource.
type UnitPlan ¶
type UnitPlan struct {
// Unit is the unit's path under the plan directory (e.g. "eks").
Unit string
// Changes lists the unit's planned resource changes, destroys first.
Changes []Change
// Add, Change, and Destroy count the resources the plan creates, updates, and
// destroys, as Terraform's own "Plan:" line does (a replace is one add and one
// destroy).
Add, Change, Destroy int
// Outputs reports whether the plan changes a root-module output value.
Outputs bool
}
UnitPlan is one unit's planned changes, read from its JSONFile.
func ReadUnits ¶
ReadUnits reads every unit's JSONFile under dir, sorted by unit path. A missing dir reads as no units.
func (UnitPlan) HasChanges ¶
HasChanges reports whether applying the plan would change anything: a resource or an output.