Skip to main content

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 myapp Atmos component into the stacks:

atmos terraform apply myapp -s dev

atmos terraform apply myapp -s staging

atmos terraform apply myapp -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 myapp -s prod:

  • Atmos uses the stacks.name_pattern defined in the CLI config. In this example, we have defined a simple name based on stacks.name_pattern: "{stage}". This means that the stack name is just the stage part of the stack name.

  • Atmos searches for the stack configuration file (in the stacks folder and all sub-folders) where stage: 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 myapp in the stack, processing all the inline configs and all the imports

  • Atmos deep-merges all the catalog imports for the myapp component and then deep-merges all the variables for the component defined in all sections (global vars, terraform vars, base components vars, component vars), producing the final variables for the myapp component in the prod stack

  • And lastly, Atmos writes the final deep-merged variables into a .tfvar.json file in the component directory and then executes terraform 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!