How to manage terraform state?

Should I have one state file with all my resources (network, compute, database…) or one for each?
e.g. one state file for network resources and another with compute resources.

There is no one right or wrong answer. It very much depends on what you are doing and how you are organised.

If you have multiple teams managing different bits of the stack it probably makes sense to have multiple states.

If you have loads of resources it probably makes sense to split into multiple smaller states.

If you have different approval processes it probably makes sense to align that with different states.

If you have very different change cadences it might make sense to split into multiple states.

2 Likes