Chapter 6. Optimizing State
Early in the effort to encode your existing infrastructure, the natural inclination is just to get as many things encoded and automated, orienting the codebase around the architecture, possibly into existing resource or responsibility domains, without thinking specifically about how TF works. Most likely, a sufficiently thought-out separation of concerns, even without strong TF exposure, will be serviceable for large swathes of effort, establishing the vast majority of your infrastructure and running without problems for months and years.
As your TF ecosystem grows and evolves, you may begin to experience challenges with some of the behind-the-scenes operations TF performs to keep its record of your infrastructure consistent. In particular, you may begin to notice unfortunate couplings across your codebase, recurrent incidents of inconsistencies between TF state and the running instances, TF operations that seem to take longer than they should, or all of the above. This chapter reviews various concepts, challenges, and approaches regarding the TF state and discusses how to converge toward their optimal organization.
State Concepts and Definitions
The TF state represents the “memory” for TF, preserving what it knows in terms of where and how all managed resources are configured. There are several components and concepts that make up and support the TF state. Understanding these makes it easier to discuss practices for successful operation of TF. This ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access