hashicorp / hashicorp/terraform-plugin-sdk
Write up Best Practices page for types of things to store/not store in state
- Dominant language
- Go
- Stars
- 485
- Forks
- 244
- Avg merge
- 19h 57m
- Merged PRs (30d)
- 4
Description
We should add a page to the "Best Practices" Extend docs (https://www.terraform.io/docs/extend/best-practices/naming.html) that discusses what are recommended types of data to store or not store in state, limitations on state size and implications, etc. Some examples:
* Potentially large file content should not be stored in state, specifically due to gRPC messaging size limitations, prefer storing a path to a file that could be uploaded, and possibly a checksum of the contents or something if you need change detection.
* Binary data should not be stored in state, there is no raw binary type, just strings, you can use base64 and there are functions to handle this type of data.
* gRPC message size limitations is ~4mb, but that is shared among all fields in a message, and the state is potentially sent multiple times (prior state, config, proposed, etc), so the actual limit on a single resource state is much smaller, closer to ~1mb, but you should avoid anything that could potentially easily push you to that limit and keep a buffer for additional protocol information or changes down the road.
Contributor guide
Assessment
This issue has not been assessed yet.