Using remote states
Note
The code for this section is under the chap05/remote-state
directory in the GitHub repo of this book.
Using the directory structure approach provides added flexibility. It is a good approach to decompose complex configurations into smaller, more manageable parts, often called layers, when creating complex architectures. Each layer is a logical grouping of resources. For example, let’s say we want to provision a database and a set of servers that connect to the database. Furthermore, we have two teams – one responsible for the database and the second managing the servers. In addition, while the database is relatively stable and should be running at all times, we expect the servers to be re-created many times, and we might want to remove the servers over the weekend to save cost.
We can accomplish this goal by creating two layers and placing all configuration files related to the layer in separate subdirectories. That is, we create two...