Configure Atmos CLI
In the previous step, we've decided on the following:
- Use a monorepo to configure and provision two Terraform components into three AWS accounts and two AWS regions
- The filesystem layout for the infrastructure monorepo
- To be able to use Component Remote State, we put the
atmos.yamlCLI config file into/usr/local/etc/atmos/atmos.yamlfolder and set the ENV varATMOS_BASE_PATHto point to the absolute path of the root of the repo
Next step is to configure atmos.yaml.
atmos.yaml configuration file is used to control the behavior of the atmos CLI. The file supports many features that are configured in different
sections of the atmos.yaml file. For the description of all the sections, refer to CLI Configuration.
For the purpose of this Quick Start, below is the minimum configuration required for Atmos to work with Terraform and to
configure Atmos components and Atmos stacks. Copy the YAML config below into your atmos.yaml
file.
atmos.yaml
The atmos.yaml configuration file defines the following sections.
NOTE: below is the description of the sections relevant to this Quick Start guide. For the description of all the sections, refer to CLI Configuration.
base_path- The base path for components, stacks and workflows configurations. We set it to
./so it will use the current working directory. Alternatively, we can override this behavior by setting the ENV varATMOS_BASE_PATHto point to another directory location. components.terraform.base_path- The base path to the Terraform components (Terraform root modules). As described in Configure Repository, we've decided to put the Terraform components into the
components/terraformdirectory, and this setting tells Atmos where to find them. Atmos will join the base path (set in theATMOS_BASE_PATHENN var) withcomponents.terraform.base_pathto calculate the final path to the Terraform components. components.terraform.apply_auto_approve- If set to
true, Atmos automatically adds the-auto-approveoption to instruct Terraform to apply the plan without asking for confirmation when executingterraform applycommand. components.terraform.deploy_run_init- If set to
true, Atmos runsterraform initbefore executingatmos terraform deploycommand. components.terraform.init_run_reconfigure- If set to
true, Atmos automatically adds the-reconfigureoption to update the backend configuration when executingterraform initcommand. components.terraform.auto_generate_backend_file- If set to
true, Atmos automatically generates the Terraform backend file from the component configuration when executingterraform planandterraform applycommands. stacks.base_path- The base path to the Atmos stacks. As described in Configure Repository, we've decided to put the stack configurations into the
stacksdirectory, and this setting tells Atmos where to find them. Atmos will join the base path (set in theATMOS_BASE_PATHENN var) withstacks.base_pathto calculate the final path to the stacks. stacks.included_paths- List of file paths to the top-level stacks in the
stacksdirectory to include in search when Atmos searches for the stack where the component is defined when executingatmoscommands. stacks.excluded_paths- List of file paths to the top-level stacks in the
stacksdirectory to exclude from search when Atmos searches for the stack where the component is defined when executingatmoscommands. stacks.name_pattern- Atmos stack name pattern. When executing
atmoscommands, Atmos does not use the configuration file names and their filesystem locations to search for the stack where the component is defined. Instead, Atmos uses the context variables (namespace,tenant,environment,stage) to search for the stack. The stack config file names can be anything, and they can be in any folder in any sub-folder in thestacksdirectory. For example, when executing theatmos terraform apply vpc -s tenant1-ue2-devcommand, the stacktenant1-ue2-devis specified by the-sflag. By looking atname_pattern: "{tenant}-{environment}-{stage}"and processing the tokens, Atmos knows that the first part of the stack name istenant, the second part isenvironment, and the third part isstage. Then Atmos searches for the stack configuration file (in thestacksdirectory) wheretenant: tenant1,environment: ue2andstage: devare defined (inline or via imports). workflows.base_path- The base path to Atmos Workflows files.
logs.verbose- Set to
trueto increase log verbosity. When set totrue, Atmos prints to the console all the steps it takes to find and process theatmos.yamlCLI config file, and all the steps it takes to find the stack and find and process the component in the stack. commands- Configuration for Atmos Custom Commands.
schemas- See JSON Schema and OPA Policy configurations for: Atmos Schema Validation, Atmos Custom Validation.