hashicorp / hashicorp/terraform-plugin-sdk
Consolidate ConflictsWith errors
- Dominant language
- Go
- Stars
- 485
- Forks
- 244
- Avg merge
- 19h 57m
- Merged PRs (30d)
- 4
Description
### SDK version
```
v1.4.0
```
### Use-cases
Have a single error message for two related ConflictsWith fields- see https://github.com/terraform-providers/terraform-provider-google/issues/5284.
### Attempted Solutions
If two fields conflict with each other, we can get a single error message by only setting `ConflictsWith` on one of them, which works fine.
However, if three fields (A, B, and C) conflict with each other, we would have to set `ConflictsWith` on at least two of them in order to cover all cases (setting it only on A would mean that a user could set B and C together in their config), which means that a user could end up with two error messages.
### Proposal
Consolidate error messages when possible. In the example in the related issue, instead of having both `Error: "name_prefix": conflicts with name` and `Error: "name": conflicts with name_prefix`, recognize that those two are the same and only return one of them. My guess is that we'd also want to do something similar to `ExactlyOneOf` and `AtLeastOneOf`.
### References
https://github.com/terraform-providers/terraform-provider-google/issues/5284
Contributor guide
Assessment
This issue has not been assessed yet.