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.yaml
CLI config file into/usr/local/etc/atmos/atmos.yaml
folder and set the ENV varATMOS_BASE_PATH
to 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_PATH
to 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/terraform
directory, and this setting tells Atmos where to find them. Atmos will join the base path (set in theATMOS_BASE_PATH
ENN var) withcomponents.terraform.base_path
to calculate the final path to the Terraform components. components.terraform.apply_auto_approve
- If set to
true
, Atmos automatically adds the-auto-approve
option to instruct Terraform to apply the plan without asking for confirmation when executingterraform apply
command. components.terraform.deploy_run_init
- If set to
true
, Atmos runsterraform init
before executingatmos terraform deploy
command. components.terraform.init_run_reconfigure
- If set to
true
, Atmos automatically adds the-reconfigure
option to update the backend configuration when executingterraform init
command. components.terraform.auto_generate_backend_file
- If set to
true
, Atmos automatically generates the Terraform backend file from the component configuration when executingterraform plan
andterraform apply
commands. 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
stacks
directory, and this setting tells Atmos where to find them. Atmos will join the base path (set in theATMOS_BASE_PATH
ENN var) withstacks.base_path
to calculate the final path to the stacks. stacks.included_paths
- List of file paths to the top-level stacks in the
stacks
directory to include in search when Atmos searches for the stack where the component is defined when executingatmos
commands. stacks.excluded_paths
- List of file paths to the top-level stacks in the
stacks
directory to exclude from search when Atmos searches for the stack where the component is defined when executingatmos
commands. stacks.name_pattern
- Atmos stack name pattern. When executing
atmos
commands, 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 thestacks
directory. For example, when executing theatmos terraform apply vpc -s tenant1-ue2-dev
command, the stacktenant1-ue2-dev
is specified by the-s
flag. 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 thestacks
directory) wheretenant: tenant1
,environment: ue2
andstage: dev
are defined (inline or via imports). workflows.base_path
- The base path to Atmos Workflows files.
logs.verbose
- Set to
true
to increase log verbosity. When set totrue
, Atmos prints to the console all the steps it takes to find and process theatmos.yaml
CLI 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.