Deploy Everything
After you've written your components and configured your stacks, now we're ready to deploy them!
You will learn
- How Atmos identifies components using context variables and naming patterns
- How to preview your configurations and changes before applying them
- How to deploy your components, one at a time
Provision Atmos Components into all Stacks
Provision the station
Atmos component into the stacks:
atmos terraform apply station -s dev
atmos terraform apply station -s staging
atmos terraform apply station -s prod
Alternatively, you can execute the configured Atmos workflow to provision all the components in all the stacks:
# Execute the workflow `apply-all-components` from the workflow manifest `networking`
atmos workflow apply-all-components -f networking
Stack Search Algorithm
Looking at the commands above, you might have a question "How does Atmos find the component in the stack and all the variables?"
Let's consider what Atmos does when executing the command atmos terraform apply station -s prod
:
-
Atmos uses the
stacks.name_pattern
defined in the CLI config. In this example, we have defined a simple name based onstacks.name_pattern: "{stage}"
. This means that the stack name is just thestage
part of the stack name. -
Atmos searches for the stack configuration file (in the
stacks
folder and all sub-folders) wherestage: prod
is defined (inline or via imports). During the search, Atmos processes all parent (top-level) config files and compares the context variables specified in the command (-s
flag) with the context variables defined in the stack configurations, finally finding the matching stack -
Atmos finds the component
station
in the stack, processing all the inline configs and all the imports -
Atmos deep-merges all the catalog imports for the
station
component and then deep-merges all the variables for the component defined in all sections (globalvars
, terraformvars
, base componentsvars
, componentvars
), producing the final variables for thestation
component in theprod
stack -
And lastly, Atmos writes the final deep-merged variables into a
.tfvar.json
file in the component directory and then executesterraform apply -var-file ...
command
Ready to take the next step?
Now that you’ve seen Atmos in action, you can explore the extra credit!
Or take a moment to explore its core concepts. You have only just scratched the surface of Atmos. Atmos is a powerful enterprise-grade framework with so much more to offer!