Documentation
¶
Index ¶
- Constants
- func AreCompatible(left Action, right Action) bool
- func IsRelevant(rc *tfjson.ResourceChange) (bool, error)
- func ParsePlan(data []byte) (*tfjson.Plan, error)
- func ReadPlan(path string) (*tfjson.Plan, error)
- func ReadPlans(paths []string) ([]*tfjson.Plan, error)
- type Action
- type Address
- type FilterResults
- type PlanFilter
- func MergePlanFilters(filters []*PlanFilter) (*PlanFilter, error)
- func NewFilterFromPlan(plan *tfjson.Plan) (*PlanFilter, error)
- func NewFilterFromPlanPaths(paths []string) (*PlanFilter, error)
- func NewFilterFromPlans(plans []*tfjson.Plan) (*PlanFilter, error)
- func ParsePlanFilter(data []byte) (*PlanFilter, error)
- func ReadPlanFilter(path string) (*PlanFilter, error)
- func ReadPlanFilters(paths []string) ([]*PlanFilter, error)
Constants ¶
const CurrentFormatVersion = "0.1"
CurrentFormatVersion of the rules file
Variables ¶
This section is empty.
Functions ¶
func AreCompatible ¶
AreCompatible returns true if the actions may be equivalent between different state files
func IsRelevant ¶
func IsRelevant(rc *tfjson.ResourceChange) (bool, error)
IsRelevant returns true if the change is something we care about
Types ¶
type Action ¶
type Action string
Action is an enum that corresponds to a valid tfjson plan array e.g. ["delete", "create"] is ActionDeleteCreate
func ConvertAction ¶
ConvertAction from the tfjson form to one we can more easily work with
type FilterResults ¶
type FilterResults struct {
Errors map[Address]Action
Changes map[Address]Action
PlanFilter *PlanFilter
}
FilterResults describes whether a plan is allowed or not
func CheckPlan ¶
func CheckPlan(filter *PlanFilter, plan *tfjson.Plan) (*FilterResults, error)
CheckPlan
func NewFilterResults ¶
func NewFilterResults(filter *PlanFilter) *FilterResults
func (*FilterResults) HasChanges ¶
func (fr *FilterResults) HasChanges() bool
HasChanges returns true if there's at least 1 change
func (*FilterResults) HasErrors ¶
func (fr *FilterResults) HasErrors() bool
HasErrors returns true if there's at least 1 error
type PlanFilter ¶
type PlanFilter struct {
// The version of the PlanFilter format
FormatVersion string `json:"format_version,omitempty"`
// The actions we can perform on a resource
AllowedActions map[Address][]Action `json:"allowed_actions"`
}
PlanFilter defines what is allowed in a plan
func MergePlanFilters ¶
func MergePlanFilters(filters []*PlanFilter) (*PlanFilter, error)
MergePlanFilters combines filters from multiple plans into one
func NewFilterFromPlan ¶
func NewFilterFromPlan(plan *tfjson.Plan) (*PlanFilter, error)
FilterForPlan creates a filter that accepts everything in the specified plan
func NewFilterFromPlanPaths ¶
func NewFilterFromPlanPaths(paths []string) (*PlanFilter, error)
NewFilterFromPlanPaths creates filter from a sequence of paths
func NewFilterFromPlans ¶
func NewFilterFromPlans(plans []*tfjson.Plan) (*PlanFilter, error)
NewFilterFromPlans creates a filter that accepts everything in a list of plans
func ParsePlanFilter ¶
func ParsePlanFilter(data []byte) (*PlanFilter, error)
ParsePlanFilter from JSON
func ReadPlanFilter ¶
func ReadPlanFilter(path string) (*PlanFilter, error)
ReadPlanFilter from a path
func ReadPlanFilters ¶
func ReadPlanFilters(paths []string) ([]*PlanFilter, error)
ReadPlanFilters from paths
func (*PlanFilter) HasAction ¶
func (f *PlanFilter) HasAction(address Address, action Action) bool
HasAction returns true if the action is allowed by the filter
func (*PlanFilter) WriteJSON ¶
func (pf *PlanFilter) WriteJSON(path string) error
WritePlanFilter to a path