The Hashicorp stack already supported this kind of usecase, it's called Sentinel: https://www.hashicorp.com/sentinel
I do agree that it's a pity that Sentinel isn't free.
I do agree that it's a pity that Sentinel isn't free.
[1]: https://docs.hashicorp.com/sentinel/downloads [2]: https://docs.hashicorp.com/sentinel/intro/getting-started/ru... [3]: https://github.com/hashicorp/terraform-foundational-policies... [4]: https://github.com/hashicorp/terraform-guides/tree/master/go... [5]: https://github.com/hashicorp/terraform-guides/tree/master/go... [6]: https://github.com/hashicorp/terraform-guides/tree/master/go... [7]: https://github.com/hashicorp/sentinel-sdk [8]: https://docs.hashicorp.com/sentinel/commands/apply
[1]: https://www.hashicorp.com/blog/announcing-hashicorp-sentinel...