Record with a predictable name and then either use that name directly or To query by those tags in other configurations.įor server addresses, use a provider-specific resource to create a DNS To make resources automatically discoverable. In systems that support user-defined labels or tags, use a tagging convention To retrieve those values in other configurations. Publish to the key/value store and consul_keys
Where a shared Consul cluster is available, use Rather than multiple deployments, data can be passed from one component toĪnother using paired resources types and data sources. Where multiple configurations are representing distinct system components Whose arguments describe any small differences between the deployments. In that case, the root module of each configuration willĬonsist only of a backend configuration and a small number of module blocks Represent the common elements, and then represent each instance as a separateĬonfiguration that instantiates those common elements in the context of aĭifferent backend. Instead, use one or more re-usable modules to Named workspacesĪre not a suitable isolation mechanism for this scenario. In this case, the backend used for each deployment often belongs to thatĭeployment, with different credentials and access controls. In particular, organizations commonly want to create a strong separationīetween multiple deployments of the same infrastructure serving differentĭevelopment stages (e.g. Have its own separate configuration and backend, and will thus have its own Workspaces aloneĪre not a suitable tool for system decomposition, because each subsystem should Separately and, if appropriate, by distinct teams. Separate Terraform configurations that correspond with suitable architecturalīoundaries within the system so that different components can be managed When Terraform is used to manage larger systems, teams should use multiple Once the change is merged and deployed to theĭefault workspace, the test infrastructure can be destroyed and the temporary Of the main infrastructure so that changes can be tested without affecting Might create a corresponding workspace and deploy into it a temporary "copy" When aįeature branch is created to develop a change, the developer of that feature
Which describes the intended state of production infrastructure. The default workspace might correspond to the "main" or "trunk" branch, Non-default workspaces are often related to feature branches in version control. To freely experiment with changes without affecting the default workspace. Set of infrastructure changes might create a new temporary workspace in order For example, a developer working on a complex They are convenient inĪ number of situations, but cannot solve all problems.Ī common use for multiple workspaces is to create a parallel, distinct copy ofĪ set of infrastructure in order to test a set of changes before modifying the Named workspaces allow conveniently switching between multiple instances ofĪ single configuration within its single backend. Overloading of the word "environment" both within Terraform itself and within
It was renamed in 0.10 based on feedback about confusion caused by the In the 0.9 line of Terraform releases, this concept was known as "environment". Multiple workspaces are currently supported by the following backends: To be deployed without configuring a new backend or changing authentication Has only one backend, but multiple distinct instances of that configuration To be associated with a single configuration. One Terraform state associated with that configuration.Ĭertain backends support multiple named workspaces, allowing multiple states The backend has only one workspace, called "default", and thus there is only The persistent data stored in the backend belongs to a workspace. That defines how operations are executed and where persistent data such as Each Terraform configuration has an associated backend