Chapter 7. Configuring Stack Instances
Using a single stack code project makes it easier to maintain multiple consistent instances of infrastructure, as described in “Pattern: Reusable Stack”. However, you often need to customize different instances of a stack. For example, you might size a cluster with fewer servers in a development environment than in production.
Here is an example of stack code that defines a container hosting cluster with configurable minimum and maximum numbers of servers:
container_cluster:web_cluster-${environment}min_size:${cluster_minimum}max_size:${cluster_maximum}
You pass different parameter values to this code for each environment, as depicted in Figure 7-1.
Stack tools such as Terraform and CloudFormation support multiple ways of setting configuration parameter values. These typically include passing values on the command line, reading them from a file, and having the infrastructure code retrieve them from a key-value store.
Teams managing infrastructure need to decide how to use these features to manage and pass configuration values to their stack tool. It’s essential to ensure the values are defined and applied consistently to each environment.
Figure 7-1. Using the same code with different parameter values for each environment
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