-
Notifications
You must be signed in to change notification settings - Fork 11
/
plan_check.go
30 lines (24 loc) · 952 Bytes
/
plan_check.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package plancheck
import (
"context"
tfjson "github.com/hashicorp/terraform-json"
)
// PlanCheck defines an interface for implementing test logic that checks a plan file and then returns an error
// if the plan file does not match what is expected.
type PlanCheck interface {
// CheckPlan should perform the plan check.
CheckPlan(context.Context, CheckPlanRequest, *CheckPlanResponse)
}
// CheckPlanRequest is a request for an invoke of the CheckPlan function.
type CheckPlanRequest struct {
// Plan represents a parsed plan file, retrieved via the `terraform show -json` command.
Plan *tfjson.Plan
}
// CheckPlanResponse is a response to an invoke of the CheckPlan function.
type CheckPlanResponse struct {
// Error is used to report the failure of a plan check assertion and is combined with other PlanCheck errors
// to be reported as a test failure.
Error error
}