-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Plan Checks with plancheck.ExpectResourceAction
, plancheck.ExpectEmptyPlan
, and plancheck.ExpectNonEmptyPlan
#63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RFC overall looks good to me, so I'll start code commenting for tactical feedback. 👍
ResourceActionChange
PlanAssertplancheck.ExpectResourceAction
, plancheck.ExpectEmptyPlan
, and plancheck.ExpectNonEmptyPlan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🚀
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR introduces generic plan check functionality that can be run at different points in a test step (pre-apply, post-apply, etc). These checks can inspect the plan and return an error to fail the test.
The
plancheck.PlanCheck
interface can be implemented by provider developers, however, this PR contains a new packageplancheck
that contains implementations for common use cases:plancheck.ExpectResourceAction
: For #61 - Allow asserting that a resource will undergo a specific action type, such as Create, Update, NoOp, Replace, etc.plancheck.ExpectEmptyPlan
: Allows asserting that a plan is emptyplancheck.ExpectNonEmptyPlan
: Allows asserting that a plan is not emptyWork left for this PR
ResourceActionType
or if we can re-usetfjson.Action
website/docs/plugin/testing/acceptance-testing/plan-checks.mdx