hashicorp / hashicorp/terraform-plugin-testing

Consider Plan Checks for Generic Resource/Output Changes

Open
#233 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
68
Forks
22
Avg merge
2d 12h
Merged PRs (30d)
1

Description

### terraform-plugin-testing version

```
v1.5.1
```

### Use cases

This Go module provides a few abstractions for asserting whether providers are planning a change that will affect state:

- [`TestStep.ExpectNonEmptyPlan`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/helper/resource#TestStep.ExpectNonEmptyPlan)
- [`TestStep.PlanOnly`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/helper/resource#TestStep.PlanOnly) (mainly to avoid the implicit apply of a `Config*` test step)
- [`plancheck.ExpectEmptyPlan()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/plancheck#ExpectEmptyPlan)
- [`plancheck.ExpectNonEmptyPlan()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/plancheck#ExpectNonEmptyPlan)

In #222, it was noted that due to their naming `ExpectEmptyPlan` and `ExpectNonEmptyPlan` should be capturing _all_ plan changes that would affect the saved state -- both resource changes and output changes. However, there could be situations where developers want to write generic assertions against _only_ resource changes or _only_ output changes being expected (or not) to occur. This feature request is here to capture interest and use cases.

### Proposal

Introduce separate, but still generic plan checks against any/all resource/output changes, e.g.

* `plancheck.ExpectNoOutputChanges()`
* `plancheck.ExpectNoResourceChanges()`
* `plancheck.ExpectOutputChanges()`
* `plancheck.ExpectResourceChanges()`

### References

- #221 (targeted output value change check)
- #222

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.